Skip to main content

Getting Started

Use pip install parsenv.

Reads .env file on import, then reads other env-files from $ENVPATH (comma separated).

Example

import env

assert env.get("TOKEN") == "abc123"
assert env.get("X", None) is None
assert env.get_int("PORT") == 123
assert env.get_strs("KEYS", []) == ["word1", "F402", "12"]
assert env.get_ints("ADMIN_IDS") == [1, 2, 3]
assert env.get_ints("X", [0]) == [0]

with env.prefix("BOOL"):
    assert env.get_bool("T")
    assert not env.get_bool("F")

try:
    env.get("X")
except Exception as e:
    assert str(e) == 'Mandatory environment variable "X" is missing'

try:
    env.get_ints("BAD_NUMS")
except Exception as e:
    assert str(e) == 'Failed to cast "1,2,a" (variable name "BAD_NUMS") to list'

try:
    env.get_bool("BAD_BOOL")
except Exception as e:
    assert str(e) == 'Failed to cast "ok" (variable name "BAD_BOOL") to bool'

assert env.raw.float("FLOAT") == 1.45

Metadata

Release files for parsenv 0.3.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 parsenv 0.3.0
File Size Uploaded Provenance Actions
parsenv-0.3.0.tar.gz 1.9 kB Without provenance Details for parsenv-0.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 4.3 kB

Release files / parsenv-0.3.0.tar.gz

Download URL parsenv-0.3.0.tar.gz
Size 1.9 kB
Tags Source
SHA-256 checksum
How to use checksums
396380632f993f2325f3cf593187ef873267bab7afaa7a2b309d218e692c7bf1
BLAKE2b-256 checksum
How to use checksums
6101c10010e0f2b0f74169673cc57595142d72409d33ffadd96700ac9a9c0a95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.5.3 CPython/3.10.5

Release files / parsenv-0.3.0-py3-none-any.whl

Download URL parsenv-0.3.0-py3-none-any.whl
Size 2.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e4d6d2941c41474a83171cb9e4a7611cb022b7159eb7c2d011176050bb058728
BLAKE2b-256 checksum
How to use checksums
1780f9a42a3a994a488328b61cb45b67b606c685de2d5c6a171877d5dee65c67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.5.3 CPython/3.10.5

Security for parsenv 0.3.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.

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