Skip to main content

script to clone virtualenvs.

Project description

virtualenv cloning script.

Build Status

A script for cloning a non-relocatable virtualenv.

Virtualenv provides a way to make virtualenv's relocatable which could then be copied as we wanted. However making a virtualenv relocatable this way breaks the no-site-packages isolation of the virtualenv as well as other aspects that come with relative paths and /usr/bin/env shebangs that may be undesirable.

Also, the .pth and .egg-link rewriting doesn't seem to work as intended. This attempts to overcome these issues and provide a way to easily clone an existing virtualenv.

It performs the following:

  • copies sys.argv[1] dir to sys.argv[2]

  • updates the hardcoded VIRTUAL_ENV variable in the activate script to the new repo location. (--relocatable doesn't touch this)

  • updates the shebangs of the various scripts in bin to the new Python if they pointed to the old Python. (version numbering is retained.)

    it can also change /usr/bin/env python shebangs to be absolute too, though this functionality is not exposed at present.

  • checks sys.path of the cloned virtualenv and if any of the paths are from the old environment it finds any .pth or .egg link files within sys.path located in the new environment and makes sure any absolute paths to the old environment are updated to the new environment.

  • finally it double checks sys.path again and will fail if there are still paths from the old environment present.

NOTE: This script requires Python 2.7 or 3.4+

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

virtualenv-clone-0.5.5.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

virtualenv_clone-0.5.5-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file virtualenv-clone-0.5.5.tar.gz.

File metadata

  • Download URL: virtualenv-clone-0.5.5.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.10

File hashes

Hashes for virtualenv-clone-0.5.5.tar.gz
Algorithm Hash digest
SHA256 fa23525c4fcc7ff91248beeee53317dd6ac5e74c0e5c66c1807c1b0b7d948ab6
MD5 907c91864e0d9317daa73555916ebf63
BLAKE2b-256 d9f82bdcdd527819d9efdb40f650cb52a521403f8f6aaaac9792cab81584d33d

See more details on using hashes here.

File details

Details for the file virtualenv_clone-0.5.5-py3-none-any.whl.

File metadata

  • Download URL: virtualenv_clone-0.5.5-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.10

File hashes

Hashes for virtualenv_clone-0.5.5-py3-none-any.whl
Algorithm Hash digest
SHA256 29c6fe43bc6d40f836f47e9a40bf6fbe9527aac11e92c76ace195580d22588bb
MD5 a45777c19d51fe40a06e55f067e937bc
BLAKE2b-256 94d4be2a756db2fb2ed9b88480a5b0e0183337960d8d64a1215575bc0d0fc9ab

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