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': ...}
.env files
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_VAR_1=value1
HOME=/home/other/
# comments are ignored, just as lines without definitions
# mathing quotes (" and ') are stripped
MY_QUOTED="some quoted "
# ${VARNAME} will be replaced by value from env (if available)
MY_VAR_2="${MY_QUOTED}"
# multiline with dangling quotes
MULTI_1="
line1
line2
"
# multiline classic
MULTI_2="line1
line2
line3"
# multiline as one line
MULTI_3="one\ntwo"
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
Metadata
Release files for envbox 2.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| envbox-2.0.1-py3-none-any.whl | Python 3 | none | any | Details for envbox-2.0.1-py3-none-any.whl |
Release files / envbox-2.0.1-py3-none-any.whl
| Download URL | envbox-2.0.1-py3-none-any.whl |
|---|---|
| Size | 10.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d205e208fa0c6fad967c8cd499a40251aaf22bc5e1bfe6ef7d50863aeecde890
|
|
BLAKE2b-256 checksum How to use checksums |
5f23add38be557d20742bde746c13511f3ad9f074657a5614af5f06486f32bf0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.22
|
Security for envbox 2.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.