diff --git a/.chronus/changes/python-drop-py39-2026-04-27-06-52-15.md b/.chronus/changes/python-drop-py39-2026-04-27-06-52-15.md new file mode 100644 index 0000000000..3c4bd43661 --- /dev/null +++ b/.chronus/changes/python-drop-py39-2026-04-27-06-52-15.md @@ -0,0 +1,7 @@ +--- +changeKind: deprecation +packages: + - "@azure-tools/typespec-python" +--- + +Drop support for Python 3.9. The minimum supported Python version is now 3.10. diff --git a/packages/typespec-python/eng/scripts/ci/config/mypy.ini b/packages/typespec-python/eng/scripts/ci/config/mypy.ini index cfd4a49719..79248291b0 100644 --- a/packages/typespec-python/eng/scripts/ci/config/mypy.ini +++ b/packages/typespec-python/eng/scripts/ci/config/mypy.ini @@ -1,6 +1,6 @@ # global configurations [mypy] -python_version = 3.9 +python_version = 3.10 # Exclude mypy check for sub client tests exclude = (.*azure/clientgenerator/core/clientinitialization/operations/_operations\.py|.*azure/clientgenerator/core/clientinitialization/aio/operations/_operations\.py) diff --git a/packages/typespec-python/eng/scripts/ci/config/pylintrc b/packages/typespec-python/eng/scripts/ci/config/pylintrc index ad23a561c6..fa3bb5698c 100644 --- a/packages/typespec-python/eng/scripts/ci/config/pylintrc +++ b/packages/typespec-python/eng/scripts/ci/config/pylintrc @@ -1,5 +1,5 @@ [MASTER] -py-version=3.9 +py-version=3.10 ignore-patterns=test_*,conftest,setup reports=no diff --git a/packages/typespec-python/eng/scripts/ci/config/pyrightconfig.json b/packages/typespec-python/eng/scripts/ci/config/pyrightconfig.json index bebfe77f91..ac35c7ea8a 100644 --- a/packages/typespec-python/eng/scripts/ci/config/pyrightconfig.json +++ b/packages/typespec-python/eng/scripts/ci/config/pyrightconfig.json @@ -3,6 +3,6 @@ "reportTypeCommentUsage": true, "reportMissingImports": false, "reportAttributeAccessIssue": false, - "pythonVersion": "3.9", + "pythonVersion": "3.10", "exclude": ["**/build/**"] } diff --git a/packages/typespec-python/eng/scripts/ci/run_pylint.py b/packages/typespec-python/eng/scripts/ci/run_pylint.py index 3e8bbf220e..8efe2fe1bb 100644 --- a/packages/typespec-python/eng/scripts/ci/run_pylint.py +++ b/packages/typespec-python/eng/scripts/ci/run_pylint.py @@ -51,7 +51,7 @@ def _single_dir_pylint(mod): "--output-format=parseable", "--recursive=y", "--ignore=build", - "--py-version=3.9", + "--py-version=3.10", str(inner_class.absolute()), ] ) diff --git a/packages/typespec-python/eng/scripts/setup/install.py b/packages/typespec-python/eng/scripts/setup/install.py index cdeba45e97..865aaacc84 100644 --- a/packages/typespec-python/eng/scripts/setup/install.py +++ b/packages/typespec-python/eng/scripts/setup/install.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- import sys -if not sys.version_info >= (3, 9, 0): - raise Exception("Autorest for Python extension requires Python 3.9 at least") +if not sys.version_info >= (3, 10, 0): + raise Exception("Autorest for Python extension requires Python 3.10 at least") try: from package_manager import detect_package_manager, PackageManagerNotFoundError @@ -25,4 +25,4 @@ raise Exception("Your Python installation doesn't have venv available") -# Now we have a package manager (uv or pip) and Py >= 3.9 and check is over +# Now we have a package manager (uv or pip) and Py >= 3.10 and check is over diff --git a/packages/typespec-python/eng/scripts/setup/prepare.py b/packages/typespec-python/eng/scripts/setup/prepare.py index 045442ffb6..549ae045ea 100644 --- a/packages/typespec-python/eng/scripts/setup/prepare.py +++ b/packages/typespec-python/eng/scripts/setup/prepare.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- import sys -if not sys.version_info >= (3, 9, 0): - raise Exception("Autorest for Python extension requires Python 3.9 at least") +if not sys.version_info >= (3, 10, 0): + raise Exception("Autorest for Python extension requires Python 3.10 at least") from pathlib import Path from package_manager import create_venv_with_package_manager, install_packages diff --git a/packages/typespec-python/eng/scripts/setup/run-python3.ts b/packages/typespec-python/eng/scripts/setup/run-python3.ts index 9c5d9499ed..7916e71bde 100644 --- a/packages/typespec-python/eng/scripts/setup/run-python3.ts +++ b/packages/typespec-python/eng/scripts/setup/run-python3.ts @@ -11,7 +11,7 @@ import { patchPythonPath } from "./system-requirements.js"; async function runPython3(...args: string[]) { const command = await patchPythonPath(["python", ...args], { - version: ">=3.9", + version: ">=3.10", environmentVariable: "AUTOREST_PYTHON_EXE", }); const [cmd, ...cmdArgs] = command;