-
-
Notifications
You must be signed in to change notification settings - Fork 227
Python 3.6 support #137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
And here are two sed commands to do just that: sed -i '/from __future__ import annotations/d' */models/*.py
sed -r -i 's/(def from_dict\(d: Dict\[str, Any\]\) -> )(.+):$/\1"\2":/' */models/*.py Make sure to adapt |
@pawamoy is that the only piece of the generated clients that isn't compatible with 3.6? If so then we can just change the style to use quotes instead of |
|
Okay so we should also add that dependency then for 3.6 support. |
@pawamoy 0.6.0-alpha.3 (building now) should work with Python 3.6 (both the CLI and the generated clients). Please give it a spin when you get a chance and see if I missed anything. |
@dbanty that's great, thanks! I'll give it a try. |
I haven't heard any complaints yet, and CI is now running 3.6 on every commit- so I'm pretty confident releasing 0.6.0 will finish this up. I'm going to close this issue to mark progress on 0.6.0 milestone, but definitely open a new one if you encounter any issues. |
Is your feature request related to a problem? Please describe.
I was able to install Python 3.7 with pyenv, then openapi-python-client with pipx, but now I see that the generated clients are compatible with Python >=3.7 as well, because of this instruction at least:
(see https://stackoverflow.com/questions/52889746/cant-import-annotations-from-future/52890129)
If I understand correctly, this
annotations
import is used to avoid putting quotes around forward references (or avoid forward references themselves?) in modelsfrom_dict
methods.Describe the solution you'd like
Maybe openapi-python-client could provide a configuration option to tell what Python version is the target, and adapt its output to it. For Python 3.6, the
from __future__ import annotations
lines would be removed, and thefrom_dict
methods of models would put quotes around their return type annotation.Describe alternatives you've considered
I'm stuck with Python 3.6, at least for some time, so the only alternative I see is manually fixing the generated code, or writing a script to do it automatically 🙂
The text was updated successfully, but these errors were encountered: