Find Python package versions available on a specific date. Solve dependency conflicts by pinning your dependencies to versions that existed on a specific date. This is also useful when trying to get an unmaintained project working due to version conflicts.
Available as both a command-line tool and a web interface.
- Single Package Version: Retrieve the version of a package available as of a specific date.
- Requirements File: Generate a new
requirements.txtwith versions available on the specified date. - Web Interface: Use the tool directly in your browser with no installation required.
- Sensible defaults: Yanked releases are skipped, and pre-releases are excluded unless you opt in with
--pre.
You can use the web interface directly at https://f3dai.github.io/pip-time-machine.
For those who prefer using the command line, you can run the Python script directly.
Install as a command (recommended):
pipx install git+https://github.com/f3dai/pip-time-machine.gitThis provides a pip-time-machine command. Or clone and install dependencies to run the script directly:
git clone https://github.com/f3dai/pip-time-machine.git
cd pip-time-machine
pip install -r requirements.txtDependencies: requests, tqdm, packaging.
Dates use ISO format (YYYY-MM-DD). Month-name formats such as 12 Jul 2023
are also accepted. Examples below use python get_versions.py; if you
installed with pipx, use pip-time-machine instead.
Get help:
python get_versions.py -hGet a single package version:
python get_versions.py <package_name> <YYYY-MM-DD>Example:
python get_versions.py pandas 2023-07-12Generate a requirements file with pinned versions:
python get_versions.py /path/to/requirements.txt <YYYY-MM-DD> [--output output_path.txt]Example:
python get_versions.py requirements.txt 2023-07-12By default, the output file will be named requirements_<YYYY-MM-DD>.txt. Use the --output parameter to specify a different output path.
Additional options:
-s, --specifier— version specifier to emit (==,>=,~=,<=; default==).--pre— include pre-release versions (excluded by default).
The tool queries the PyPI JSON API to find package release dates and selects the most recent version that was available before or on your target date. This approach helps recreate the exact package environment that existed at a point in time.
This isn't a robust solution and can be slow for packages with many releases. It's intended as a helpful utility rather than a production-grade dependency resolver.
Install with dev dependencies and run the test suite:
pip install -e ".[dev]"
pytestContributions are welcome! Please feel free to submit a Pull Request.
Released under the MIT License.