repo/toolchain-pinned/python
Toolchain version is pinned
Implements repo/toolchain-pinned for python.
| Severity | warning |
| Tiers | 1, 2 |
| Stacks | python |
| Scope | each |
| Kind | expr |
| Source | library v0.7.0 |
| Selected by | fleetlint-recommended@v0.7.0 |
Requirement
.python-version names a version, or .tool-versions/mise or devbox.json names python with a version. requires-python is a range, not a pin. In devbox.json the package needs a version (python@3.13, python313); @latest does not count.
Why
Without a pin, every machine and every CI run builds with whatever compiler or runtime happens to be installed, and failures cannot be reproduced.
Check
["", "../", "../../", "../../../"].exists(d, file(d + ".python-version") && scan(d + ".python-version", r'^\s*\d').size() > 0) || ["", "../", "../../", "../../../"].exists(d, file(d + ".tool-versions") && scan(d + ".tool-versions", r'^\s*(python)\s+\S*\d').size() > 0) || ["", "../", "../../", "../../../"].exists(d, ["mise.toml", ".mise.toml", ".config/mise.toml", ".config/mise/config.toml", "mise/config.toml"].exists(n,
file(d + n) && scan(d + n, r'^\s*"?(python)"?\s*=\s*[^#\n]*\d').size() > 0))
|| ["", "../", "../../", "../../../"].exists(d, file(d + "devbox.json") && text(d + "devbox.json").matches(r'"(python|python3)(@v?\d|"\s*:\s*("v?\d|\{[^}]*"version"\s*:\s*"v?\d))|"(python3\d+)(@[^"]*)?"'))Fix
Run uv python pin 3.x (writes .python-version).
Agent instruction: Add the stack’s toolchain pin set to the version currently installed; do not upgrade the toolchain in the same change.
A finding of this rule points at .python-version.
Sources
- https://fleetlint.org/baseline/#hygiene (convention)
- https://mise.jdx.dev/configuration.html (spec)
- https://github.com/jetify-com/devbox/blob/main/.schema/devbox.schema.json (spec)
- https://fleetlint.org/stacks/
- https://docs.astral.sh/uv/concepts/python-versions/ (spec)
- https://fleetlint.org/stacks/#python
Generated by fleetlint docs from catalog v0.7.0.