Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

CI: Bump minimum Python version (3.9 → 3.10)

Thaddeus Crewsd19054c09d91
diff --git a/.github/workflows/linux_builds.yml b/.github/workflows/linux_builds.yml
index ab38003b86a..52db3fd4a3a 100644
--- a/.github/workflows/linux_builds.yml
+++ b/.github/workflows/linux_builds.yml
@@ -154,7 +154,7 @@ jobs:
uses: ./.github/actions/godot-deps
with:
# Sync with Ensure*Version in SConstruct.
- python-version: 3.9
+ python-version: "3.10"
scons-version: 4.4
- name: Force remove preinstalled .NET SDKs
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 2d4de89e356..97edad6b062 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -53,7 +53,7 @@ repos:
stages: [manual]
- repo: https://github.com/astral-sh/ruff-pre-commit
- rev: v0.15.20
+ rev: v0.17.1
hooks:
- id: ruff-check
args: [--color=always]
@@ -65,7 +65,7 @@ repos:
types_or: [text]
- repo: https://github.com/pre-commit/mirrors-mypy
- rev: v1.19.1
+ rev: v2.4.0
hooks:
- id: mypy
files: \.py$
diff --git a/SConstruct b/SConstruct
index cf4beb08cd7..eebfab8e59b 100644
--- a/SConstruct
+++ b/SConstruct
@@ -2,7 +2,7 @@
from misc.utility.scons_hints import *
EnsureSConsVersion(4, 4)
-EnsurePythonVersion(3, 9)
+EnsurePythonVersion(3, 10)
# System
import glob
diff --git a/core/profiling/SCsub b/core/profiling/SCsub
index 94b7eeaaec9..cc635173a60 100644
--- a/core/profiling/SCsub
+++ b/core/profiling/SCsub
@@ -1,5 +1,4 @@
#!/usr/bin/env python
-from __future__ import annotations
from misc.utility.scons_hints import *
diff --git a/doc/tools/doc_status.py b/doc/tools/doc_status.py
index 9bc3d062b4b..104e5af209f 100755
--- a/doc/tools/doc_status.py
+++ b/doc/tools/doc_status.py
@@ -1,7 +1,5 @@
#!/usr/bin/env python3
-from __future__ import annotations
-
import fnmatch
import math
import os
@@ -138,7 +136,7 @@ class ClassStatusProgress:
self.described: int = described
self.total: int = total
- def __add__(self, other: ClassStatusProgress):
+ def __add__(self, other: "ClassStatusProgress"):
return ClassStatusProgress(self.described + other.described, self.total + other.total)
def increment(self, described: bool):
@@ -189,7 +187,7 @@ class ClassStatus:
"constructors": ClassStatusProgress(),
}
- def __add__(self, other: ClassStatus):
+ def __add__(self, other: "ClassStatus"):
new_status = ClassStatus()
new_status.name = self.name
new_status.has_brief_description = self.has_brief_description and other.has_brief_description
diff --git a/doc/tools/make_rst.py b/doc/tools/make_rst.py
index 2433024070c..602616b91bd 100755
--- a/doc/tools/make_rst.py
+++ b/doc/tools/make_rst.py
@@ -1,8 +1,6 @@
#!/usr/bin/env python3
# This script makes RST files from the XML class reference for use with the online docs.
-from __future__ import annotations
-
import argparse
import os
import re
@@ -424,7 +422,7 @@ class State:
self.current_class = ""
- def parse_params(self, root: ET.Element, context: str) -> list[ParameterDef]:
+ def parse_params(self, root: ET.Element, context: str) -> list["ParameterDef"]:
param_elements = root.findall("param")
params: Any = [None] * len(param_elements)
@@ -474,7 +472,7 @@ class TypeName:
return make_type(self.type_name, state)
@classmethod
- def from_element(cls, element: ET.Element) -> TypeName:
+ def from_element(cls, element: ET.Element) -> "TypeName":
return cls(element.attrib["type"], element.get("enum"), element.get("is_bitfield") == "true")
diff --git a/methods.py b/methods.py
index 5e48f4beabf..cb26e65ad06 100644
--- a/methods.py
+++ b/methods.py
@@ -1,5 +1,3 @@
-from __future__ import annotations
-
import atexit
import contextlib
import glob
@@ -25,7 +23,7 @@ compiler_version_cache = None
# Listing all the folders we have converted
# for SCU in scu_builders.py
-_scu_folders = set()
+_scu_folders = set[str]()
def set_scu_folders(scu_folders):
diff --git a/misc/scripts/char_range_fetch.py b/misc/scripts/char_range_fetch.py
index 336d31b6dbe..c231ba94509 100755
--- a/misc/scripts/char_range_fetch.py
+++ b/misc/scripts/char_range_fetch.py
@@ -4,8 +4,6 @@
# the Unicode Character Database to the `char_range.cpp` file.
# NOTE: This script is deliberately not integrated into the build system;
# you should run it manually whenever you want to update the data.
-from __future__ import annotations
-
import os
import sys
from typing import Final
diff --git a/misc/scripts/ucaps_fetch.py b/misc/scripts/ucaps_fetch.py
index 27ed978708f..d20ff7ef54f 100755
--- a/misc/scripts/ucaps_fetch.py
+++ b/misc/scripts/ucaps_fetch.py
@@ -4,8 +4,6 @@
# the Unicode Character Database to the `ucaps.h` file.
# NOTE: This script is deliberately not integrated into the build system;
# you should run it manually whenever you want to update the data.
-from __future__ import annotations
-
import os
import sys
from typing import Final
diff --git a/misc/scripts/unicode_ranges_fetch.py b/misc/scripts/unicode_ranges_fetch.py
index e84ca7545cc..9a5fd2b8a05 100755
--- a/misc/scripts/unicode_ranges_fetch.py
+++ b/misc/scripts/unicode_ranges_fetch.py
@@ -4,8 +4,6 @@
# the Unicode Character Database to the `unicode_ranges.inc` file.
# NOTE: This script is deliberately not integrated into the build system;
# you should run it manually whenever you want to update the data.
-from __future__ import annotations
-
import os
import sys
from typing import Final
diff --git a/misc/utility/color.py b/misc/utility/color.py
index e482b6a776e..ad73b67ea8f 100644
--- a/misc/utility/color.py
+++ b/misc/utility/color.py
@@ -1,5 +1,3 @@
-from __future__ import annotations
-
import os
import re
import sys
diff --git a/modules/mono/build_scripts/build_assemblies.py b/modules/mono/build_scripts/build_assemblies.py
index ae46efeb765..dfbecbe432e 100755
--- a/modules/mono/build_scripts/build_assemblies.py
+++ b/modules/mono/build_scripts/build_assemblies.py
@@ -1,7 +1,5 @@
#!/usr/bin/env python3
-from __future__ import annotations
-
import os
import os.path
import shlex
diff --git a/modules/raycast/godot_update_embree.py b/modules/raycast/godot_update_embree.py
index b52613d8385..26e4519318d 100644
--- a/modules/raycast/godot_update_embree.py
+++ b/modules/raycast/godot_update_embree.py
@@ -5,7 +5,8 @@ import shutil
import stat
import subprocess
import sys
-from typing import Any, Callable
+from collections.abc import Callable
+from typing import Any
git_tag = "v4.4.0"
diff --git a/pyproject.toml b/pyproject.toml
index a8caa39a1ef..780835e462f 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -10,12 +10,12 @@ warn_redundant_casts = true
warn_return_any = true
warn_unreachable = true
exclude = ["thirdparty/"]
-python_version = "3.9"
+python_version = "3.10"
[tool.ruff]
extend-exclude = ["thirdparty"]
extend-include = ["*SConstruct", "*SCsub"]
-target-version = "py39"
+target-version = "py310"
line-length = 120
preview = true
fix = true
diff --git a/scu_builders.py b/scu_builders.py
index 49acbe57409..405a5277b67 100644
--- a/scu_builders.py
+++ b/scu_builders.py
@@ -10,7 +10,7 @@ from methods import print_error
base_folder_path = str(Path(__file__).parent) + "/"
base_folder_only = os.path.basename(os.path.normpath(base_folder_path))
_verbose = False # Set manually for debug prints
-_scu_folders = set()
+_scu_folders = set[str]()
_max_includes_per_scu = 1024
diff --git a/tests/compatibility_test/run_compatibility_test.py b/tests/compatibility_test/run_compatibility_test.py
index cb898f63ca2..e130098d523 100755
--- a/tests/compatibility_test/run_compatibility_test.py
+++ b/tests/compatibility_test/run_compatibility_test.py
@@ -1,5 +1,4 @@
#!/usr/bin/env python3
-from __future__ import annotations
import itertools
import json
diff --git a/tests/python_build/validate_builders.py b/tests/python_build/validate_builders.py
index 0986d132e31..7e344af8481 100755
--- a/tests/python_build/validate_builders.py
+++ b/tests/python_build/validate_builders.py
@@ -1,13 +1,12 @@
#!/usr/bin/env python3
-from __future__ import annotations
-
if __name__ != "__main__":
raise ImportError(f"{__name__} should not be used as a module.")
import os
import sys
-from typing import Any, Callable
+from collections.abc import Callable
+from typing import Any
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../"))