Name | envsmith JSON |
Version |
0.1.0
JSON |
| download |
home_page | None |
Summary | Modern, schema-first environment variable loader and manager for Python. |
upload_time | 2025-08-19 21:03:29 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | MIT License
Copyright (c) 2025 [Your Name]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
|
keywords |
environment
dotenv
validation
schema
fastapi
django
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# envsmith
[](https://badge.fury.io/py/envsmith)
[](https://github.com/PeymanSohi/envsmith/actions/workflows/publish.yml)
A modern, production-ready solution for loading, validating, and managing environment variables in Python using a schema-first approach.
## ๐ How It Works
`envsmith` is a Python package that provides a robust way to manage environment variables with the following workflow:
1. **Schema Definition**: You define a YAML or JSON schema that specifies:
- Which environment variables are required
- What data types they should have
- Default values for optional variables
- Validation rules
2. **Environment Loading**: The package loads variables from multiple sources:
- `.env` files
- System environment variables
- Custom dictionaries
- Priority: System > .env file > defaults
3. **Validation & Type Casting**: Each variable is validated against the schema:
- Required variables are checked for presence
- Values are cast to the specified types (str, int, float, bool)
- Helpful error messages for missing/invalid variables
4. **Integration**: Seamlessly integrates with FastAPI and Django applications
## ๐ง Technical Architecture
### **Core Processing Pipeline**
```python
class EnvSmith(dict):
def __init__(self, schema_path, env_file=".env", env=None):
# Step 1: Load .env file into environment
load_dotenv(env_file)
# Step 2: Parse schema file (YAML/JSON)
self.schema = load_schema(schema_path)
# Step 3: Get environment (system + .env merged)
self.env = env or dict(os.environ)
# Step 4: Validate and cast types
validated = validate_env(self.env, self.schema)
# Step 5: Update the dictionary
self.update(validated)
```
### **Data Flow & Priority System**
1. **Schema Loading**: YAML/JSON โ Python dict with validation rules
2. **Environment Merging**: System env + .env files + custom dicts
3. **Priority Chain**: System > .env > Schema defaults
4. **Type Casting**: Automatic conversion (str, int, float, bool)
5. **Validation**: Required checks + type validation + error collection
### **Key Components**
- **`core.py`**: Main engine that orchestrates the entire process
- **`schema_loader.py`**: Parses YAML/JSON schema files
- **`validation.py`**: Type casting and validation logic
- **`integrations/`**: Framework-specific adapters (FastAPI, Django)
- **`cli.py`**: Command-line interface for common operations
## ๐ Comparison with Other Tools
| Feature | envsmith | python-dotenv | pydantic-settings | dynaconf | python-decouple |
|---------|----------|---------------|-------------------|----------|-----------------|
| **Schema Validation** | โ
YAML/JSON | โ None | โ
Pydantic models | โ
TOML/YAML | โ None |
| **Type Casting** | โ
Automatic | โ Strings only | โ
Pydantic types | โ
Basic | โ Strings only |
| **Framework Integration** | โ
FastAPI/Django | โ None | โ
Pydantic ecosystem | โ
Multiple | โ None |
| **CLI Tools** | โ
Built-in | โ None | โ None | โ
Rich CLI | โ None |
| **Priority System** | โ
System > .env > defaults | โ .env only | โ
Environment > .env | โ
Multiple sources | โ
.env > env |
| **Error Handling** | โ
Comprehensive | โ Basic | โ
Pydantic errors | โ
Good | โ Basic |
| **Production Ready** | โ
Logging, testing | โ ๏ธ Basic | โ
Enterprise | โ
Enterprise | โ ๏ธ Basic |
### **Why Choose envsmith?**
#### **vs python-dotenv**
- **python-dotenv**: Only loads `.env` files, no validation, no type casting
- **envsmith**: Full validation, type safety, multiple sources, framework integration
#### **vs pydantic-settings**
- **pydantic-settings**: Requires Pydantic knowledge, more complex setup
- **envsmith**: Simple YAML/JSON schemas, easier to understand and maintain
#### **vs dynaconf**
- **dynaconf**: More complex, multiple config formats, overkill for simple apps
- **envsmith**: Focused on environment variables, simple and lightweight
#### **vs python-decouple**
- **python-decouple**: Basic .env loading, no validation, no type safety
- **envsmith**: Full validation suite, type casting, production features
### **Performance Characteristics**
- **Startup Time**: Fast - single pass validation
- **Memory Usage**: Minimal - only stores validated variables
- **Runtime Overhead**: Zero - all processing happens at initialization
- **Error Reporting**: Comprehensive - all issues reported at once
### **Use Cases Where envsmith Excels**
โ
**Web Applications**: FastAPI, Django, Flask
โ
**Microservices**: Environment-based configuration
โ
**Docker Containers**: Environment variable validation
โ
**CI/CD Pipelines**: Configuration validation
โ
**Team Development**: Clear schema documentation
โ
**Production Deployments**: Early error detection
## โจ Features
- **Schema-First**: Define your environment structure in YAML/JSON
- **Multiple Sources**: Load from `.env`, system, or custom dicts
- **Type Safety**: Automatic type casting and validation
- **Framework Integration**: FastAPI and Django support
- **CLI Tools**: Command-line interface for common tasks
- **Secrets Management**: Mock interface for external secret providers
- **Production Ready**: Logging, error handling, and comprehensive testing
## ๐ฆ Installation
```bash
pip install envsmith
```
With optional extras:
```bash
pip install envsmith[fastapi,django]
```
## ๐ฏ Quick Start
### 1. Create a Schema
Create a `schema.yaml` file:
```yaml
DATABASE_URL:
type: str
required: true
description: "Database connection string"
SECRET_KEY:
type: str
required: true
description: "Application secret key"
DEBUG:
type: bool
default: false
description: "Debug mode"
PORT:
type: int
default: 8000
description: "Server port"
API_TIMEOUT:
type: float
default: 30.0
description: "API timeout in seconds"
```
### 2. Create Environment File
Create a `.env` file:
```bash
DATABASE_URL=postgresql://user:pass@localhost:5432/mydb
SECRET_KEY=your-super-secret-key-here
DEBUG=true
PORT=8080
API_TIMEOUT=45.0
```
### 3. Use in Python
```python
from envsmith import EnvSmith
# Load with schema validation
settings = EnvSmith(schema_path="schema.yaml", env_file=".env")
# Access validated variables
print(settings["DATABASE_URL"]) # postgresql://user:pass@localhost:5432/mydb
print(settings["DEBUG"]) # True (bool)
print(settings["PORT"]) # 8080 (int)
print(settings["API_TIMEOUT"]) # 45.0 (float)
# Get with default fallback
print(settings.get("NONEXISTENT", "default_value"))
```
## ๐ ๏ธ CLI Usage
### Initialize Project
Create `.env` and `schema.yaml` files:
```bash
python3 -m envsmith init
```
### Validate Environment
Check if your `.env` file matches the schema:
```bash
python3 -m envsmith validate
```
### Export Environment
Export validated variables in different formats:
```bash
# Export as JSON
python3 -m envsmith export --format json
# Export as YAML
python3 -m envsmith export --format yaml
```
## ๐ Framework Integrations
### FastAPI Integration
```python
from fastapi import FastAPI, Depends
from envsmith.integrations.fastapi import get_settings
app = FastAPI()
@app.get("/config")
def get_config(settings = Depends(get_settings)):
return {
"database_url": settings["DATABASE_URL"],
"debug": settings["DEBUG"],
"port": settings["PORT"]
}
@app.get("/health")
def health_check(settings = Depends(get_settings)):
return {
"status": "healthy",
"environment": settings.get("ENV", "development")
}
```
### Django Integration
In your `settings.py`:
```python
from envsmith.integrations.django import load_envsmith
# Load environment variables with schema validation
load_envsmith(schema_path="schema.yaml")
# Now you can use them directly
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': DATABASE_NAME,
'USER': DATABASE_USER,
'PASSWORD': DATABASE_PASSWORD,
'HOST': DATABASE_HOST,
'PORT': DATABASE_PORT,
}
}
SECRET_KEY = SECRET_KEY
DEBUG = DEBUG
ALLOWED_HOSTS = ALLOWED_HOSTS.split(',') if ALLOWED_HOSTS else []
```
## ๐ Secrets Management
For production environments, you can integrate with external secret providers:
```python
from envsmith.secrets import SecretProvider
# Mock interface (replace with actual AWS, Vault, etc.)
secrets = SecretProvider()
# Get secret from external provider
api_key = secrets.get_secret("API_KEY")
# Fallback to local secret
fallback_key = secrets.get_local_secret("API_KEY")
```
## ๐ Schema Reference
### Supported Types
- **str**: String values
- **int**: Integer values
- **float**: Floating-point values
- **bool**: Boolean values (accepts: true/false, yes/no, 1/0, on/off)
### Schema Structure
```yaml
VARIABLE_NAME:
type: str|int|float|bool
required: true|false
default: "default_value"
description: "Human-readable description"
```
### Example Schema
```yaml
# Database Configuration
DATABASE_URL:
type: str
required: true
description: "PostgreSQL connection string"
DATABASE_POOL_SIZE:
type: int
default: 10
description: "Database connection pool size"
# Application Settings
DEBUG:
type: bool
default: false
description: "Enable debug mode"
LOG_LEVEL:
type: str
default: "INFO"
description: "Logging level"
# API Configuration
API_TIMEOUT:
type: float
default: 30.0
description: "API request timeout in seconds"
MAX_REQUESTS:
type: int
default: 1000
description: "Maximum concurrent requests"
```
## ๐งช Testing
Run the test suite:
```bash
# Install test dependencies
pip install pytest pytest-cov
# Run tests with coverage
python3 -m pytest --cov=envsmith
# Run specific test file
python3 -m pytest tests/test_core.py
```
## ๐ Development
### Project Structure
```
envsmith/
โโโ envsmith/ # Main package
โ โโโ __init__.py # Package initialization
โ โโโ core.py # Core loader and validation
โ โโโ cli.py # Command-line interface
โ โโโ validation.py # Schema validation logic
โ โโโ schema_loader.py # YAML/JSON schema loading
โ โโโ secrets.py # Secrets management
โ โโโ _types.py # Type definitions
โ โโโ integrations/ # Framework integrations
โ โโโ fastapi.py # FastAPI integration
โ โโโ django.py # Django integration
โโโ tests/ # Test suite
โโโ examples/ # Usage examples
โโโ docs/ # Documentation
```
### Adding New Features
1. **Type Support**: Add new types in `validation.py`
2. **Framework Integration**: Create new integration modules
3. **CLI Commands**: Extend `cli.py` with new subcommands
4. **Secrets Providers**: Implement actual secret provider interfaces
## ๐ Examples
Check the `examples/` directory for complete working examples:
- `demo_fastapi.py` - FastAPI application with envsmith
- `demo_django.py` - Django settings with envsmith
- `env.example` - Example environment file
## ๐ค Contributing
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests for new functionality
5. Ensure all tests pass
6. Submit a pull request
### Development Setup
```bash
# Clone the repository
git clone https://github.com/PeymanSohi/envsmith.git
cd envsmith
# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install in development mode
pip install -e ".[fastapi,django]"
# Install test dependencies
pip install pytest pytest-cov
# Run tests
python3 -m pytest
```
## ๐ License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## ๐ Support
- **Issues**: [GitHub Issues](https://github.com/PeymanSohi/envsmith/issues)
- **Documentation**: [README](https://github.com/PeymanSohi/envsmith#readme)
- **Examples**: Check the `examples/` directory
## ๐ Changelog
See [CHANGELOG.md](CHANGELOG.md) for a detailed history of changes and releases.
Raw data
{
"_id": null,
"home_page": null,
"name": "envsmith",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "environment, dotenv, validation, schema, fastapi, django",
"author": null,
"author_email": "Peyman Tahmasebi <peymantahmasebi10@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/af/dd/9f7841e9b8268bc69d82b3d6e4eda5035e827000dc701edb5f28381e0f14/envsmith-0.1.0.tar.gz",
"platform": null,
"description": "# envsmith\n\n[](https://badge.fury.io/py/envsmith)\n[](https://github.com/PeymanSohi/envsmith/actions/workflows/publish.yml)\n\nA modern, production-ready solution for loading, validating, and managing environment variables in Python using a schema-first approach.\n\n## \ud83d\ude80 How It Works\n\n`envsmith` is a Python package that provides a robust way to manage environment variables with the following workflow:\n\n1. **Schema Definition**: You define a YAML or JSON schema that specifies:\n - Which environment variables are required\n - What data types they should have\n - Default values for optional variables\n - Validation rules\n\n2. **Environment Loading**: The package loads variables from multiple sources:\n - `.env` files\n - System environment variables\n - Custom dictionaries\n - Priority: System > .env file > defaults\n\n3. **Validation & Type Casting**: Each variable is validated against the schema:\n - Required variables are checked for presence\n - Values are cast to the specified types (str, int, float, bool)\n - Helpful error messages for missing/invalid variables\n\n4. **Integration**: Seamlessly integrates with FastAPI and Django applications\n\n## \ud83d\udd27 Technical Architecture\n\n### **Core Processing Pipeline**\n```python\nclass EnvSmith(dict):\n def __init__(self, schema_path, env_file=\".env\", env=None):\n # Step 1: Load .env file into environment\n load_dotenv(env_file)\n \n # Step 2: Parse schema file (YAML/JSON)\n self.schema = load_schema(schema_path)\n \n # Step 3: Get environment (system + .env merged)\n self.env = env or dict(os.environ)\n \n # Step 4: Validate and cast types\n validated = validate_env(self.env, self.schema)\n \n # Step 5: Update the dictionary\n self.update(validated)\n```\n\n### **Data Flow & Priority System**\n1. **Schema Loading**: YAML/JSON \u2192 Python dict with validation rules\n2. **Environment Merging**: System env + .env files + custom dicts\n3. **Priority Chain**: System > .env > Schema defaults\n4. **Type Casting**: Automatic conversion (str, int, float, bool)\n5. **Validation**: Required checks + type validation + error collection\n\n### **Key Components**\n- **`core.py`**: Main engine that orchestrates the entire process\n- **`schema_loader.py`**: Parses YAML/JSON schema files\n- **`validation.py`**: Type casting and validation logic\n- **`integrations/`**: Framework-specific adapters (FastAPI, Django)\n- **`cli.py`**: Command-line interface for common operations\n\n## \ud83d\udcca Comparison with Other Tools\n\n| Feature | envsmith | python-dotenv | pydantic-settings | dynaconf | python-decouple |\n|---------|----------|---------------|-------------------|----------|-----------------|\n| **Schema Validation** | \u2705 YAML/JSON | \u274c None | \u2705 Pydantic models | \u2705 TOML/YAML | \u274c None |\n| **Type Casting** | \u2705 Automatic | \u274c Strings only | \u2705 Pydantic types | \u2705 Basic | \u274c Strings only |\n| **Framework Integration** | \u2705 FastAPI/Django | \u274c None | \u2705 Pydantic ecosystem | \u2705 Multiple | \u274c None |\n| **CLI Tools** | \u2705 Built-in | \u274c None | \u274c None | \u2705 Rich CLI | \u274c None |\n| **Priority System** | \u2705 System > .env > defaults | \u274c .env only | \u2705 Environment > .env | \u2705 Multiple sources | \u2705 .env > env |\n| **Error Handling** | \u2705 Comprehensive | \u274c Basic | \u2705 Pydantic errors | \u2705 Good | \u274c Basic |\n| **Production Ready** | \u2705 Logging, testing | \u26a0\ufe0f Basic | \u2705 Enterprise | \u2705 Enterprise | \u26a0\ufe0f Basic |\n\n### **Why Choose envsmith?**\n\n#### **vs python-dotenv**\n- **python-dotenv**: Only loads `.env` files, no validation, no type casting\n- **envsmith**: Full validation, type safety, multiple sources, framework integration\n\n#### **vs pydantic-settings**\n- **pydantic-settings**: Requires Pydantic knowledge, more complex setup\n- **envsmith**: Simple YAML/JSON schemas, easier to understand and maintain\n\n#### **vs dynaconf**\n- **dynaconf**: More complex, multiple config formats, overkill for simple apps\n- **envsmith**: Focused on environment variables, simple and lightweight\n\n#### **vs python-decouple**\n- **python-decouple**: Basic .env loading, no validation, no type safety\n- **envsmith**: Full validation suite, type casting, production features\n\n### **Performance Characteristics**\n- **Startup Time**: Fast - single pass validation\n- **Memory Usage**: Minimal - only stores validated variables\n- **Runtime Overhead**: Zero - all processing happens at initialization\n- **Error Reporting**: Comprehensive - all issues reported at once\n\n### **Use Cases Where envsmith Excels**\n\u2705 **Web Applications**: FastAPI, Django, Flask\n\u2705 **Microservices**: Environment-based configuration\n\u2705 **Docker Containers**: Environment variable validation\n\u2705 **CI/CD Pipelines**: Configuration validation\n\u2705 **Team Development**: Clear schema documentation\n\u2705 **Production Deployments**: Early error detection\n\n## \u2728 Features\n\n- **Schema-First**: Define your environment structure in YAML/JSON\n- **Multiple Sources**: Load from `.env`, system, or custom dicts\n- **Type Safety**: Automatic type casting and validation\n- **Framework Integration**: FastAPI and Django support\n- **CLI Tools**: Command-line interface for common tasks\n- **Secrets Management**: Mock interface for external secret providers\n- **Production Ready**: Logging, error handling, and comprehensive testing\n\n## \ud83d\udce6 Installation\n\n```bash\npip install envsmith\n```\n\nWith optional extras:\n```bash\npip install envsmith[fastapi,django]\n```\n\n## \ud83c\udfaf Quick Start\n\n### 1. Create a Schema\n\nCreate a `schema.yaml` file:\n\n```yaml\nDATABASE_URL:\n type: str\n required: true\n description: \"Database connection string\"\n\nSECRET_KEY:\n type: str\n required: true\n description: \"Application secret key\"\n\nDEBUG:\n type: bool\n default: false\n description: \"Debug mode\"\n\nPORT:\n type: int\n default: 8000\n description: \"Server port\"\n\nAPI_TIMEOUT:\n type: float\n default: 30.0\n description: \"API timeout in seconds\"\n```\n\n### 2. Create Environment File\n\nCreate a `.env` file:\n\n```bash\nDATABASE_URL=postgresql://user:pass@localhost:5432/mydb\nSECRET_KEY=your-super-secret-key-here\nDEBUG=true\nPORT=8080\nAPI_TIMEOUT=45.0\n```\n\n### 3. Use in Python\n\n```python\nfrom envsmith import EnvSmith\n\n# Load with schema validation\nsettings = EnvSmith(schema_path=\"schema.yaml\", env_file=\".env\")\n\n# Access validated variables\nprint(settings[\"DATABASE_URL\"]) # postgresql://user:pass@localhost:5432/mydb\nprint(settings[\"DEBUG\"]) # True (bool)\nprint(settings[\"PORT\"]) # 8080 (int)\nprint(settings[\"API_TIMEOUT\"]) # 45.0 (float)\n\n# Get with default fallback\nprint(settings.get(\"NONEXISTENT\", \"default_value\"))\n```\n\n## \ud83d\udee0\ufe0f CLI Usage\n\n### Initialize Project\n\nCreate `.env` and `schema.yaml` files:\n\n```bash\npython3 -m envsmith init\n```\n\n### Validate Environment\n\nCheck if your `.env` file matches the schema:\n\n```bash\npython3 -m envsmith validate\n```\n\n### Export Environment\n\nExport validated variables in different formats:\n\n```bash\n# Export as JSON\npython3 -m envsmith export --format json\n\n# Export as YAML\npython3 -m envsmith export --format yaml\n```\n\n## \ud83d\udd0c Framework Integrations\n\n### FastAPI Integration\n\n```python\nfrom fastapi import FastAPI, Depends\nfrom envsmith.integrations.fastapi import get_settings\n\napp = FastAPI()\n\n@app.get(\"/config\")\ndef get_config(settings = Depends(get_settings)):\n return {\n \"database_url\": settings[\"DATABASE_URL\"],\n \"debug\": settings[\"DEBUG\"],\n \"port\": settings[\"PORT\"]\n }\n\n@app.get(\"/health\")\ndef health_check(settings = Depends(get_settings)):\n return {\n \"status\": \"healthy\",\n \"environment\": settings.get(\"ENV\", \"development\")\n }\n```\n\n### Django Integration\n\nIn your `settings.py`:\n\n```python\nfrom envsmith.integrations.django import load_envsmith\n\n# Load environment variables with schema validation\nload_envsmith(schema_path=\"schema.yaml\")\n\n# Now you can use them directly\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.postgresql',\n 'NAME': DATABASE_NAME,\n 'USER': DATABASE_USER,\n 'PASSWORD': DATABASE_PASSWORD,\n 'HOST': DATABASE_HOST,\n 'PORT': DATABASE_PORT,\n }\n}\n\nSECRET_KEY = SECRET_KEY\nDEBUG = DEBUG\nALLOWED_HOSTS = ALLOWED_HOSTS.split(',') if ALLOWED_HOSTS else []\n```\n\n## \ud83d\udd10 Secrets Management\n\nFor production environments, you can integrate with external secret providers:\n\n```python\nfrom envsmith.secrets import SecretProvider\n\n# Mock interface (replace with actual AWS, Vault, etc.)\nsecrets = SecretProvider()\n\n# Get secret from external provider\napi_key = secrets.get_secret(\"API_KEY\")\n\n# Fallback to local secret\nfallback_key = secrets.get_local_secret(\"API_KEY\")\n```\n\n## \ud83d\udccb Schema Reference\n\n### Supported Types\n\n- **str**: String values\n- **int**: Integer values\n- **float**: Floating-point values\n- **bool**: Boolean values (accepts: true/false, yes/no, 1/0, on/off)\n\n### Schema Structure\n\n```yaml\nVARIABLE_NAME:\n type: str|int|float|bool\n required: true|false\n default: \"default_value\"\n description: \"Human-readable description\"\n```\n\n### Example Schema\n\n```yaml\n# Database Configuration\nDATABASE_URL:\n type: str\n required: true\n description: \"PostgreSQL connection string\"\n\nDATABASE_POOL_SIZE:\n type: int\n default: 10\n description: \"Database connection pool size\"\n\n# Application Settings\nDEBUG:\n type: bool\n default: false\n description: \"Enable debug mode\"\n\nLOG_LEVEL:\n type: str\n default: \"INFO\"\n description: \"Logging level\"\n\n# API Configuration\nAPI_TIMEOUT:\n type: float\n default: 30.0\n description: \"API request timeout in seconds\"\n\nMAX_REQUESTS:\n type: int\n default: 1000\n description: \"Maximum concurrent requests\"\n```\n\n## \ud83e\uddea Testing\n\nRun the test suite:\n\n```bash\n# Install test dependencies\npip install pytest pytest-cov\n\n# Run tests with coverage\npython3 -m pytest --cov=envsmith\n\n# Run specific test file\npython3 -m pytest tests/test_core.py\n```\n\n## \ud83d\ude80 Development\n\n### Project Structure\n\n```\nenvsmith/\n\u251c\u2500\u2500 envsmith/ # Main package\n\u2502 \u251c\u2500\u2500 __init__.py # Package initialization\n\u2502 \u251c\u2500\u2500 core.py # Core loader and validation\n\u2502 \u251c\u2500\u2500 cli.py # Command-line interface\n\u2502 \u251c\u2500\u2500 validation.py # Schema validation logic\n\u2502 \u251c\u2500\u2500 schema_loader.py # YAML/JSON schema loading\n\u2502 \u251c\u2500\u2500 secrets.py # Secrets management\n\u2502 \u251c\u2500\u2500 _types.py # Type definitions\n\u2502 \u2514\u2500\u2500 integrations/ # Framework integrations\n\u2502 \u251c\u2500\u2500 fastapi.py # FastAPI integration\n\u2502 \u2514\u2500\u2500 django.py # Django integration\n\u251c\u2500\u2500 tests/ # Test suite\n\u251c\u2500\u2500 examples/ # Usage examples\n\u2514\u2500\u2500 docs/ # Documentation\n```\n\n### Adding New Features\n\n1. **Type Support**: Add new types in `validation.py`\n2. **Framework Integration**: Create new integration modules\n3. **CLI Commands**: Extend `cli.py` with new subcommands\n4. **Secrets Providers**: Implement actual secret provider interfaces\n\n## \ud83d\udcdd Examples\n\nCheck the `examples/` directory for complete working examples:\n\n- `demo_fastapi.py` - FastAPI application with envsmith\n- `demo_django.py` - Django settings with envsmith\n- `env.example` - Example environment file\n\n## \ud83e\udd1d Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests for new functionality\n5. Ensure all tests pass\n6. Submit a pull request\n\n### Development Setup\n\n```bash\n# Clone the repository\ngit clone https://github.com/PeymanSohi/envsmith.git\ncd envsmith\n\n# Create virtual environment\npython3 -m venv .venv\nsource .venv/bin/activate # On Windows: .venv\\Scripts\\activate\n\n# Install in development mode\npip install -e \".[fastapi,django]\"\n\n# Install test dependencies\npip install pytest pytest-cov\n\n# Run tests\npython3 -m pytest\n```\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## \ud83c\udd98 Support\n\n- **Issues**: [GitHub Issues](https://github.com/PeymanSohi/envsmith/issues)\n- **Documentation**: [README](https://github.com/PeymanSohi/envsmith#readme)\n- **Examples**: Check the `examples/` directory\n\n## \ud83d\udd04 Changelog\n\nSee [CHANGELOG.md](CHANGELOG.md) for a detailed history of changes and releases.\n",
"bugtrack_url": null,
"license": "MIT License\n \n Copyright (c) 2025 [Your Name]\n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n ",
"summary": "Modern, schema-first environment variable loader and manager for Python.",
"version": "0.1.0",
"project_urls": {
"Changelog": "https://github.com/PeymanSohi/envsmith/blob/main/CHANGELOG.md",
"Documentation": "https://github.com/PeymanSohi/envsmith#readme",
"Homepage": "https://github.com/PeymanSohi/envsmith",
"Source": "https://github.com/PeymanSohi/envsmith"
},
"split_keywords": [
"environment",
" dotenv",
" validation",
" schema",
" fastapi",
" django"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "1588197e895ca84cd632a8df67320cc423d750abde9eb3fafc2d6bbcc93a5c9a",
"md5": "609665f2d46278e7ae5fcfa7aa6c942a",
"sha256": "817ad2255819c5c27a935f215391df3182c0a11f06185b108da6b20c19452121"
},
"downloads": -1,
"filename": "envsmith-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "609665f2d46278e7ae5fcfa7aa6c942a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 12830,
"upload_time": "2025-08-19T21:03:28",
"upload_time_iso_8601": "2025-08-19T21:03:28.174220Z",
"url": "https://files.pythonhosted.org/packages/15/88/197e895ca84cd632a8df67320cc423d750abde9eb3fafc2d6bbcc93a5c9a/envsmith-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "afdd9f7841e9b8268bc69d82b3d6e4eda5035e827000dc701edb5f28381e0f14",
"md5": "6e0127f9815a66889b4198c6f1b726df",
"sha256": "7da6d8e50bde173156d4d55e4e83ceb5b3ff4a0f0c5e334021ea4421b7d6f108"
},
"downloads": -1,
"filename": "envsmith-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "6e0127f9815a66889b4198c6f1b726df",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 16897,
"upload_time": "2025-08-19T21:03:29",
"upload_time_iso_8601": "2025-08-19T21:03:29.237562Z",
"url": "https://files.pythonhosted.org/packages/af/dd/9f7841e9b8268bc69d82b3d6e4eda5035e827000dc701edb5f28381e0f14/envsmith-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-19 21:03:29",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "PeymanSohi",
"github_project": "envsmith",
"github_not_found": true,
"lcname": "envsmith"
}