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

SCons: Bump minimum Python version to 3.8 #98907

Closed

Conversation

Repiteo
Copy link
Contributor

@Repiteo Repiteo commented Nov 6, 2024

As briefly touched on in a PR bumping GHA's Ubuntu version from 20.041, Python 3.6 is no longer included in those future Ubuntu builds. While it's somewhat arbitrary on which version should be used for a prospective upgrade, let alone if one should happen at all, 3.8 was proposed and that feels like the safest bet to me. Both 3.6 and 3.8 are EOL, but only relatively recently for 3.8; this should still cover our bases for all supported platform baselines.

3.7/3.8 bring quite a lot of QOL goodies, such as assignment operators2 and f-string self-documentation3. But by far the biggest addition comes with from __future__ import annotations, which make several issues relating to type-hints more streamlined. This even includes syntax additions that would otherwise require 3.9 or 3.10, such as:

  • Optional[str] becomes str | None
  • Union[str, int] becomes str | int
  • List[str] becomes list[str] (and all other "simple" container types that required import before)

As such, I've added to pyproject.toml the above as a required import—a relatively common practice on modern python repos. This does make for a LOT of files changed, but 99% of that is just an extra import for python files. Anything beyond that was updating type-hints to utilize modern syntax. No functional changes were made in this PR.

Footnotes

  1. https://github.com/godotengine/godot/pull/98898#issuecomment-2460153094

  2. https://docs.python.org/3/whatsnew/3.8.html#assignment-expressions

  3. https://docs.python.org/3/whatsnew/3.8.html#f-strings-support-for-self-documenting-expressions-and-debugging

@Repiteo Repiteo force-pushed the scons/python-version-bump branch from 172d861 to 8df0064 Compare November 10, 2024 01:00
• Import annotations from __future__ universally
• Integrate new typing syntax where possible
@Repiteo
Copy link
Contributor Author

Repiteo commented Nov 12, 2024

Superseded by #99134

@Repiteo Repiteo closed this Nov 12, 2024
@Repiteo Repiteo deleted the scons/python-version-bump branch November 12, 2024 17:18
@Repiteo Repiteo removed this from the 4.4 milestone Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants