Skip to main content

devpi-timemachine helps you manage your Python dependencies from a point in time in the past of your choosing

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

devpi_timemachine-0.0.1.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

devpi_timemachine-0.0.1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file devpi_timemachine-0.0.1.tar.gz.

File metadata

  • Download URL: devpi_timemachine-0.0.1.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for devpi_timemachine-0.0.1.tar.gz
Algorithm Hash digest
SHA256 98a72a8226039801589562ff21cd2ee1380c27e9fd1337b1f03809caeaad850e
MD5 7e998555257858ae226f7e2634454c2c
BLAKE2b-256 857cf1884a8f8a1780218e4d8f29ba0aef1d13efecc42f16f9d3c299aca702f2

See more details on using hashes here.

File details

Details for the file devpi_timemachine-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for devpi_timemachine-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 683aa10bb7727e1f5a70a0a488776360ee8729a7d77a4047aa4ce4d69294f492
MD5 c94a11dc21e530ab6b3e00bb7f5fd68a
BLAKE2b-256 6bee8b58396db928bf7e3afddd1d0025eced9a40e6c9e4d00ae53cd3dd0f85ed

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page