environconfig
environconfig allows you to use environment variables in Python with a declarative syntax.
A quick example:
from environconfig import EnvironConfig
from environconfig import StringVar, IntVar
class DBCfg(EnvironConfig):
"""Database configuration from the environment."""
HOSTNAME = StringVar(default='localhost')
PORT = IntVar(default=3306)
USERNAME = StringVar()
PASSWORD = StringVar()
CHARSET = StringVar(default='utf8mb4')
NAME = StringVar(default='mydatabase')
# Now you can start using it
connection = pymysql.connect(host=DBCfg.HOSTNAME,
user=DBCfg.USERNAME,
password=DBCfg.PASSWORD,
db=DBCfg.NAME,
charset=DBCfg.CHARSET,
cursorclass=pymysql.cursors.DictCursor)
You can check more examples in the examples directory.
Features
Built-in basic types: String, Bool, Int, Float…
Easy Customizable: CustomVar (just pass a callable to make the conversion)
No mocking necessary for testing: Just instantiate your config with a dictionary.
Easy build complex constructions with environment data: See MethodVar
Collaboration
We are always open to pull requests and accept new var types.
Metadata
Release files for environconfig 1.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| environconfig-1.7.0.tar.gz | 4.2 kB | Without provenance | Details for environconfig-1.7.0.tar.gz |
Release files / environconfig-1.7.0.tar.gz
| Download URL | environconfig-1.7.0.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
06c50d8a3a7e73404276ee5b47539f41d5490409edeba64c40ed748d2daeea20
|
|
BLAKE2b-256 checksum How to use checksums |
bdda311afb542162536d4cf19a0e85a5e9eb462f4a8f1dc898fefe9b5524fd8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for environconfig 1.7.0
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.