Skip to content
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

Consider increasing the minimum Python version #458

Closed
gotmax23 opened this issue Nov 11, 2022 · 2 comments · Fixed by #460
Closed

Consider increasing the minimum Python version #458

gotmax23 opened this issue Nov 11, 2022 · 2 comments · Fixed by #460

Comments

@gotmax23
Copy link
Contributor

antsibull currently supports Python 3.6 and above. I propose increasing the bumping Python version to 3.8. For one thing, the latest Ansible release to support below Python 3.8 (on the controller) was 2.11/4, so antsibull is useless on older Python versions for building new ansible releases. Currently, there are multiple TODO: PY3.8 comments throughout the codebase:

$ rg 'TODO: PY3.8'
antsibull/src/antsibull/build_ansible_commands.py:        # TODO: PY3.8:
antsibull/src/antsibull/build_ansible_commands.py:        # TODO: PY3.8:
antsibull-core/src/antsibull_core/ansible_core.py:                # TODO: PY3.8: while chunk := await response.read(lib_ctx.chunksize):
antsibull-core/src/antsibull_core/dependency_files.py:    # TODO: PY3.8:
antsibull-core/src/antsibull_core/utils/hashing.py:        # TODO: PY3.8: while chunk := await f.read(ctx.chunksize):
antsibull-core/src/antsibull_core/galaxy.py:        # TODO: PY3.8: self.collection_cache: t.Final[t.Optional[str]] = collection_cache
antsibull-core/src/antsibull_core/galaxy.py:                # TODO: PY3.8: We can use t.Final in __init__ instead of cast here.
antsibull-core/src/antsibull_core/galaxy.py:                # TODO: PY3.8: while chunk := await response.content.read(lib_ctx.chunksize):
antsibull-core/src/antsibull_core/galaxy.py:            # TODO: PY3.8: We can use t.Final in __init__ instead of cast here.
antsibull-core/src/antsibull_core/utils/io.py:            # TODO: PY3.8: while chunk := await f.read(lib_ctx.chunksize)

Amongst other improvements, we'd able to take advantage of new type-hinting enhancements from Python 3.9 and 3.10 by using from __future__ import annotations. E.g., t.Dict[str, str] > dict[str, str] and t.Optional[str] -> str | None. (We couldn't use the newer syntax on 3.8 in the pydantic models, but it's fair game everywhere else.)

@gotmax23
Copy link
Contributor Author

gotmax23 commented Nov 11, 2022

We'd also be able to remove everything except BooleanOptionalAction from https://github.com/ansible-community/antsibull-core/blob/main/src/antsibull_core/compat.py.

@felixfontein
Copy link
Collaborator

I thought about this earlier, but never got around to do that yet. Both antsibull and antsibull-changelog can easily go up to 3.8. I would probably stick to 3.8 for now and not use 3.9 though. The advantages of 3.9 are not that big that it's worth annoying devs who still stick to 3.8 for whatever reasons (this is more a problem for antsibull-changelog than for antsibull though).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants