Repository navigation
build(tools): run the repository tooling on a locked uv Python 3.14 environment - #323
Merged
aghassemlouei merged 10 commits intoOct 21, 2026
Merged
Conversation
Add a root pyproject.toml and uv.lock that pin the tools/ scripts and the root tests/ suite to Python 3.14, the same interpreter the cli/ project uses. The dependencies cover tools/requirements.txt, and dependency groups cover the test runners and the gem4gov-cli packages the root tests import. The root project declares no uv workspace, so cli/ keeps its own lock.
The lint.sh and run_tests.sh scripts now call uv run --locked instead of the system python3 and yapf, so every machine uses the pinned Python 3.14 environment from the root uv.lock. run_tests.sh no longer skips cli/ in its compile check, because cli/ and the root project now pin the same Python version.
The python-tests job now sets up uv with the astral-sh/setup-uv commit that the cli-tests job already pins, installs the root uv.lock with uv sync --locked, and runs pyflakes and pytest through uv. This replaces actions/setup-python on Python 3.11 and the unpinned pip installs. The cli-tests job runs the license header check through uv as well. Remove tools/requirements.txt, because the root pyproject.toml now lists those dependencies.
The commented-out check-docs jobs in .gitlab-ci.yml now install the root uv.lock and run tools/check_documentation.py from the repository root on Python 3.14, so they match the GitHub workflow if you re-enable the pipeline.
The Contributing section of the root README now lists the uv commands that run the unit tests and the lint checks on the pinned Python version.
The new tests/tools/test_uv_tooling.py test fails when a tools/*.sh script calls Python outside `uv run --locked`, when the root pyproject.toml allows more than one Python minor version or drifts from cli/, when the root project declares a uv workspace, or when uv.lock is missing.
…long names The lint step pointed check_names.py at fast/stages, which does not exist, so the script crashed on max() over an empty list. The script also returned its status from the Click command, which Click ignores, so overlong names never failed the check. Point the step at fast/stages-aw, report a usage error when a directory holds no names, and exit non-zero on overlong names.
The locked uv environment installs every package that tests/__init__.py mocked, so the mocks never triggered. Without them, a missing package fails the import instead of letting tests pass against a MagicMock.
Contributor
Author
|
Working on rebasing this. Stand by. |
The file landed in 2-space yapf style after the repository switched to ruff, so ruff check and ruff format --check fail on main.
digitalresistor
force-pushed
the
build/tools-uv-python
branch
from
October 20, 2026 23:56
86eaf82 to
a846ce5
Compare
The tools/ scripts and the root tests/ suite now run on the Python 3.14 that the root pyproject.toml pins, so ruff targets the same version. Blueprint code runs on the deployer's interpreter, and the gem4gov-cli blueprint documents Python 3.6 or later, so blueprints/ keeps the py311 target and ruff does not rewrite it to syntax such as PEP 758 except clauses. The new target reformats three except clauses in tools/.
aghassemlouei
approved these changes
Oct 21, 2026
aghassemlouei
left a comment
Member
There was a problem hiding this comment.
Verified the root pyproject.toml and uv.lock configuration, the ruff.toml per-file target version settings, the tools/check_names.py exit status and fast/stages-aw path fixes, and the tests/tools/test_check_names.py and tests/tools/test_uv_tooling.py test suites.
This was referenced Oct 21, 2026
12 of 19 tasks
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This change runs the
tools/scripts and the roottests/suite on a single pinned Python version and a locked package set. Contributors now install only uv, and CI installs the same environment that they use locally.Fixes #322
Changes in the branch:
pyproject.tomlfile defines thestellar-engine-toolsproject.requires-python = ">=3.14,<3.15", which matches thecli/project, so the whole repository runs on one interpreter.[tool.uv] package = falseand declares no uv workspace, so thecli/project keeps its own independent lock.tools/requirements.txtlisted. They also addpyyaml, which the tools import but the old file never declared.devgroup holds pytest and ruff. Ruff keeps the exact0.17.1pin thattools/requirements.txthad, so a new release cannot change formatting under CI.gem4govgroup holds the packages that the root tests need from the gem4gov-cli blueprint. The blueprint keeps its ownrequirements.txtfile for blueprint users.uv.lockfile locks 58 packages.tools/requirements.txtfile is removed.tools/lint.shscript runs every Python check and both ruff steps throughuv run --locked.tools/run_tests.shscript runs its Python steps throughuv run --project "${REPO_ROOT}" --locked.cli/exclusion and its outdated comment are gone, because both projects now pin Python 3.14.cli/sources too..github/workflows/ci.ymlworkflow, thepython-testsjob now usesastral-sh/setup-uvwithuv sync --locked. It pins the same action SHA as thecli-testsjob.python-testsjob runsruff checkandruff format --checkthroughuv run --locked.cli-testsjob, the license header step now runscheck_boilerplate.pythroughuv run --locked..gitlab-ci.ymlnow use thepython:3.14image and run through uv from the repository root. This fixes the broken paths that the oldcd toolsstep caused.ruff.tomlfile targetspy314, the version that the tooling now runs on.exceptclauses intools/to the PEP 758 form without parentheses.blueprints/code keeps thepy311target throughper-file-target-version. Blueprint code runs on the interpreter of whoever deploys it, and the gem4gov-cli blueprint documents Python 3.6 or later, so ruff must not rewrite it to syntax that only Python 3.14 accepts..gitignorefile ignores.venv/directories.README.mdexplains how to run the checks with uv.tests/tools/test_uv_tooling.pytest enforces five rules.cli/projects share onerequires-pythonrange, and that range spans exactly one minor version.package = falseand declares no uv workspace.uv.lockfile.tools/*.shscripts goes throughuv run --locked.blueprints/stays onpy311.tools/check_names.pystep intools/lint.shnow checksfast/stages-aw.fast/stages, which does not exist, so the script crashed onmax()over an empty list.tests/tools/test_check_names.pytest covers both exit codes, the usage error and thetools/lint.shtarget.tests/test_label_taxonomy.pyfile is now formatted with ruff. It landed in the old 2-space style after the switch to ruff, soruff checkandruff format --checkfail onmainand would fail this branch too. PR style(tests): format test_label_taxonomy.py with ruff #324 carries the same commit formain, and the next rebase drops it here once style(tests): format test_label_taxonomy.py with ruff #324 merges.tests/__init__.pyfile no longer mocks missing packages. The locked environment installs every package it mocked, so the mocks never triggered, and a missing package now fails the import instead of passing against aMagicMock.Related work:
cli/project. Issue [Feature Request] Sync the repository tooling under tools/ from upstream Cloud Foundation Fabric #319 syncstools/from upstream Cloud Foundation Fabric, so it should check the synced scripts against Python 3.14 and this lock.Breaking Changes
Local contributor setup changes. The
tools/requirements.txtfile no longer exists, and thetools/lint.shandtools/run_tests.shscripts now need uv on yourPATH. Terraform deployments, variables and state are unaffected.Merge order
These four pull requests share one merge order. Merge them in this sequence.
ruff checkstep pass onmainagain. Every other pull request needs it for a green CI run.uv.lockfile. Rebase it ontomainafter style(tests): format test_label_taxonomy.py with ruff #324 merges, which drops its copy of the style(tests): format test_label_taxonomy.py with ruff #324 commit.uv.lockfile from build(tools): run the repository tooling on a locked uv Python 3.14 environment #323..git-blame-ignore-revs. It only needs style(tests): format test_label_taxonomy.py with ruff #324 for a green CI run, so it can merge at any point after style(tests): format test_label_taxonomy.py with ruff #324.This pull request is step 2.
Type of Change
Deployment & Compliance Impact
Checklist
Code Quality & Reusability
modules/orfast/stages-aw/can be leveraged for this change.docs/naming-convention.md.Documentation
README.mdof the modified module or blueprint.Security
Testing
Testing Performed
All commands ran locally from the branch.
uv lock --checkanduv sync --lockeduv run --locked pytestcheck_names.pytestsuv run --locked ruff check .anduv run --locked ruff format --check .bash tools/run_tests.shuv lock --check,uv sync --lockedanduv run --locked pytestincli/uv run --locked python ../tools/check_boilerplate.py src testsincli/check_boilerplate.pyon the new test filestools/*.shand the changed shell test scriptsyaml.safe_loadon.github/workflows/ci.ymlterraform fmt -recursive -checkast.parseon the gem4gov-cli and analytics blueprint sources under Python 3.11 and 3.13git diffshows no change underblueprints/check_names.py --prefix-length=10 --failed-only fast/stages-awComparison with the old setup:
tools/requirements.txtand the gem4gov-cli requirements on the same tree. It passed the same tests as the new setup apart from the new ones. That comparison ran before the rebase onto the ruff switch.tools/lint.shran under both setups and gave matching results.validate_metadata.pypasses on both setups.check_boilerplate.py,check_documentation.pyandcheck_links.pyalready fail onmainwith identical output on both setups. This change does not cause those failures.check_names.pycrashed on both setups before the fix in this branch.python3call is added totools/lint.sh.Not verified:
tools/tflint.shandtests/scripts/test_tflint.shdid not run, because tflint is not installed locally. The CItflintjob covers them.tests/scripts/test_common_functions.sh. That count matchesmain, and this branch leaves the file untouched.Follow-ups outside this change:
exclude-newercooldown in both uv projects would keep lock refreshes in line with the repository's two-week rule for new releases..gitlab-ci.ymlwhen that pipeline is enabled again.