Skip to main content

paraboloski-dotenv

Lightweight wrapper around os.getenv() inspired by Go: explicit config, fail-fast startup, no silent misconfiguration.

  • use env() when a value can have a fallback
  • use require() when the application cannot run without it

Install

uv add paraboloski-dotenv
pip install paraboloski-dotenv

GitHub:

uv add git+https://github.com/paraboloski/snippet-toolbox/python#subdirectory=snippet/paraboloski-dotenv

env() vs require()

env() require()
Missing value fallback or error immediate crash (panic)
Use case optional config required config

Usage

from dotenv import env, require

# optional
POOL_SIZE = int(env("POOL_SIZE", "10"))
TIMEOUT = int(env("TIMEOUT", "30"))

# required
DATABASE_URL = require("DATABASE_URL")
JWT_SECRET = require("JWT_SECRET")

Production behavior

Missing required variable:

[PANIC] Missing environment variable: 'DATABASE_URL'
exit code 1

App fails fast instead of starting in a broken state.


Compared to os.getenv()

# fragile
DATABASE_URL = os.getenv("DATABASE_URL")

if not DATABASE_URL:
    raise RuntimeError("missing")

vs

# explicit
DATABASE_URL = require("DATABASE_URL")

Less boilerplate. Clear intent. Safer startup.



Italiano

Wrapper leggero di os.getenv() ispirato a alla filosofia di Go: configurazione esplicita e fail-fast.

  • Utilizzare env() quando un valore può avere un valore di fallback
  • Utilizzare require() quando l'applicazione non può funzionare senza di esso

Installazione

uv add paraboloski-dotenv
pip install paraboloski-dotenv

GitHub:

uv add git+https://github.com/paraboloski/snippet-toolbox/python#subdirectory=snippet/paraboloski-dotenv

env() vs require()

env() require()
Valore mancante fallback o errore crash immediato (panic)
Uso config opzionale config obbligatoria

Utilizzo

from dotenv import env, require

# opzionale
POOL_SIZE = int(env("POOL_SIZE", "10"))
TIMEOUT = int(env("TIMEOUT", "30"))

# obbligatorio
DATABASE_URL = require("DATABASE_URL")
JWT_SECRET = require("JWT_SECRET")

Comportamento in produzione

Variabile mancante:

[PANIC] Missing environment variable: 'DATABASE_URL'
exit code 1

L'app si ferma subito invece di partire in stato incoerente.


Confronto con os.getenv()

# fragile
DATABASE_URL = os.getenv("DATABASE_URL")

if not DATABASE_URL:
    raise RuntimeError("missing")

vs

# esplicito
DATABASE_URL = require("DATABASE_URL")

Meno boilerplate. Intento chiaro. Avvio più sicuro.

Metadata

Release files for paraboloski-dotenv 1.0.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 paraboloski-dotenv 1.0.0
File Size Uploaded Provenance Actions
paraboloski_dotenv-1.0.0.tar.gz 3.8 kB Without provenance Details for paraboloski_dotenv-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for paraboloski-dotenv 1.0.0
File Interpreter ABI Platform Actions
paraboloski_dotenv-1.0.0-py3-none-any.whl Python 3 none any Details for paraboloski_dotenv-1.0.0-py3-none-any.whl

Total release size: 7.2 kB

Release files / paraboloski_dotenv-1.0.0.tar.gz

Download URL paraboloski_dotenv-1.0.0.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1822108e24d80104addf7dbdba904cc1dfd5de559780d46fc8c2810aa019925c
BLAKE2b-256 checksum
How to use checksums
7ee75afb11d8f46c3e6ba8f3b871c04cf9be175f760ee64eb3cce35e9e02b84f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / paraboloski_dotenv-1.0.0-py3-none-any.whl

Download URL paraboloski_dotenv-1.0.0-py3-none-any.whl
Size 3.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
958c9db971a1b2b7583f63e800edc42e90f8c37ba7e134c7e45673d476885b47
BLAKE2b-256 checksum
How to use checksums
dc4017099912b4cc2740a6ed11be763a1b08930117764fbcb56a62e2c0441a3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for paraboloski-dotenv 1.0.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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.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