Skip to main content

Typed environment variable parsing for Python

Project description

Build Status codecov.io PyPI version Code style: black

typenv

Version 0.0.4

Typed environment variable parsing for Python

Background

Typenv does environment variable parsing with an API almost identical to the excellent environs. There are a few reasons why typenv might be preferred:

  • Type annotated typecast functions: type checkers are able to understand types of parsed environment variables.
  • More flexible prefix manipulation of environment variable names.
  • Validation of environment variable names.
  • Optional automatic uppercasing of environment variable names.
  • Ability to generate a .env.example that shows expected types of environment variables.
  • Less dependencies. No marshmallow required.

Installing

Installing from PyPI repository (https://pypi.org/project/typenv):

pip install typenv

Usage

See environs README.md for now, as the API of typenv is mostly just a subset of environs'.

The types supported by typenv are:

  • env.str
  • env.int
  • env.bool
  • env.float
  • env.decimal
  • env.json
  • env.list
    • Takes a subcast argument for casting list items to one of str, int , bool, float or decimal.Decimal

TODO: Add a more comprehensive API documentation / usage guide here.

Acknowledgments

The public API of this library is almost an exact copy of environs, which is based on envparse and django-environ. Credit for the interface goes to the authors of those libraries.

Project details


Download files

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

Files for typenv, version 0.0.4
Filename, size File type Python version Upload date Hashes
Filename, size typenv-0.0.4.tar.gz (5.3 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page