Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EasyWorkEnv

The simplest way to manage environment variables in Python.

PyPI version Python License: GPL v3

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 .yaml out of the box
  • Dot notation accessconfig.DATABASE.HOST instead of config["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:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/my-feature)
  3. Commit your changes (git commit -m "Add my feature")
  4. Push to the branch (git push origin feature/my-feature)
  5. 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

About

Charge vos fichiers .env, JSON ou YAML de variables d'environnement en objets Python typés et facilement utilisables. Disponible sur PyPI.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages