Skip to main content

duckenv

A minimalist dotenv loader for Python, inspired by environs but with fewer features and dependencies.

Installation

pip install duckenv

Usage

Create a .env file:

DEBUG=on
TTL=30
NAME=Jean-Michel
MY_LIST=apple,banana,orange

Load and parse environment variables:

from duckenv import Env

env = Env()  # reads `.env` by default

env.str("NAME")                    # "Jean-Michel"
env.int("AGE")                     # 30
env.bool("DEBUG")                  # True
env.list("MY_LIST")                # ["apple", "banana", "orange"]
env.str("MISSING_VAR", "default")  # "default"
env.str("MISSING_VAR")             # Raises KeyError
env.int("NAME")                    # Raises ValueError

Supported Methods

  • str(name, default=...): Returns a string or None.
  • int(name, default=...): Returns an integer or None.
  • bool(name, default=...): Accepts true/false, on/off, 1/0, returns True/False or None.
  • list(name, default=...): Parses comma-separated strings into a list of stripped strings, or accepts a list directly.

If a variable is not set and no default is provided, a KeyError is raised.

License

MIT

Metadata

Release files for duckenv 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for duckenv 0.1.0
File Size Uploaded Provenance
duckenv-0.1.0.tar.gz 4.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for duckenv 0.1.0
File Interpreter ABI Platform
duckenv-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.2 kB

Release files / duckenv-0.1.0.tar.gz

Download URL duckenv-0.1.0.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
29abe8724d1d09cce3318c743bb8ee8fc9befc1876edbe4851b2c8405a2cdc25
BLAKE2b-256 checksum
How to use checksums
428455d3aaa203caad2afcfa402128f2a66cf76efc8eb2e3886d1c0214bc9d64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / duckenv-0.1.0-py3-none-any.whl

Download URL duckenv-0.1.0-py3-none-any.whl
Size 3.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8666316c7332e83187979d2eaca5b622a2240dfe90e96d7f06cf3b23ea502c54
BLAKE2b-256 checksum
How to use checksums
1852c3cd13e16d3af33d9e1adfb782ed1f79d8e12cefde0904f266c13375f563
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Security for duckenv 0.1.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page