Skip to main content

No project description provided

Project description

Env parser

Use pip install parsenv

Example

import env

assert env.get("TOKEN") == "abc123"
assert env.get("X", False) is False
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

try:
    env.get("X")
except KeyError as e:
    assert str(e) == "Environment variable `X` not set"

try:
    env.get_ints("BAD_NUMS")
except ValueError as e:
    assert (
            str(e) == "Can't parse environment variable `BAD_NUMS`: "
                      "invalid literal for int() with base 10: 'a'"
    )

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

parsenv-0.1.3.tar.gz (1.9 kB view details)

Uploaded Source

Built Distribution

parsenv-0.1.3-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

Details for the file parsenv-0.1.3.tar.gz.

File metadata

  • Download URL: parsenv-0.1.3.tar.gz
  • Upload date:
  • Size: 1.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.4.9 CPython/3.10.5

File hashes

Hashes for parsenv-0.1.3.tar.gz
Algorithm Hash digest
SHA256 0da77e8e0e4947da33914af537f2b435f0cda22a6d6ce967e59451d7bfa5248d
MD5 8d62108137680f1587390cc24f32c19e
BLAKE2b-256 9f0528a03171c06778042055ccfa9ed4d075e27602fb420d94cba8c46cc5daa5

See more details on using hashes here.

File details

Details for the file parsenv-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: parsenv-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 2.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.4.9 CPython/3.10.5

File hashes

Hashes for parsenv-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0b16297030e40dab9b19eaabc7035f9b2430d25cf2a97f967d99bb06c1a74668
MD5 2ecf72f40e24cc9da80ba87fa1a07254
BLAKE2b-256 e44cbcd655dbc0ac59104ac13f17de6753f5793b9211120a415ae334ffa8b7ad

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page