Skip to main content

Anchorer

Plugin for virtualenvwrapper that extends mkvirtualenv behaviour to add code that is loaded by the python interpreter for every run. The loaded code resolves symlinks in discovered site-package directories, allowing symlinks to virtualenvs to be updated while scripts/services are running.

Example problem anchorer solves

# assuming you have the virtualenvwrapper python package installed, and have sourced virtualenvwrapper.sh
mkvirtualenv env-v1
mkvirtualenv env-v2

# create a pseudo-virtualenv which is a symlink to a particular version
ln -s "$WORKON_HOME/env-v1" "$WORKON_HOME/active-env"

# now use the linked environment to start something in env-v1
workon active-env

# start some imaginary python service which may import modules a long time after starting
python -m my_long_runner &

# update the active symlink, switching what version
ln -sT "$WORKON_HOME/env-v2" "$WORKON_HOME/active-env"

# imagine at this point that my_long_runner tries to import a module, it will be using un-resolved paths which will mean
# the modules will be loaded from an environment that is not the one it started in

Architecture

  1. virtualenvwrapper.anchorer.fix.main() resolves paths that are used at runtime
    • current working directory
    • paths used for determining where packages are found
  2. virtualenvwrapper runs virtualenvwrapper.anchorer.plugin.pre_mkvirtualenv(...) during calls to mkvirtualenv to modify the virtualenv's site-packages directory:
    1. __anchorer.py is added, it is a copy of the fix module
    2. __anchorer.pth is added, it simply imports __anchorer which causes the main method to run. See site docs for more information on the mechanism

Metadata

Release files for anchorer 0.4.0

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

Source distribution (sdist)

Source distribution for anchorer 0.4.0
File Size Uploaded Provenance
anchorer-0.4.0.tar.gz 5.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for anchorer 0.4.0
File Interpreter ABI Platform
anchorer-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.3 kB

Release files / anchorer-0.4.0.tar.gz

Download URL anchorer-0.4.0.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f2af82e8628fe8e796e2d1a42bb3ecb8bc8d4741aa0777169f0af25d52045d56
BLAKE2b-256 checksum
How to use checksums
e75fb1bb22a524116bb151bf5f9bc7f5cc2afc4434394c4f6c73f180c65469c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.15

Release files / anchorer-0.4.0-py3-none-any.whl

Download URL anchorer-0.4.0-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c15970ec6c2a2b87a543e06bbe23ead924c4622f53f4bb256f8461582fd33e52
BLAKE2b-256 checksum
How to use checksums
f4a3832a005152ccbb06d1cda22c8561806a9da5985d8a463feea77132d2bd10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.15

Security for anchorer 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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