Prevent environment variable drift with Pydantic schema validation, pre-commit hooks, and dotenvx encryption
Project description
envdrift
Prevent environment variable drift between dev, staging, and production.
The Problem
- A missing
DATABASE_URLin production causes a 3am outage - Staging has
NEW_FEATURE_FLAG=truebut production doesn't - "It works on my machine!" becomes your team's motto
The Solution
# Validate .env against Pydantic schema
envdrift validate .env --schema config.settings:Settings
# Compare dev vs prod
envdrift diff .env.development .env.production
# Check encryption status
envdrift encrypt .env.production --check
Installation
pip install envdrift
Quick Start
Define your schema:
from pydantic import Field
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
model_config = SettingsConfigDict(extra="forbid")
DATABASE_URL: str = Field(json_schema_extra={"sensitive": True})
API_KEY: str = Field(json_schema_extra={"sensitive": True})
DEBUG: bool = False
Validate:
envdrift validate .env --schema config.settings:Settings
Features
| Feature | envdrift |
|---|---|
| Schema validation | Pydantic-based |
| Cross-env diff | Yes |
| Pre-commit hooks | Yes |
| Encryption (dotenvx, SOPS) | Yes |
| Vault integration | Azure, AWS, HashiCorp, GCP |
| CI/CD mode | Yes |
Documentation
Full documentation: jainal09.github.io/envdrift
Development
git clone https://github.com/jainal09/envdrift.git
cd envdrift
make dev
make test
make docs-serve
License
MIT
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
envdrift-4.2.0.tar.gz
(220.7 kB
view details)
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
envdrift-4.2.0-py3-none-any.whl
(102.6 kB
view details)
File details
Details for the file envdrift-4.2.0.tar.gz.
File metadata
- Download URL: envdrift-4.2.0.tar.gz
- Upload date:
- Size: 220.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94ce7a8930cc8facf3785908aeaa6bff5675ba6a98d98ceb48f8b1cb04fc076f
|
|
| MD5 |
c9d4014a6de655270fdc02093fbb93fa
|
|
| BLAKE2b-256 |
20bc7e42a6ad6be4eea7fb43b5f565a04c81bc9217dd8ae0eb7ea27f2506f763
|
File details
Details for the file envdrift-4.2.0-py3-none-any.whl.
File metadata
- Download URL: envdrift-4.2.0-py3-none-any.whl
- Upload date:
- Size: 102.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb5e35f7375faf65aef8388a04d806b791aa7022ce1ba0f6c81eea7dc612069d
|
|
| MD5 |
5810e08ea214bd8b4c1419a79f420d5b
|
|
| BLAKE2b-256 |
ccbb65c2dc8317e120689c685bab9e3f83a74d791f9a9e11f3d3ffa0f8ba6991
|