https://github.com/drish/envvar
https://github.com/drish/envvar
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/drish/envvar
- Owner: drish
- License: mit
- Created: 2022-12-02T02:16:58.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-10T23:29:35.000Z (about 3 years ago)
- Last Synced: 2025-02-20T07:49:13.826Z (over 1 year ago)
- Language: Python
- Size: 15.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# py-envvar
The easiest way to handle env vars.
This is an opnionated utility package for handling environment variables, it handles defaults and required env vars all in one simple config file.
[](https://github.com/psf/black)


[](https://codecov.io/gh/drish/envvar)
---
# Example config yaml
```yaml
required:
- DB_NAME
- HOST
defaults:
TOKEN: "_token_"
HOST: "0.0.0.0"
PORT: 3000
local:
DB_NAME: pg://local
test:
DB_NAME: pg://test
```
# Installation
`pip install py-envvar==0.0.1`
# Usage
```python
import os
from envvar import load # import envvar instead of py-envvar
load("./config.yaml", "local") # raises when a required env var is not set
```