From 7984b96a659667f2fa98b2d1e5ffde62e18b6ecf Mon Sep 17 00:00:00 2001 From: Benjamin Pelletier Date: Tue, 27 Oct 2026 23:51:53 -0700 Subject: [PATCH] Fix tool invocations with older system Python versions --- .github/workflows/CI.md | 2 ++ pyproject.toml | 8 ++++++++ scripts/git/get_version.py | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.md b/.github/workflows/CI.md index d80e0f207a..a546067153 100644 --- a/.github/workflows/CI.md +++ b/.github/workflows/CI.md @@ -18,6 +18,8 @@ This set of tests including [miscellaneous hygiene checks](../../test/repo_hygi To maintain consistency across this large codebase, InterUSS employs a very strict Python linter. But, there is no need to satisfy the linter manually; simply run `make format` from the repo root to resolve most mere-formatting issues that this check will detect. +Standalone host/build utilities must support Python 3.11 and later. The explicit `tool.ruff.per-file-target-version` list in [pyproject.toml](../../pyproject.toml) covers the Git version utilities, the JSON field extractor, and the packaging entry point. Add new scripts invoked directly with system Python to this list. Both `make python-lint` and `make format` use these targets to reject unsupported syntax and avoid introducing newer syntax when fixing or formatting these files. + #### uss_qualifier documentation validation (`make validate-uss-qualifier-docs`) uss_qualifier [scenario documentation](../../monitoring/uss_qualifier/scenarios/README.md#documentation) is required and has strict requirements to ensure a strong, consistent, and correct interface between regulators and others concerned only with the concept of what scenarios are doing, and InterUSS contributors concerned with writing the actual code to perform the test. This check validates many of these documentation requirements. diff --git a/pyproject.toml b/pyproject.toml index ef33f7da86..eebdd16960 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -76,6 +76,14 @@ extend-exclude = [ ] line-length = 88 +[tool.ruff.per-file-target-version] +# Host/build utilities must work with the system Python (3.11+), without uv. +# Add new host entry points here; Docker/uv code uses the project version above. +"scripts/git/get_version.py" = "py311" +"scripts/git/write_version_file.py" = "py311" +"build/dev/extract_json_field.py" = "py311" +"setup.py" = "py311" + [tool.ruff.lint] # Default + isort + pyupgrade select = [ diff --git a/scripts/git/get_version.py b/scripts/git/get_version.py index daf6a2f123..0302beb5b1 100755 --- a/scripts/git/get_version.py +++ b/scripts/git/get_version.py @@ -243,7 +243,7 @@ def get_pep440_version( try: info = get_git_info(component) return derive_pep440_version(info) - except subprocess.SubprocessError, FileNotFoundError, OSError: + except (subprocess.SubprocessError, FileNotFoundError, OSError): pass if os.path.exists(VERSION_FILE_PATH):