Skip to main content

Enviously elegant environment variable parsing

Project description

Parsenvy is an enviously elegant environment variable parsing Python library.

Environment variables are strings by default. This can be rather inconvenient if you’re dealing with a number of them, and in a variety of desired types. Parsenvy aims to provide an intuitive, explicit interface for retrieving these values in appropriate types with human-friendly syntax.

https://travis-ci.org/nkantar/Parsenvy.svg?branch=master https://ci.appveyor.com/api/projects/status/ypywtakntwsf6l00/branch/master?svg=true https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg

Features

  • Compatible with Python 3.6+ only (the last Python 2 compatible version was 1.0.2)

  • Fully tested on Linux and Windows

  • No dependencies aside from Python’s core builtins, os, and typing modules

  • BSD (3-Clause) licensed

Examples

>>> import parsenvy
>>> parsenvy.bool('BOOL_ENV_VAR')  # BOOL_ENV_VAR=True
True
>>> parsenvy.int('INT_ENV_VAR')  # INT_ENV_VAR=13
13
>>> parsenvy.float('FLOAT_ENV_VAR')  # FLOAT_ENV_VAR=555.55
555.55
>>> parsenvy.list('LIST_ENV_VAR')  # LIST_ENV_VAR=shiver,me,timbers
['shiver', 'me', 'timbers']
>>> parsenvy.tuple('TUPLE_ENV_VAR')  # TUPLE_ENV_VAR=hello,world
('hello', 'world')
>>> parsenvy.str('STR_ENV_VAR')  # STR_ENV_VAR=meep
'meep'
>>> parsenvy.set('SET_ENV_VAR')  # SET_ENV_VAR=wat,wut,wot
set(['wat', 'wut', 'wot'])

# Note: Version 3 will deprecate parsenvy.dict().
>>> parsenvy.dict('DICT_ENV_VAR')  # DICT_ENV_VAR=a:1,b:2
{'a': '1', 'b': '2'}

Install

pip install parsenvy

Contributing

Contributions of all sorts are welcome, be they bug reports, patches, or even just feedback. Creating a new issue or pull request is probably the best way to get started.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

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

Parsenvy-2.1.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

Parsenvy-2.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file Parsenvy-2.1.0.tar.gz.

File metadata

  • Download URL: Parsenvy-2.1.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for Parsenvy-2.1.0.tar.gz
Algorithm Hash digest
SHA256 78f313b3e57c17bf861b3b02bd06174d4a0546064c3621c8e88d3df5805eb413
MD5 8e90611cb33196693d6ba3f768772a9f
BLAKE2b-256 a15dc724e18d9e328c06a55d550ff206701c7ed8ce12dc6f80b69aca789cffb0

See more details on using hashes here.

File details

Details for the file Parsenvy-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: Parsenvy-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for Parsenvy-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e62a808197d0c9d26883a47222ce4a067859da5be6f61fc434de48d2403bf4e
MD5 4c147298d88a95a4772de18c78996413
BLAKE2b-256 88e760fa896cb4b4ad5bfb3d8ba605b045c24aec435cabc7c80a53af3ebe490e

See more details on using hashes here.

Supported by

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