Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brooke-ec/environ-import
A python package that allows you to import environment variables like any other module.
https://github.com/brooke-ec/environ-import
environment-variables python
Last synced: 11 days ago
JSON representation
A python package that allows you to import environment variables like any other module.
- Host: GitHub
- URL: https://github.com/brooke-ec/environ-import
- Owner: brooke-ec
- License: mit
- Created: 2023-08-29T20:49:36.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-12T19:24:43.000Z (7 months ago)
- Last Synced: 2024-10-17T15:34:53.406Z (28 days ago)
- Topics: environment-variables, python
- Language: Python
- Homepage: https://pypi.org/project/environ-import/
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Environ Import
Environ Import is a python package that allows you to import environment variables from its `environ` and `envnull` modules which are dynamically typed from `.env` files.
## Quickstart
Install using pip
```
pip install environ-import
```Once installed, you can import environment variables from the `environ` module.
```py
from environ import PATH
print(PATH)# or
import environ
print(environ.PATH)
```Environ Import automatically loads `.env` files using [python-dotenv](https://github.com/theskumar/python-dotenv).
Import from the `envnull` module to avoid raising `AttributeError` when importing an undefined environment variable.
## Dynamic Typing
The [stub file](https://peps.python.org/pep-0484/#stub-files) generator is automatically run when the `environ` or `envnull` modules are imported. Types are generated based on the variables found in `.env` and `.env.example` files.
If you would like type hints to be availabe as soon a change has been made to a `.env` file, Environ Import provides a watchdog to automatically regenerate stub files when a change is detected.
```
python -m environ-import
```