Metadata-Version: 2.4
Name: crashbytes-envguard
Version: 1.1.0
Summary: Lightweight environment variable validation with schema, type coercion, and .env loading.
Project-URL: Homepage, https://github.com/CrashBytes/crashbytes-envguard
Project-URL: Repository, https://github.com/CrashBytes/crashbytes-envguard
Project-URL: Issues, https://github.com/CrashBytes/crashbytes-envguard/issues
Author-email: CrashBytes <crashbytes@users.noreply.github.com>
License-Expression: MIT
License-File: LICENSE
Keywords: config,dotenv,env,environment,validation
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.10
Provides-Extra: dev
Requires-Dist: mypy>=1.20; extra == 'dev'
Requires-Dist: pytest-cov>=7.1; extra == 'dev'
Requires-Dist: pytest>=9.0; extra == 'dev'
Requires-Dist: ruff>=0.15; extra == 'dev'
Description-Content-Type: text/markdown

# crashbytes-envguard

Lightweight environment variable validation with schema, type coercion, and .env loading.

## Install

```bash
pip install crashbytes-envguard
```

## Usage

```python
from crashbytes_envguard import create_env, s

env = create_env({
    "PORT": s.port().default(8080),
    "DB_URL": s.url(),
    "DEBUG": s.boolean().default(False),
    "LOG_LEVEL": s.string().choices("debug", "info", "warn", "error").default("info"),
})

print(env["PORT"])      # 8080 (int, type-coerced)
print(env["DB_URL"])    # "https://..." (validated)
print(env["DEBUG"])     # False (bool, type-coerced)
```

Fails fast with **all** errors at once:

```
EnvError: Environment validation failed:
  - DB_URL: required but not set
  - PORT: must be >= 1 (got 0)
```

## Schema Types

| Builder | Type | Extra Validation |
|---------|------|-----------------|
| `s.string()` | `str` | — |
| `s.integer()` | `int` | — |
| `s.number()` | `float` | — |
| `s.boolean()` | `bool` | true/1/yes/on, false/0/no/off |
| `s.port()` | `int` | 1–65535 |
| `s.url()` | `str` | Must start with http(s):// |
| `s.email()` | `str` | Must be valid email format |

## Field Modifiers

`.default(value)`, `.optional()`, `.choices(...)`, `.min(n)`, `.max(n)`, `.pattern(regex)`

## License

MIT
