Skip to content

Python 3.6 support #137

Closed
Closed
@pawamoy

Description

@pawamoy

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:

from __future__ import annotations

(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 models from_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 the from_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 🙂

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions