https://github.com/libranet/autoread-dotenv
Autoread the .env-file for in-project virtualenvs
https://github.com/libranet/autoread-dotenv
dotenv sitecustomize
Last synced: 5 months ago
JSON representation
Autoread the .env-file for in-project virtualenvs
- Host: GitHub
- URL: https://github.com/libranet/autoread-dotenv
- Owner: libranet
- License: mit
- Created: 2023-03-03T22:20:11.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2026-01-14T11:58:27.000Z (5 months ago)
- Last Synced: 2026-01-14T15:53:10.595Z (5 months ago)
- Topics: dotenv, sitecustomize
- Language: Python
- Homepage: https://autoread-dotenv.readthedocs.io
- Size: 2.15 MB
- Stars: 4
- Watchers: 0
- Forks: 0
- Open Issues: 7
-
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/autoread-dotenv/actions/workflows/testing.yaml)
[](https://github.com/libranet/autoread-dotenv/actions/workflows/linting.yaml)
[](https://autoread-dotenv.readthedocs.io/en/latest/)
[](https://codecov.io/gh/libranet/autoread-dotenv)
[](https://pypi.org/project/autoread-dotenv/)
[](https://github.com/libranet/autoread-dotenv/blob/main/docs/license.md)
## Installation
Install via uv:
```bash
> uv add autoread-dotenv
```
Or add to your poetry-based project:
```bash
> poetry add autoread-dotenv
```
Install via pip:
```bash
> bin/pip install autoread-dotenv
```
## Set up a local development environment
```bash
> just install
```
## Usage
The only thing left to do for you is the create a ``.env`` in the root of your project.
## Registered sitecustomize-entrypoint
The ``autoread_dotenv.entrypoint``-function is registered as a ``sitecustomize``-entrypoint in our pyproject.toml_:
``` toml
[project.entry-points.sitecustomize]
autoread_dotenv = "autoread_dotenv: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)
## Avoid overriding existing environments variables
By default, your .env-file read by ``autoread-dotenv`` will override any pre-existing environment variables.
You can avoid this behaviour by setting ``AUTOREAD_ENFORCE_DOTENV=0``.
## Compatibility
[](https://pypi.org/project/autoread-dotenv/)
[](https://pypi.org/project/autoread-dotenv/)
``autoread-dotenv`` works on Python 3.8+, including PyPy3. Tested until Python 3.13,
## Notable dependencies
- [sitecustomize-entrypoints](http://pypi.python.org/pypi/sitecustomize-entrypoints)
- [python-dotenv](http://pypi.python.org/pypi/python-dotenv)