fleetlint Policy for a fleet of repositories
v0.10
Getting started

repo/lockfile-committed/python

Dependency lockfile is committed

Implements repo/lockfile-committed for python.

Severityerror
Tiers1, 2
Stackspython
Scopeeach
Kindexpr
Sourcelibrary v0.7.0
Selected byfleetlint-recommended@v0.7.0

Requirement

A Python lockfile is tracked next to the project (or, for a uv workspace member, at the workspace root): uv.lock, poetry.lock, pdm.lock, Pipfile.lock, pylock.toml, or a requirements file that pins hashes (--hash=) or was generated by pip-compile / uv pip compile. A hand-written requirements.txt is not a lockfile. A pyproject.toml without dependencies needs none.

Why

Builds are reproducible only when dependency versions are pinned in git.

Check

tracked().exists(f, f in ["uv.lock", "poetry.lock", "pdm.lock", "Pipfile.lock", "pylock.toml"] || f.matches(r'^pylock\.[^/]+\.toml$')) || ["../", "../../", "../../../"].exists(d, file(d + "uv.lock") && file(d + "pyproject.toml") && text(d + "pyproject.toml").contains("[tool.uv.workspace]")) || tracked().exists(f, f.matches(r'^(requirements/[^/]+|requirements[^/]*)\.(txt|lock)$')
     && text(f).matches(r'--hash=|autogenerated by (pip-compile|uv)'))
|| (file("pyproject.toml") && !file("setup.py") && !exists("requirements*.txt")
    && !text("pyproject.toml").matches(r'(?m)^\s*dependencies\s*=\s*\[\s*($|[\x22\x27#])|\[tool\.poetry\.(group\.[^.\]]+\.)?dependencies\]|\[dependency-groups\]'))

Fix

Lock the dependencies (uv lock, poetry lock, or uv pip compile --generate-hashes) and commit the lockfile.

Agent instruction: Run the package manager to produce the lockfile, remove any .gitignore entry for it, and commit it.

A finding of this rule points at uv.lock.

Sources


Generated by fleetlint docs from catalog v0.7.0.