How to Use `--exclude-newer` for Reproducible Python Environments
How to Use `--exclude-newer` for Reproducible Python Environments
The --exclude-newer
option instructs [uv](https://pydevtools.com/handbook/reference/uv/ to ignore any package versions published after the specified date. This creates a time-locked resolution process that ensures consistency regardless of when you run the installation.
uv add -r requirements.txt --exclude-newer 2023-12-12
This is particularly useful when reproducing historical environments or working with deprecated projects
For example, if you clone a repository last updated in June 2023, use the flag to only install dependencies that would have been available at that time:
git clone https://github.com/example/ml-model
cd ml-model
uv add -r requirements.txt --exclude-newer 2023-06-15
Last updated on
How to switch from pyenv to uv for managing Python versionsHow to Write Self-Contained Python Scripts Using PEP 723 Inline Metadata