Skip to main content

getenv

Environment variable definition with type.

Install

pip install getenv

Usage

See example.py:

from getenv import Env


app_name = 'FOO'

# Set the prefix for env vars
Env.set_prefix(app_name)

# Define your envs
ENV_PROCESSES = Env('{prefix}_PROCESSES', type=int, default=1)
ENV_DEBUG = Env('{prefix}_DEBUG', type=bool, default=False)
ENV_OPERATOR = Env('{prefix}_OPERATOR', default=None)


def main():
    processes = ENV_PROCESSES.get()
    debug = ENV_DEBUG.get()
    operator = ENV_OPERATOR.get()

    print('Run {} processes, debug = {}, operator = {}'.format(processes, debug, operator))

Run example.py normally:

$ FOO_PROCESSES=3 python example.py
Run 3 processes, debug = False, operator = None

Then with envs:

$ FOO_PROCESSES=3 FOO_DEBUG=true FOO_OPERATOR=$(whoami) python example.py
Run 3 processes, debug = True, operator = reorx

Metadata

Release files for getenv 0.2.0

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

Built distribution (wheel)

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

Release files / getenv-0.2.0-py3-none-any.whl

Download URL getenv-0.2.0-py3-none-any.whl
Size 2.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8469827f7c8bbf4f2d899655640b0bd1eeac546f526b2fe8b8435d8db0f2ab36
BLAKE2b-256 checksum
How to use checksums
2efe4509548a63024557364f0385173afa976a8890728b522590029bcfc1cd79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.1

Security for getenv 0.2.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

0.2.0 This release

1 release file 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