This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Environment variable definition with type

Project Description
# getenv

Environment variable definition with type.

## Install

```bash
pip install getenv
```

## Usage

See `example.py`:

```python
from getenv import Env


app_name = 'FOO'

# Set the prefix for env vars
Env.set_prefix(app_name)

# Define your envs
ENV_PROCESSES = Env('{prefix}_PROCESSES', type=int, default=1)
ENV_DEBUG = Env('{prefix}_DEBUG', type=bool, default=False)
ENV_OPERATOR = Env('{prefix}_OPERATOR', default=None)


def main():
processes = ENV_PROCESSES.get()
debug = ENV_DEBUG.get()
operator = ENV_OPERATOR.get()

print('Run {} processes, debug = {}, operator = {}'.format(processes, debug, operator))
```

Run `example.py` normally:

```bash
$ FOO_PROCESSES=3 python example.py
Run 3 processes, debug = False, operator = None
```

Then with envs:

```bash
$ FOO_PROCESSES=3 FOO_DEBUG=true FOO_OPERATOR=$(whoami) python example.py
Run 3 processes, debug = True, operator = reorx
```
Release History

Release History

This version
History Node

0.1.0

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
getenv-0.1.0-py2-none-any.whl (3.4 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Sep 22, 2016
getenv-0.1.0.tar.gz (2.0 kB) Copy SHA256 Checksum SHA256 Source Sep 22, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting