Skip to main content

dworshak-env

GitHub: dworshak-env

dworshak-env provides a small, convenient interface for working with environment variables and .env files. It is designed to fit into existing workflows without introducing surprises.

This library does not replace os.getenv. Instead, it helps you manage environment variables in a predictable, Pythonic way and integrates naturally with the broader Dworshak ecosystem:


Installation

pip install dworshak-env

Usage

Simple access to environment variables

from dworshak_env import DworshakEnv

env = DworshakEnv()
api_url = env.get("API_URL", default="https://api.github.com")
print(api_url)

Loading from a .env file

env = DworshakEnv(path=".env")
db_password = env.get("DB_PASSWORD")

Setting defaults

You can instantiate DworshakEnv with defaults that act as fallbacks:

defaults = {"API_URL": "https://api.github.com", "DEBUG": "0"}
env = DworshakEnv(defaults=defaults)

print(env.get("API_URL"))  # returns the default if not set in environment

Philosophy

dworshak-env exists to make environment variables and .env files easy to access in Python programs.

It joins the mainstream patterns that Python developers already know, while providing smooth prompting to users via DworshakPrompt - because developers are users too.

Use it wherever you want predictable, Pythonic environment variable access, with optional integration into the Dworshak ecosystem.


CLI

The dworshak layer is the intended primary CLI entry point, but the dworshak-env CLI can be used directly.

pipx install "dworshak-env[typer]"
dworshak-env --version
dworshak-env --help
dworshak-env set "key" 0
dworshak-env helptree

Screenshot of the dworshak-env CLI helptree

helptree is utility funtion for Typer CLIs, imported from the typer-helptree library.


Sister Projects in the Dworshak Ecosystem

pipx install dworshak
pip install dworshak-secret
pip install dworshak-config
pip install dworshak-env
pip install dworshak-prompt

Metadata

Release files for dworshak-env 0.1.8

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

Source distribution (sdist)

Source distribution for dworshak-env 0.1.8
File Size Uploaded
dworshak_env-0.1.8.tar.gz 11.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dworshak-env 0.1.8
File Interpreter ABI Platform
dworshak_env-0.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 21.7 kB

Release files / dworshak_env-0.1.8.tar.gz

Download URL dworshak_env-0.1.8.tar.gz
Size 11.6 kB
Tags Source
SHA-256 checksum
How to use checksums
617947c0436b9e1abc03eaca305656abd4e5563668a967aab1a5aa51e294c53d
BLAKE2b-256 checksum
How to use checksums
3c73dd6c90aeae360769c2cc6ee4212caa667c76790e63d01663f88daefabd9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 5, 2026.

Transparency log

Release files / dworshak_env-0.1.8-py3-none-any.whl

Download URL dworshak_env-0.1.8-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
10842812dd926b9909fc2b7b568f8c035bc204291cb3b3013ba16820b88dd026
BLAKE2b-256 checksum
How to use checksums
6c7fe045125bef93ed51ff1338479c16d5a52d804f7b17a63a42f660ad0c014e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jun 5, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.8 This release

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

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