https://github.com/libranet/autoadd-bindir
Automatically add the bin-dir of your virtualenv to $PATH.
https://github.com/libranet/autoadd-bindir
activate environment-variables path sitecustomize
Last synced: 4 months ago
JSON representation
Automatically add the bin-dir of your virtualenv to $PATH.
- Host: GitHub
- URL: https://github.com/libranet/autoadd-bindir
- Owner: libranet
- License: mit
- Created: 2023-03-15T14:21:27.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-11-22T11:59:33.000Z (6 months ago)
- Last Synced: 2025-11-22T13:20:24.753Z (6 months ago)
- Topics: activate, environment-variables, path, sitecustomize
- Language: Makefile
- Homepage: https://autoadd-bindir.readthedocs.io/en/latest
- Size: 572 KB
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: docs/readme.md
- Contributing: docs/contributing.md
- Funding: .github/funding.yaml
- License: license.md
- Code of conduct: docs/code-of-conduct.md
- Codeowners: .github/CODEOWNERS
- Security: docs/security.md
Awesome Lists containing this project
README
[](https://github.com/libranet/autoadd-bindir/actions/workflows/testing.yaml)
[](https://github.com/libranet/autoadd-bindir/actions/workflows/linting.yaml)
[](https://autoadd-bindir.readthedocs.io/en/latest/)
[](https://codecov.io/gh/libranet/autoadd-bindir)
[](https://pypi.org/project/autoadd-bindir/)
[](https://github.com/libranet/autoadd-bindir/blob/main/docs/license.md)
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](http://pypi.python.org/pypi/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:
```bash
> bin/pip install autoadd-bindir
```
Or add to your poetry-based project:
```bash
> 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:
```bash
> bin/python
```
```python
>>> import os
>>> print(os.getenv("PATH"))
"/bin", ...
```
## Registered sitecustomize-entrypoint
The ``autoadd_bindir``-function is registered as a ``sitecustomize``-entrypoint in our pyproject.toml_:
``` 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](http://pypi.python.org/pypi/sitecustomize-entrypoints)
## Compatibility
[](https://pypi.org/project/autoadd-bindir/)
[](https://pypi.org/project/autoadd-bindir/)
``autoadd-bindir`` works on Python 3.8+, including PyPy3. Tested until Python 3.11,
## Notable dependencies
- [sitecustomize-entrypoints](http://pypi.python.org/pypi/sitecustomize-entrypoints)