Detect environment type and work within.
Project description
https://github.com/idlesign/envbox
Description
Detect environment type and work within.
Features
Environment type detection (extendable system);
Support for .env files;
Convenient os.environ proxying (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': ...}
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.
Documentation
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
envbox-1.1.0.tar.gz
(17.6 kB
view hashes)
Built Distribution
envbox-1.1.0-py2.py3-none-any.whl
(11.5 kB
view hashes)
Close
Hashes for envbox-1.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b160073b7af579c33592227a86c0ba9ba4f386d6a950e6b21cf29a2804493bb4 |
|
MD5 | 4d0aae1587b3df09840c1fbc9268f011 |
|
BLAKE2b-256 | a2a2c2b4aa50e5239d2246e0ae44bca567de263fc7750a3ba0ee02fe550ce300 |