Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

python-envtools

https://travis-ci.org/pedroburon/python-envtools.svg?branch=master https://coveralls.io/repos/github/pedroburon/python-envtools/badge.svg?branch=master

Useful environment toolchain for python

override_environment

Context Processor that overrides environment vars.

>>> @override_environment(DEBUG=False, FOO="Bar")
>>> def foo():
>>>     print(os.getenv("FOO"))
>>>     return os.getenv("DEBUG")
>>> foo()
FOO
"DEBUG"
>>> with override_environment(DEBUG="False", FOO="Bar"):
>>>     print(os.getenv("FOO"))
>>>     os.getenv("DEBUG")
FOO
"DEBUG"

configure_logging

Wrap a configDict inside configure_logging, then logging level could be controlled by environment variables

LOGGING = configure_logging({
    "loggers": {
        "module": {
            "handlers": ["console"],
            "level": "INFO",
        },
    }
})

For this example, environment variable must be set as LOGGING_LEVEL_module=DEBUG.

get_env

Similar to os.getenv() but evaluates string content (default) into simple python types.

>>> os.environ['FOO'] = "1"
>>> os.getenv('FOO')
"1"
>>> get_env('FOO')
1

>>> os.environ['FOO'] = "bar"
>>> get_env('FOO')
"bar"

>>> os.environ['FOO'] = "True"
>>> os.getenv('FOO')
"True"
>>> get_env('FOO')
True

>>> os.environ['FOO'] = "[1,2,3]"
>>> os.getenv('FOO')
"[1,2,3]"
>>> get_env('FOO')
[1, 2, 3]

it works for list, tuples, dictionaries, numbers, booleans and strings. And is safe!

Metadata

Release files for python-envtools 0.0.1rc1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-envtools 0.0.1rc1
File Size Uploaded Provenance
python-envtools-0.0.1rc1.tar.gz 5.5 kB Without provenance Details

Release files / python-envtools-0.0.1rc1.tar.gz

Download URL python-envtools-0.0.1rc1.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
542043415dece01bace1d626bae7e512b227548454ffb2e794976d835814cab5
BLAKE2b-256 checksum
How to use checksums
650aab7a5a44dca60669859f74cf5c68ccb8bbd2d3b5ed90d738f825046d881e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for python-envtools 0.0.1rc1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page