Skip to main content

Easy environment variables management with type validation

Project description

easy-dotenv

PyPI version Python Versions License: MIT

Simple and type-safe environment variables management for Python.

Installation

pip install easy-dotenv

Usage

from easy_dotenv import EnvLoader

env = EnvLoader.load(
    # Required variables
    database_url=str,
    port=int,
    
    # Optional variables with defaults
    debug=(bool, False),
    workers=(int, 4)
)

# Access your environment variables
print(env.database_url)
print(env.port)
print(env.debug)  # False if not set
print(env.workers)  # 4 if not set

Features

  • Type validation
  • Required/optional variables
  • Default values
  • .env file support
  • Clean and simple API
  • Type hints support

Error Handling

from easy_dotenv import EnvLoader, EnvMissingError, EnvTypeError

try:
    env = EnvLoader.load(
        api_key=str,
        port=int
    )
except EnvMissingError as e:
    print("Missing environment variables:", e)
except EnvTypeError as e:
    print("Invalid environment variable type:", e)

Development

Setup

# Create virtual environment
python3 -m venv venv

# Activate virtual environment
source venv/bin/activate  # Linux/MacOS
# or
# venv\Scripts\activate  # Windows

# Install with development dependencies
pip install -e ".[dev]"

Running Tests

# Run tests
pytest

# Run tests with coverage
pytest --cov=easy_dotenv

License

MIT

Requirements

  • Python 3.7 or higher
  • python-dotenv>=0.19.0

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

easy_dotenv-0.1.3.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

easy_dotenv-0.1.3-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file easy_dotenv-0.1.3.tar.gz.

File metadata

  • Download URL: easy_dotenv-0.1.3.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for easy_dotenv-0.1.3.tar.gz
Algorithm Hash digest
SHA256 97bbd174e00910bdfd7247025c26760427538835527db09370812cf0e41f066c
MD5 c651220ab80234cd86004842a06b27b8
BLAKE2b-256 712d0602371c403f1830a1b7450af29102dbab45effb6ce3a1e5b540f453a81e

See more details on using hashes here.

File details

Details for the file easy_dotenv-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: easy_dotenv-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for easy_dotenv-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 89e70eb3e58c4b57c39b1979a4ede7dbfad3e4872c291d8825bdb428c2991aaa
MD5 70b19b21b8e46d3a8c386de92105d8eb
BLAKE2b-256 ca89a69fa4df9b7edc29088b73feceaa5a7ddc8fd18c5c7128829a4d641483e1

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