Skip to main content

Type-safe environment variable management

Project description

envmaster 🔐

Type-safe environment variable management for Python.

Installation

pip install envmaster

Usage

from envmaster import env

# String (required)
DATABASE_URL = env.str("DATABASE_URL", required=True)

# Boolean with default
DEBUG = env.bool("DEBUG", default=False)

# Integer with default
MAX_CONNECTIONS = env.int("MAX_CONNECTIONS", default=10)

# Float
TIMEOUT = env.float("TIMEOUT", default=30.0)

# List (comma-separated)
ALLOWED_HOSTS = env.list("ALLOWED_HOSTS", default=["localhost"])

# JSON
CONFIG = env.json("CONFIG", default={})

Methods

Method Return Type Description
env.str() str String value
env.int() int Integer value
env.float() float Float value
env.bool() bool Boolean value
env.list() list List of strings
env.json() any Parsed JSON

Boolean Values

Truthy: true, 1, yes, on
Falsy: false, 0, no, off

Error Handling

from envmaster import env, EnvError

try:
    secret = env.str("SECRET_KEY", required=True)
except EnvError as e:
    print(f"Configuration error: {e}")

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

envmaster-1.0.0.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

envmaster-1.0.0-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file envmaster-1.0.0.tar.gz.

File metadata

  • Download URL: envmaster-1.0.0.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for envmaster-1.0.0.tar.gz
Algorithm Hash digest
SHA256 22264aa492b193430d23e0837a181b4bc0da854b5a5145e6a7359d79cfd099bd
MD5 f926ed9b4670b5fe9caa00f4d3518aaf
BLAKE2b-256 0c9f7d7e49c860d988ff35d240179f30d76f0453e41025e2ba00e3ead36a727d

See more details on using hashes here.

File details

Details for the file envmaster-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: envmaster-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for envmaster-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6a6bf0a73fd19070ba91b63433029c4aadf7ff74810df737f6ed69fb87c51a05
MD5 f6b215734117f4e1403dea981183e8a2
BLAKE2b-256 e7900d0c94821772723a1b51ef2a1aad7c4e54e7a1921deb0e9aba0b39c0d82a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page