Skip to main content

devpi-timemachine

devpi-timemachine is a devpi plugin that allows you to pip install (and other similar Python package installation commands) packages as if you were doing so on a previous date in time. Time travel into the future to install not-yet-released packages is not supported (yet).

Usage

  1. Install devpi and devpi-timemachine.
  2. Create a new devpi index. There are three important options to use here. See below for an example command and explanation of these options.
  3. Specify your new index when using pip.
$ devpi index -c 20200101 type=timemachine bases=/root/pypi
$ pip install --index-url http://localhost:3141/root/20200101/+simple/ requests
$ pip list  # Notice that these installed versions are from 2019, not 2023
Package    Version
---------- ----------
certifi    2019.11.28
chardet    3.0.4
idna       2.8
pip        23.1.2
requests   2.22.0
setuptools 67.7.2
urllib3    1.25.7
wheel      0.40.0

These options do the following:

  • The index name ("20200101" in this example) must be a date parseable by datetime.fromisoformat. This date is used as the cutoff date for allowing package versions through the proxy. This is the mechanism by which you can configure devpi-timemachine (and the only real configuration option). The time machine plugin uses this date and PyPI file upload times to choose which releases to filter and to emulate what was available on PyPI at a given point in time.

  • type=timemachine instructs devpi to create the index with the "timemachine" type, which automatically loads the devpi-timemachine plugin. No other configuration is necessary to enable the plugin.

  • bases=/root/pypi configures the index to inherit from the /root/pypi index. I recommend using this option (or using another base that inherits from PyPI), as the date filtering is based on PyPI metadata, but it may in theory work with other bases as well.

Motivation

Ideally, upgrading project dependencies is done early and often to reduce the upgrade burden at any given point. This is not always possible, and upgrading an older project by several years all in one swoop can be difficult. You can make these changes in smaller chunks by explicitly upgrading major dependencies to intermediate versions until you get to your target set of dependencies, but this may result in installing incompatible dependencies, especially in the case of dependency X setting a minimum version but not a maximum version for its own dependency Y. The devpi-timemachine approach allows you to upgrade all of your dependencies up to a calendar date you choose to reduce this possibility; this plugin can be used to simulate your desired practice of upgrading dependencies on a cadence, e.g. monthly.

Status

This is a proof of concept at this stage. Anecdotal testing and development shows that is works as intended, but I'm sure there are limitations, bugs, and edge cases that are not accounted for here.

Metadata

Release files for devpi-timemachine 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for devpi-timemachine 0.0.1
File Size Uploaded
devpi_timemachine-0.0.1.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for devpi-timemachine 0.0.1
File Interpreter ABI Platform
devpi_timemachine-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.6 kB

Release files / devpi_timemachine-0.0.1.tar.gz

Download URL devpi_timemachine-0.0.1.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
98a72a8226039801589562ff21cd2ee1380c27e9fd1337b1f03809caeaad850e
BLAKE2b-256 checksum
How to use checksums
857cf1884a8f8a1780218e4d8f29ba0aef1d13efecc42f16f9d3c299aca702f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.1 CPython/3.11.3

Release files / devpi_timemachine-0.0.1-py3-none-any.whl

Download URL devpi_timemachine-0.0.1-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
683aa10bb7727e1f5a70a0a488776360ee8729a7d77a4047aa4ce4d69294f492
BLAKE2b-256 checksum
How to use checksums
6bee8b58396db928bf7e3afddd1d0025eced9a40e6c9e4d00ae53cd3dd0f85ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.1 CPython/3.11.3

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page