Metadata-Version: 2.4
Name: envdrift
Version: 0.0.1
Summary: Prevent environment variable drift with Pydantic schema validation, pre-commit hooks, and dotenvx encryption
Project-URL: Homepage, https://github.com/jainal09/envdrift
Project-URL: Documentation, https://github.com/jainal09/envdrift#readme
Project-URL: Repository, https://github.com/jainal09/envdrift
Project-URL: Issues, https://github.com/jainal09/envdrift/issues
Author-email: Jainal Gosaliya <gosaliya.jainal@gmail.com>
License-Expression: MIT
License-File: LICENSE
Keywords: config,dotenv,drift,environment,pre-commit,pydantic,schema,secrets,validation,variables
Classifier: Development Status :: 1 - Planning
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: pydantic-settings>=2.0
Requires-Dist: pydantic>=2.0
Requires-Dist: python-dotenv>=1.0
Requires-Dist: rich>=13.0
Requires-Dist: typer>=0.9
Provides-Extra: dev
Requires-Dist: bandit>=1.7.0; extra == 'dev'
Requires-Dist: pre-commit>=3.0; extra == 'dev'
Requires-Dist: pyrefly>=0.2.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.8.0; extra == 'dev'
Description-Content-Type: text/markdown

# envdrift

[![PyPI version](https://badge.fury.io/py/envdrift.svg)](https://badge.fury.io/py/envdrift)
[![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

**Prevent environment variable drift between dev, staging, and production.**

> 🚧 **Under Active Development** - Core features coming in v0.1.0

## The Problem

Environment variable drift is a silent killer of deployments:

- A missing `DATABASE_URL` in production causes a 3am outage
- Staging has `NEW_FEATURE_FLAG=true` but production doesn't
- Someone copies the wrong `.env` file and chaos ensues
- "It works on my machine!" becomes your team's motto

**In 2024 alone, 24 million secrets were leaked on GitHub.** Knight Capital lost **$460 million in 45 minutes** due to a configuration deployment error.

## The Solution

`envdrift` treats your environment variables with the same rigor as your code:

- **Schema Validation**: Define expected variables with Pydantic, catch mismatches at startup
- **Drift Detection**: Compare `.env.dev` vs `.env.prod` and see exactly what differs
- **Pre-commit Hooks**: Block commits if your `.env` doesn't match your schema
- **CI/CD Integration**: Fail fast in pipelines before bad config reaches production
- **Encryption Support**: Works with dotenvx for secure, committable `.env` files

## Installation

```bash
pip install envdrift
# or
uv add envdrift
```

## Quick Start

### Validate your .env against a schema

```bash
envdrift validate .env --schema myapp.config:Settings
```

### Compare environments

```bash
envdrift diff .env.dev .env.prod
```

### Generate a Settings class from existing .env

```bash
envdrift init .env --output settings.py
```

### Install pre-commit hook

```bash
envdrift hook --install
```

## Planned Features (v0.1.0)

- [ ] `envdrift validate` - Validate .env against Pydantic schema
- [ ] `envdrift diff` - Compare two .env files
- [ ] `envdrift init` - Generate Settings class from .env
- [ ] `envdrift hook` - Pre-commit hook integration
- [ ] Rich terminal output with clear error messages
- [ ] dotenvx encryption detection and support
- [ ] CI mode with proper exit codes

## Why envdrift?

| Feature | python-dotenv | dynaconf | pydantic-settings | **envdrift** |
|---------|---------------|----------|-------------------|--------------|
| Load .env | ✅ | ✅ | ✅ | ✅ |
| Type validation | ❌ | ⚠️ | ✅ | ✅ |
| Schema enforcement | ❌ | ⚠️ | ✅ | ✅ |
| Cross-env diff | ❌ | ❌ | ❌ | ✅ |
| Pre-commit hook | ❌ | ❌ | ❌ | ✅ |
| Encryption support | ❌ | ❌ | ❌ | ✅ |

## Development

```bash
# Clone the repo
git clone https://github.com/jainal09/envdrift.git
cd envdrift

# Install dev dependencies
make dev

# Run checks
make check
```

## License

MIT License - see [LICENSE](LICENSE) for details.

## Author

**Jainal Gosaliya** - [gosaliya.jainal@gmail.com](mailto:gosaliya.jainal@gmail.com)
