Skip to content

Add 3-day dependency cooldown via uv - #277

Merged
sewi-cpan merged 2 commits into
masterfrom
add-dependency-cooldown-via-uv
Apr 30, 2026
Merged

sewi-cpan merged 2 commits into
masterfrom
add-dependency-cooldown-via-uv

Conversation

@sewi-cpan

@sewi-cpan sewi-cpan commented Apr 25, 2026 •

Copy link
Copy Markdown
Contributor

IMPORTANT:
This PR

  • switches from pip to uv
  • removes Python 3.6 support

Refuse to resolve any package version published less than 3 days ago. The community typically flags malicious PyPI releases within hours; a 3-day quarantine catches almost all of them before they reach the lockfile or, more importantly, a developer's laptop.

Triggering incident: on 2026-03-24 the TeamPCP threat actor published backdoored litellm 1.82.7/1.82.8 to PyPI after compromising LiteLLM's CI through a poisoned Trivy GitHub Action. The payload was a .pth file that ran on every Python process - not just litellm imports - stealing SSH keys, cloud credentials, and API keys. Live for ~3h before PyPI quarantined them; a 3-day cooldown would have prevented all exposure.
https://simonwillison.net/2026/Mar/24/package-managers-need-to-cool-down/

Pip has no native cooldown, so this migrates the dev workflow to uv with a committed lockfile:

  • pyproject.toml gains [build-system], [project] (PEP 621, migrated from setup.py), [tool.setuptools.*], and [tool.uv] with required-version = ">=0.11.2", exclude-newer = "3 days", and environments = ["python_version >= '3.11'"]. setup.py is removed.
  • uv.lock is committed; its [options] block carries exclude-newer-span = "P3D".
  • Python 3.6 is dropped from CI / tox / classifiers - PEP 621 needs setuptools >= 61 which is 3.7+. 3.6 EOL'd Dec 2021, py37's tox env already covers every Django+psycopg combo py36 used to share, and end users on 3.6 still get the published wheel (wheel installs do not trigger [build-system]).
  • CircleCI's matrix testing stays on pip (3.7-3.13). Per the threat model, CI is "minor" compared to laptop installs; the cooldown's primary value lives in the committed uv.lock and the dev uv sync workflow.
  • README's "Getting started" switches from virtualenv + pip to uv sync --extra dev --extra test.

Verified: uv lock resolves 104 packages cleanly with no missing upload-time warnings. Negative test - pinning joust==1.1.0 (published 2026-04-25, same day) is rejected by uv with the cooldown enabled and accepted without it.

Refuse to resolve any package version published less than 3 days ago.
The community typically flags malicious PyPI releases within hours;
a 3-day quarantine catches almost all of them before they reach the
lockfile or, more importantly, a developer's laptop.

Triggering incident: on 2026-03-24 the TeamPCP threat actor published
backdoored litellm 1.82.7/1.82.8 to PyPI after compromising LiteLLM's
CI through a poisoned Trivy GitHub Action.  The payload was a `.pth`
file that ran on every Python process - not just `litellm` imports -
stealing SSH keys, cloud credentials, and API keys.  Live for ~3h
before PyPI quarantined them; a 3-day cooldown would have prevented
all exposure.
https://simonwillison.net/2026/Mar/24/package-managers-need-to-cool-down/

Pip has no native cooldown, so this migrates the dev workflow to uv
with a committed lockfile:

- pyproject.toml gains [build-system], [project] (PEP 621, migrated
  from setup.py), [tool.setuptools.*], and [tool.uv] with
  required-version = ">=0.11.2", exclude-newer = "3 days", and
  environments = ["python_version >= '3.11'"].  setup.py is removed.
- uv.lock is committed; its [options] block carries
  exclude-newer-span = "P3D".
- Python 3.6 is dropped from CI / tox / classifiers - PEP 621 needs
  setuptools >= 61 which is 3.7+.  3.6 EOL'd Dec 2021, py37's tox env
  already covers every Django+psycopg combo py36 used to share, and
  end users on 3.6 still get the published wheel (wheel installs do
  not trigger [build-system]).
- CircleCI's matrix testing stays on pip (3.7-3.13).  Per the threat
  model, CI is "minor" compared to laptop installs; the cooldown's
  primary value lives in the committed uv.lock and the dev `uv sync`
  workflow.
- README's "Getting started" switches from virtualenv + pip to
  `uv sync --extra dev --extra test`.

Verified: `uv lock` resolves 104 packages cleanly with no missing
upload-time warnings.  Negative test - pinning joust==1.1.0
(published 2026-04-25, same day) is rejected by uv with the cooldown
enabled and accepted without it.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@sewi-cpan
sewi-cpan requested a review from Photonios April 25, 2026 11:54
Without `isolated_build = true`, tox 3 (pinned for Python 3.7 and 3.8)
falls back to legacy `python setup.py` builds and fails with
"ERROR: pyproject.toml file found" once setup.py is removed.  tox 4
(used on 3.9+) defaults to isolated builds and was unaffected.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@sewi-cpan
sewi-cpan merged commit b573ebd into master Apr 30, 2026
1 check passed
@sewi-cpan
sewi-cpan deleted the add-dependency-cooldown-via-uv branch April 30, 2026 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants