Skip to main content

Enva

Making working with environment variables in Python slightly better.

Ever needed to get an environment variable as an integer or a boolean? Ever needed to assert that an environment variable is set? Stop looking at the standard library. It can't help you. enva can.

enva provides utility functionality for working with environment variables in Python. There are two main features:

  • Variable retrieval (as alternative types, e.g. int)
  • Variable assertion (e.g. is the variable set)

Sponsor

This project is sponsored by Documatic, the search engine for your codebase.

Getting started

Requirements

  • Python 3.10 or greater
  • That's it

Install enva from pypi with

pip install enva

Updates

Please refer to the changelog for a full breakdown of recent updates.

Examples

Converting env vars

import os
from enva.getters import get_env_int

os.environ["SOME_VAR"] = "10"

print(get_env_int("SOME_VAR"))  # 10 (as an int)

Verifying env var types

import os
from enva.checkers import require_variable_as_type

os.environ["SOME_VAR"] = "10"
os.environ["ANOTHER_VAR"] = "ten"

print(require_variable_as_type("SOME_VAR", float))  # No throw
print(require_variable_as_type("ANOTHER_VAR", float))  # Will raise

Developers

Code quality

  • black formatting
  • isort imports
  • mypy compliance

Testing

Unit tests are run with pytest. Please ensure that new features and bug fixes have an appropriate test. There is a github action to ensure tests pass with sufficient coverage.

Contributing

All contributions are welcome! Please see the contributing guide to get started.

License

GPL-3. Please read the license for full terms.

Metadata

Release files for enva 0.1.0

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

Source distribution (sdist)

Source distribution for enva 0.1.0
File Size Uploaded
enva-0.1.0.tar.gz 15.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for enva 0.1.0
File Interpreter ABI Platform
enva-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 31.3 kB

Release files / enva-0.1.0.tar.gz

Download URL enva-0.1.0.tar.gz
Size 15.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f201fa65bc773e9d11e17ba1e26383c0e384ee88ad69e955ddbbec6fbdce91d6
BLAKE2b-256 checksum
How to use checksums
af299559f7208ca605eb1cfad1cd7fe5ae0f132ef99645b9e7b35a90b9238c9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Release files / enva-0.1.0-py3-none-any.whl

Download URL enva-0.1.0-py3-none-any.whl
Size 15.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
246838a4d6c5b1e0d8a988c9d972680cf563196c430e4cf3a204a7a7b74f625d
BLAKE2b-256 checksum
How to use checksums
ce4b4159ef6c9d4c1d2289344f86ca8849a0dabf810ff2750d3972ebc1b8be32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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