envbox
https://github.com/idlesign/envbox
Description
Detect environment type and work within.
Features
- Environment type detection (extendable system);
- Support for
.envfiles; - Convenient
os.environproxying (with optional values casting into Python natives); - Automatic submodule-for-environment import tool;
- Cosy per-thread settings container with environment var support;
- CLI for environment probing.
Code sample
from envbox import get_environment
# Detect current environment type
# and get its object.
#
# Default detection sources:
# 1. ``PYTHON_ENV`` env variable
# 2. ``environment`` file contents
#
# By default this function will also try to read env variables from .env files.
env = get_environment()
env.name
# >> development
env.is_production
# >> False
env.get('HOME')
# The same as env['HOME'] and env.HOME
# >> /home/idle/
env.getmany('PYTHON')
# {'UNBUFFERED': '1', 'IOENCODING': 'UTF-8', 'PATH': ...}Now you may want to put your environment vars into .env files
(e.g.: .env, .env.development .env.production)
to be read by envbox:
MY_VAR1 = value1 HOME = /home/other/
Read the docs for more examples.
CLI
$ envbox probe
# >> Detected environment type: development (Development)
$ envbox show
# >> [...]
# >> SHELL = /bin/bash
# >> [...]Note: envbox CLI requires click package available.

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
