anchorer


Nameanchorer JSON
Version 0.4.0 PyPI version JSON
download
home_page
SummaryAvoid breakages that would occur from updating symlinks to running virtualenvs
upload_time2022-12-05 10:55:38
maintainer
docs_urlNone
author
requires_python>3.3
license
keywords virtualenv virtualenvwrapper symlink resolve deployment
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Anchorer
Plugin for [`virtualenvwrapper`](https://pypi.org/project/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
```shell
# 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](https://docs.python.org/3/library/site.html) for more information on the mechanism

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "anchorer",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">3.3",
    "maintainer_email": "",
    "keywords": "virtualenv,virtualenvwrapper,symlink,resolve,deployment",
    "author": "",
    "author_email": "Oliver Bristow <oliver+github@oliverbristow.co.uk>",
    "download_url": "https://files.pythonhosted.org/packages/e7/5f/b1bb22a524116bb151bf5f9bc7f5cc2afc4434394c4f6c73f180c65469c4/anchorer-0.4.0.tar.gz",
    "platform": null,
    "description": "# Anchorer\nPlugin for [`virtualenvwrapper`](https://pypi.org/project/virtualenvwrapper/) that extends `mkvirtualenv` behaviour to\nadd code that is loaded by the python interpreter for every run. The loaded code resolves symlinks in discovered\nsite-package directories, allowing symlinks to virtualenvs to be updated while scripts/services are running.\n\n## Example problem anchorer solves\n```shell\n# assuming you have the virtualenvwrapper python package installed, and have sourced virtualenvwrapper.sh\nmkvirtualenv env-v1\nmkvirtualenv env-v2\n\n# create a pseudo-virtualenv which is a symlink to a particular version\nln -s \"$WORKON_HOME/env-v1\" \"$WORKON_HOME/active-env\"\n\n# now use the linked environment to start something in env-v1\nworkon active-env\n\n# start some imaginary python service which may import modules a long time after starting\npython -m my_long_runner &\n\n# update the active symlink, switching what version\nln -sT \"$WORKON_HOME/env-v2\" \"$WORKON_HOME/active-env\"\n\n# imagine at this point that my_long_runner tries to import a module, it will be using un-resolved paths which will mean\n# the modules will be loaded from an environment that is not the one it started in\n```\n\n## Architecture\n 1. `virtualenvwrapper.anchorer.fix.main()` resolves paths that are used at runtime\n    * current working directory\n    * paths used for determining where packages are found\n 2. `virtualenvwrapper` runs `virtualenvwrapper.anchorer.plugin.pre_mkvirtualenv(...)` during calls to `mkvirtualenv` to\n    modify the virtualenv's site-packages directory:\n    1. `__anchorer.py` is added, it is a copy of the fix module\n    2. `__anchorer.pth` is added, it simply imports `__anchorer` which causes the main method to run. See\n    [site docs](https://docs.python.org/3/library/site.html) for more information on the mechanism\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Avoid breakages that would occur from updating symlinks to running virtualenvs",
    "version": "0.4.0",
    "split_keywords": [
        "virtualenv",
        "virtualenvwrapper",
        "symlink",
        "resolve",
        "deployment"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "89ab512d1e803b1b37d63b21fa187eb5",
                "sha256": "c15970ec6c2a2b87a543e06bbe23ead924c4622f53f4bb256f8461582fd33e52"
            },
            "downloads": -1,
            "filename": "anchorer-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "89ab512d1e803b1b37d63b21fa187eb5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">3.3",
            "size": 4835,
            "upload_time": "2022-12-05T10:55:37",
            "upload_time_iso_8601": "2022-12-05T10:55:37.521086Z",
            "url": "https://files.pythonhosted.org/packages/f4/a3/832a005152ccbb06d1cda22c8561806a9da5985d8a463feea77132d2bd10/anchorer-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "cb69699eac0d47c7edc325309fcd9c85",
                "sha256": "f2af82e8628fe8e796e2d1a42bb3ecb8bc8d4741aa0777169f0af25d52045d56"
            },
            "downloads": -1,
            "filename": "anchorer-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "cb69699eac0d47c7edc325309fcd9c85",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">3.3",
            "size": 5456,
            "upload_time": "2022-12-05T10:55:38",
            "upload_time_iso_8601": "2022-12-05T10:55:38.560047Z",
            "url": "https://files.pythonhosted.org/packages/e7/5f/b1bb22a524116bb151bf5f9bc7f5cc2afc4434394c4f6c73f180c65469c4/anchorer-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-05 10:55:38",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "anchorer"
}
        
Elapsed time: 0.27206s