Skip to main content

Automatically add bin-dir to PATH for every process in your virtualenv.

Project description

Testing Linting Read the Docs Codecov PyPi Package MIT License

https://app.codecov.io/gh/libranet/autoadd-bindir

Autoadd-bindir

Automatically add the bin-directory of your virtualenv to the PATH-environment variable via sitecustomize-entrypoint. You now no longer need to manually activate your virtual environment for the sole purpose of adding thie bin-drectory to your $PATH.

How does it work?

We register the autoadd_bin.entrypoint()-function to the sitecustomize-module that is installed by the sitecustomize-entrypoints-package.

The registered function will look up sys.prefix of your python-executable and add the corresponding bin-directory to the PATH.

Installation

Install via pip:

> bin/pip install autoadd-bindir

Or add to your poetry-based project:

> poetry add autoadd-bindir

Validate & Usage

After installing this package there is nothing left to do explicitly. We can validate that the plugin work correctly by starting a python-session and checking the PATH-environment-variable:

> bin/python
>>> import os
>>> print(os.getenv("PATH"))
    "<path-to-your-virtualenv>/bin", ...

Registered sitecustomize-entrypoint

The autoadd_bindir-function is registered as a sitecustomize-entrypoint in our pyproject.toml_:

    [tool.poetry.plugins]
    [tool.poetry.plugins."sitecustomize"]
    autoadd_bindir = "autoadd_bindir:entrypoint"

Sitecustomize and all its registered entrypoints will be executed at the start of every python-process. For more information, please see sitecustomize-entrypoints

Compatibility

Python Version PyPI - Implementation

autoadd-bindir works on Python 3.8+, including PyPy3. Tested until Python 3.11,

Notable dependencies

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

autoadd_bindir-1.0.6.tar.gz (5.1 kB view hashes)

Uploaded Source

Built Distribution

autoadd_bindir-1.0.6-py3-none-any.whl (3.7 kB view hashes)

Uploaded Python 3

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