SCons: Bump minimum Python version to 3.8 #98907
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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]
becomesstr | None
Union[str, int]
becomesstr | int
List[str]
becomeslist[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
https://github.com/godotengine/godot/pull/98898#issuecomment-2460153094 ↩
https://docs.python.org/3/whatsnew/3.8.html#assignment-expressions ↩
https://docs.python.org/3/whatsnew/3.8.html#f-strings-support-for-self-documenting-expressions-and-debugging ↩