Skip to main content

No project description provided

Project description

speckenv because a speck is a synonym for a dot and because Speck is awesome.

Usage

Read the settings contained in ./.env into os.environ:

from speckenv import read_speckenv

read_speckenv()

Note that read_speckenv uses os.environ.setdefault to set new values, which means that if a particular key exists more than once in the file the first value is retained, not the last.

If the file is named differently or resides in a different path, pass the full path as first argument to read_speckenv.

Read individual values:

from speckenv import env

SETTING1 = env('SETTING1')
SETTING2 = env('SETTING2', default='bla')
SETTING3 = env('SETTING3 ', required=True)  # Fail hard if missing.

The following values are evaluated as Python literals:

BOOL=True  # And False, None etc.
NUMBER=42
SWEET_HOME=['localhost', '127.0.0.1']

Additional whitespace around the equals sign is supported. Empty lines and lines starting with a # are ignored.

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

speckenv-1.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

speckenv-1.0-py2.py3-none-any.whl (3.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file speckenv-1.0.tar.gz.

File metadata

  • Download URL: speckenv-1.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for speckenv-1.0.tar.gz
Algorithm Hash digest
SHA256 ea20234dba889a7bd258ba27706c0737395e3865c38b9a2a6cff55260497dabb
MD5 fcbb47accbb38a4e8b30382720128ec9
BLAKE2b-256 d179b571521b5d2e3fdb37d29a1a7e2408ece5c8802d30703080a57f086b0ac1

See more details on using hashes here.

File details

Details for the file speckenv-1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for speckenv-1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 eccd32b44773344b732b91a10f494fb219e0aa0a8ba3b57ca1e041ce326cf215
MD5 03bd7ba43bffff2bd855c2519a0205fb
BLAKE2b-256 5a26c09de4ad03797b13e4a1ae90598f046ff61b82841745ca8e385a2f6e3604

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