Skip to main content

OneEnv 🌟

PyPI Downloads

Python environment variable management made simple.

OneEnv automatically discovers environment variable templates from your installed packages and manages them with namespaces.

Core Features 🎯

1. 🏗️ Intelligent Scaffolding System

Organize environment templates by categories (Database, VectorStore, LLM, etc.) with structured discovery and selective generation.

2. 📦 Package Environment Variable Discovery

Automatically collect environment variable templates from all installed packages - no manual configuration required.

3. 🏷️ Namespace Management

Organize environment variables by service/component with intelligent fallback.

4. 🛠️ Tool-Friendly APIs

Programmatic access to template structure for building custom scaffolding tools and integrations.

Installation 📦

pip install oneenv

Quick Start 🚀

Generate Environment Template

oneenv template

Explore Available Templates

# View all available categories and options
oneenv template --structure

# Get detailed info for a specific category
oneenv template --info Database

# Preview a specific option
oneenv template --preview Database postgres

# Generate custom configuration
oneenv template --generate Database:postgres VectorStore:chroma

Use Named Environments

import oneenv

# Load different environments
oneenv.env().load_dotenv("common.env")
oneenv.env("database").load_dotenv("database.env")
oneenv.env("web").load_dotenv("web.env")

# Get values with namespace fallback
db_host = oneenv.env("database").get("HOST", "localhost")
web_port = oneenv.env("web").get("PORT", "8000")
timeout = oneenv.env("database").get("TIMEOUT", "30")  # Falls back to common

Example: Before vs After

Before OneEnv:

# Scattered environment variables
DATABASE_URL = os.getenv("DATABASE_URL")
WEB_HOST = os.getenv("WEB_HOST")
API_KEY = os.getenv("API_KEY")

After OneEnv:

# Organized by namespace
db_url = oneenv.env("database").get("URL")
web_host = oneenv.env("web").get("HOST")
api_key = oneenv.env("api").get("KEY")

How It Works

  1. Discovery: OneEnv finds environment variable templates from installed packages
  2. Generation: Creates consolidated .env.example files
  3. Namespace: Loads variables into separate namespaces with fallback to common settings

Advanced Usage: Scaffolding System 🏗️

OneEnv's intelligent scaffolding system organizes templates by categories and provides powerful APIs for custom tool development:

Interactive Template Discovery

# Discover available templates
oneenv template --structure

# Get category details with variable counts
oneenv template --info Database

# Preview what variables an option provides
oneenv template --preview Database postgres

# Generate templates with specific selections
oneenv template --generate Database:postgres VectorStore:chroma LLM:openai

# JSON output for automation
oneenv template --structure --json

Programmatic API for Custom Tools 🛠️

Build sophisticated scaffolding tools using OneEnv's comprehensive APIs:

import oneenv

# Discovery API
structure = oneenv.get_all_template_structure()
print("Available categories:", list(structure.keys()))
# Output: {'Database': ['postgres', 'sqlite'], 'VectorStore': ['chroma', 'pinecone']}

# Validation API
if oneenv.has_category("Database"):
    options = oneenv.get_options("Database")
    print(f"Database options: {options}")

# Information API
info = oneenv.get_category_info("Database")
print(f"Total variables: {info['total_variables']}")
print(f"Critical variables: {info['critical_variables']}")

# Preview API
preview = oneenv.get_option_preview("Database", "postgres")
for var_name, config in preview['variables'].items():
    print(f"{var_name}: {config['importance']} - {config['description']}")

# Generation API
selections = [
    {"category": "Database", "option": "postgres"},
    {"category": "VectorStore", "option": "chroma"},
    {"category": "LLM", "option": "openai"}
]

content = oneenv.generate_template(".env.example", selections)
print("Generated custom template with selected components!")

Create Package Templates 📦

Developers can create discoverable templates using the new scaffolding format:

# mypackage/templates.py
def database_template():
    return [
        {
            "category": "Database",
            "option": "postgres",
            "env": {
                "DATABASE_URL": {
                    "description": "PostgreSQL connection URL",
                    "default": "postgresql://user:pass@localhost:5432/dbname",
                    "required": True,
                    "importance": "critical"
                },
                "DATABASE_POOL_SIZE": {
                    "description": "Connection pool size",
                    "default": "10",
                    "required": False,
                    "importance": "important"
                }
            }
        },
        {
            "category": "Database",
            "option": "sqlite",
            "env": {
                "DATABASE_URL": {
                    "description": "SQLite database file path",
                    "default": "sqlite:///app.db",
                    "required": True,
                    "importance": "critical"
                }
            }
        }
    ]

Register in pyproject.toml:

[project.entry-points."oneenv.templates"]
database = "mypackage.templates:database_template"

Key Features:

  • Category-based organization - Group related templates (Database, VectorStore, LLM, etc.)
  • Multiple options per category - Provide alternatives (postgres, sqlite, mysql)
  • Importance levels - Critical, Important, Optional for better user guidance
  • Automatic discovery - Users automatically see your templates with oneenv template --structure

Learn More 📚

Step-by-Step Tutorials

🌱 Basics (5-10 min each)

  1. Basic dotenv Usage - Learn environment variable fundamentals and OneEnv basics
  2. Auto Template Generation - Discover how OneEnv automatically finds and generates environment templates
  3. Named Environments - Master namespace management with intelligent fallback

🚀 Practical (10-15 min each)

  1. Multi-Service Management - Configure complex applications with multiple services
  2. Custom Templates - Create reusable project-specific templates
  3. Production Best Practices - Secure configuration management for production environments

Advanced (15-20 min each)

  1. Plugin Development - Build distributable OneEnv plugins for the community
  2. CI/CD Integration - Automate configuration management in your deployment pipeline

🚀 New Scaffolding Features (10-20 min each)

  1. New Template Creation - Create discoverable templates using the new scaffolding format
  2. Scaffolding Tool Creation - Build custom scaffolding tools with OneEnv's APIs
  3. Practical Guide - Real-world examples for RAG systems, web apps, and more

📚 Documentation

Start here: Step 1: Basic dotenv Usage

License ⚖️

MIT License

Release files for oneenv 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oneenv 0.4.0
File Size Uploaded
oneenv-0.4.0.tar.gz 41.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for oneenv 0.4.0
File Interpreter ABI Platform
oneenv-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 68.9 kB

Release files / oneenv-0.4.0.tar.gz

Download URL oneenv-0.4.0.tar.gz
Size 41.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b67c27a34864560bf029ef6c78801dc8c5c8bf75df683c49f0691fc610b8c6c9
BLAKE2b-256 checksum
How to use checksums
11b51dbe3c6d65c82a1f4aea53e81987ba334cd9823f8689a432386f5e96ff5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.12

Release files / oneenv-0.4.0-py3-none-any.whl

Download URL oneenv-0.4.0-py3-none-any.whl
Size 27.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5feae4ff63ecadeb55793e5d20b4df83eaf25b795980be54183635adb8d2369d
BLAKE2b-256 checksum
How to use checksums
02391ba6e25ea3dcff2c9f20b1e51e9729f3591c279ef0b1ec22a005a297899d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.12

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page