Skip to main content

Typed environment variable parsing for Python

Project description

Build Status codecov.io PyPI version Code style: black

typenv

Version 0.1.1

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.

Source Distribution

typenv-0.1.1.tar.gz (6.2 kB view hashes)

Uploaded Source

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