This is a package that simplifies environment variable management.
Project description
EasyWorkEnv
The simplest way to manage environment variables in Python.
Load .env, .json, and .yaml config files in one line of code.
Access your variables with clean dot notation — no more os.getenv() boilerplate.
Why EasyWorkEnv?
Managing environment variables in Python shouldn't be painful. Most solutions either force you into a single file format, require verbose syntax, or lack support for nested configurations.
EasyWorkEnv solves this by providing:
- Multi-format support —
.env,.json, and.yamlout of the box - Dot notation access —
config.DATABASE.HOSTinstead ofconfig["DATABASE"]["HOST"] - Nested configuration — structure your settings with unlimited depth
- Zero config — just point to your file, it works
- Lightweight — only one dependency (
PyYAML) - Python 3.8+ compatible
Installation
pip install easyworkenv
Quick Start
from EasyWorkEnv import Config
config = Config(".env")
# Access your variables directly as attributes
print(config.API_KEY)
print(config.DATABASE_URL)
That's it. One import, one line of setup.
Usage Examples
.env file
# .env
APP_NAME=MyApp
SECRET_KEY=super-secret-value
DEBUG=true
DATABASE_URL=postgresql://localhost:5432/mydb
from EasyWorkEnv import Config
config = Config(".env")
print(config.APP_NAME) # "MyApp"
print(config.SECRET_KEY) # "super-secret-value"
print(config.DATABASE_URL) # "postgresql://localhost:5432/mydb"
.json file (with nested config)
{
"APP_NAME": "MyApp",
"DATABASE": {
"HOST": "localhost",
"PORT": 5432,
"NAME": "mydb"
},
"API_KEY": "sk-abc123"
}
from EasyWorkEnv import Config
config = Config("config.json")
print(config.APP_NAME) # "MyApp"
print(config.DATABASE.HOST) # "localhost"
print(config.DATABASE.PORT) # 5432
print(config.API_KEY) # "sk-abc123"
.yaml file (with nested config)
# config.yaml
APP_NAME: MyApp
DATABASE:
HOST: localhost
PORT: 5432
NAME: mydb
REDIS:
URL: redis://localhost:6379
from EasyWorkEnv import Config
config = Config("config.yaml")
print(config.APP_NAME) # "MyApp"
print(config.DATABASE.HOST) # "localhost"
print(config.REDIS.URL) # "redis://localhost:6379"
Supported File Formats
| Format | Extension | Nested Config | Comments |
|---|---|---|---|
| dotenv | .env |
No | Yes |
| JSON | .json |
Yes | No |
| YAML | .yaml |
Yes | Yes |
Contributing
Contributions are welcome! If you'd like to help improve EasyWorkEnv:
- Fork the repository
- Create a feature branch (
git checkout -b feature/my-feature) - Commit your changes (
git commit -m "Add my feature") - Push to the branch (
git push origin feature/my-feature) - Open a Pull Request
License
This project is licensed under the GNU General Public License v3.0 — see the LICENSE file for details.
Made by Hugo Galley
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file easyworkenv-0.3.6.tar.gz.
File metadata
- Download URL: easyworkenv-0.3.6.tar.gz
- Upload date:
- Size: 15.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64097abca8bad703db57522f97eb23b8acf08e74efe74fbb6b08d8d4b4fffcd1
|
|
| MD5 |
7ff4000824970c2f6b5be466910a70e6
|
|
| BLAKE2b-256 |
59a1899a794c2c99441f1ad28dc4a9572a32c0d2d9ec3b0a9f08832fbd57048c
|
File details
Details for the file easyworkenv-0.3.6-py3-none-any.whl.
File metadata
- Download URL: easyworkenv-0.3.6-py3-none-any.whl
- Upload date:
- Size: 16.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f88064d74098c34c787347cd3404192cf155f3bdf9cccf2429d0d3a38ef9b5b
|
|
| MD5 |
6d5cdd7ac16072e3d35319acb6503ff2
|
|
| BLAKE2b-256 |
569538437bb64df2125debc8e35c63eab1b3d06ab40194715aec482ef7a2a02b
|