Skip to content

Implement a relative cooldown in --exclude-newer #13674

@potiuk

Description

@potiuk

What's the problem this feature will solve?

I think it would be great if pip implements a "cooldown" feature. This has been recently widely discussed in the security community after the npm being targetted by the Shai-Hulud 2 malware, that cooldowns would be a great protection for - especially - open-source projects and libraries that do not necessary need to get the latest packages immediately.

Cooldown periods will give time to registry maintainers (both public PyPI and other registries) to perform necessary scans, security researchers reviews, AI tools, running sandboxed tests by security-focused 3rd-parties on new versions of packages release and increase the chance that malware will be detected before it is installed.

This article from @woodruffw https://blog.yossarian.net/2025/11/21/We-should-all-be-using-dependency-cooldowns describes the cooldown effects pretty well, and calls for everyone to use cooldowns.

It's easy with dependabot and renovate on CI, however there is also another vector of attack - locak workstations of developers where the install packages, and it would be great to have confguration and option to have cooldown period applied by default on those workstations.

Of course there is the --exclude-newer but it only has support for specifying the absolute date, not relative one. Of course you could do all the bash or zsh magic to calculate it, but that's not really an option if you would like to configure a default cooldown period.

UV already has a PR in progress about it astral-sh/uv#16814 after very deep discussion about it - and it aims to allow relative specification for the --exclude-newer, which I think is a very good idea.

It would be great to have such relative --exclude-newer in pip - both as command line and configurable default.

Describe the solution you'd like

The --exclude-newer could accept other values than absolute timestamp - specifically relative time specification like '1 day, 1 week, 30 days`.

Alternative Solutions

Telling people to calculate the date and pass it to --exclude-newer in the absolute timestamp form. Unfortunately that does not achieve easily the "default behaviour" of specific cooldown period like 5 days.

Additional context

https://blog.yossarian.net/2025/11/21/We-should-all-be-using-dependency-cooldowns

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions