No project description provided
Project description
runenv
Manage application settings with ease using runenv, a lightweight tool inspired by The Twelve-Factor App methodology for configuration through environment variables.
runenv provides:
- A CLI for language-agnostic
.envprofile execution - A Python API for programmatic
.envloading
“Store config in the environment” — 12factor.net/config
| Section | Status |
|---|---|
| CI/CD | |
| PyPI | |
| Python | |
| Style | |
| License | |
| Docs | CHANGELOG.md |
Table of Contents
Key Features
- 🚀 CLI-First: Use
.envfiles across any language or platform. - 🐍 Python-native API: Load and transform environment settings inside Python.
- ⚙️ Multiple Profiles: Switch easily between
.env.dev,.env.prod, etc. - 🧩 Framework-Friendly: Works well with Django, Flask, FastAPI, and more.
Quick Start
Installation
pip install runenv
CLI Usage
Run any command with a specified environment:
runenv .env.dev python manage.py runserver
runenv .env.prod uvicorn app:app --host 0.0.0.0
View options:
runenv --help
Key CLI features:
--prefix,--strip-prefix: Use selective environments--dry-run: Inspect loaded environment-v: Verbosity control
Python API
Load .env into os.environ
Note: The
load_envwill not parse env_file if therunenvCLI was used, unless youforce=Trueit.
from runenv import load_env
load_env() # loads .env
load_env(
env_file=".env.dev", # file to load
prefix='APP_', # load only APP_.* variables from file
strip_prefix=True, # strip ^ prefix when loading variables
force=True, # load env_file even if the `runvenv` CLI was used
search_parent=1 # look for env_file in current dir and its parent dir
)
Read .env as a dictionary
from runenv import create_env
config = create_env() # parse .env content into dictionary
config = create_env(
env_file=".env.dev", # file to load
prefix='APP_', # parse only APP_.* variables from file
strip_prefix=True, # strip ^ prefix when parsing variables
)
print(config)
Options include:
- Filtering by prefix
- Automatic prefix stripping
- Searching parent directories
Multiple Profiles
Use separate .env files per environment:
runenv .env.dev flask run
runenv .env.staging python main.py
runenv .env.production uvicorn app.main:app
Recommended structure:
.env.dev
.env.test
.env.staging
.env.production
Framework Integrations
Note: If you're using
runenv .env [./manage.py, ...]CLI then you do not need change your code. Use these integrations only if you're using Python API.
Django
# manage.py or wsgi.py
from runenv import load_env
load_env(".env")
Flask
from flask import Flask
from runenv import load_env
load_env(".env")
app = Flask(__name__)
FastAPI
from fastapi import FastAPI
from runenv import load_env
load_env(".env")
app = FastAPI()
Sample .env File
# Basic
DEBUG=1
PORT=8000
# Nested variable
HOST=localhost
URL=http://${HOST}:${PORT}
# Quotes and comments
EMAIL="admin@example.com" # Inline comment
SECRET='s3cr3t'
Similar Tools
- python-dotenv – Python-focused, lacks CLI tool
- envdir – Directory-based env manager
- dotenv-linter – Linter for
.envfiles
With runenv, you get portable, scalable, and explicit configuration management that aligns with modern deployment standards. Ideal for CLI usage, Python projects, and multi-environment pipelines.
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 runenv-1.2.5.tar.gz.
File metadata
- Download URL: runenv-1.2.5.tar.gz
- Upload date:
- Size: 20.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
096542893a97214aeb385d44c104cdf063c78b424998ae8258388bc351e8e2c5
|
|
| MD5 |
556d0c369ae9e6b62f26e9e4f68c5c16
|
|
| BLAKE2b-256 |
f057cee54d54267392ff5b0ee94cc3b72e9aab622ac03274e7be7e402d2dae5b
|
File details
Details for the file runenv-1.2.5-py3-none-any.whl.
File metadata
- Download URL: runenv-1.2.5-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0839343287b03a787906c9efee8bd4c11b8a8310d366744d25406c99b6407948
|
|
| MD5 |
e7e68b12dbc756333b90ac94766a8bb1
|
|
| BLAKE2b-256 |
38f1a77f43744f3293adbdbb82fc853117e1e5bd7999a64428db7fec504da5bf
|