Skip to content

Commit 5940122

Browse files
Fix silent PyPI hosted scan with no lockfile (#638) (#1885)
* Start fix for #638 Assisted-by: Claude Code:claude-opus-5-5 * Warn when a PyPI hosted scan finds no lockfile A hosted scan of a Python project with no root requirements.txt, tool lock (uv.lock, poetry.lock, pdm.lock, Pipfile.lock), PEP 751 or PEP 723 lock, or Hatch configuration left its PyPI patches unpinned while `--json` showed an empty redirect.warnings list. Every other ecosystem reports this case (redirect_npm_no_lockfile and friends). The PyPI rewriter lane now adds one redirect_pypi_no_lockfile warning per run in that case. It names the files looked for, notes that other requirements files such as requirements-dev.txt are not read, and tells a pyproject.toml project to generate and commit its lock. Refs #638 Assisted-by: Claude Code:claude-opus-5-5 * Test and document redirect_pypi_no_lockfile Adds a hosted scan test for each project layout in #638 that has no Python lock: only requirements-dev.txt, only requirements/base.txt, no requirements file, and a pyproject.toml without uv.lock. Each run must report the warning once, keep the redirect_unconfirmed row, and write nothing. CLI_CONTRACT.md now lists the new warning code. Refs #638 Assisted-by: Claude Code:claude-opus-5-5 * Name each project's own lock step in the warning Review follow-up for redirect_pypi_no_lockfile. The remedy now follows the project's tooling: a Pipfile is told to run `pipenv lock`, and a pyproject that names uv, Poetry or PDM (a [tool.*] table or its build backend) is told to run that tool's lock. Any other pyproject, such as a plain setuptools project, gets both a root requirements.txt pin and the lock commands. The detail also lists every input that would silence it (pylock.<name>.toml, PEP 723 script locks, Hatch) and says "readable", since an unreadable file on disk is treated as missing. The presence check now matches root keys only, like the rewriters it stands in for. Refs #638 Assisted-by: Claude Code:claude-opus-5-5 --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 362bde4 commit 5940122

4 files changed

Lines changed: 386 additions & 1 deletion

File tree

0 commit comments

Comments
 (0)