crashbytes-envguard
Lightweight environment variable validation with schema, type coercion, and .env loading.
Install
pip install crashbytes-envguard
Usage
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
Metadata
Release files for crashbytes-envguard 1.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| crashbytes_envguard-1.1.8.tar.gz | 51.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| crashbytes_envguard-1.1.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 57.2 kB
Release files / crashbytes_envguard-1.1.8.tar.gz
| Download URL | crashbytes_envguard-1.1.8.tar.gz |
|---|---|
| Size | 51.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
adf2de06d072d7a43a8982e568de2154d336282b90d6867459a18a567e110a92
|
|
BLAKE2b-256 checksum How to use checksums |
6c8971df4723b5604ba0d4e23c8b2e8e6996b933204e06d7fbd864c8d9d1cc7a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.
Transparency logRelease files / crashbytes_envguard-1.1.8-py3-none-any.whl
| Download URL | crashbytes_envguard-1.1.8-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c81f25b2723afb37b710b95105ddb387dc80c009619ec6073b5e903c4ec33e26
|
|
BLAKE2b-256 checksum How to use checksums |
ee0331572d50881561f16fd6e36d7898defe8416167d3444af88bd2ad6276785
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.
Transparency log