py-envconfig ⚙️
Managing config data from the environment, inspired by envconfig
Install
pip install py-envconfig
Usage
Set some environment variable, or write a .env file.
HOST=localhost
PORT=6000
MY_APP_SERVICE=bookings
RELEASE_NUMBER=12
ENV=dev
Then specify your config:
from envconfig import param
from envconfig import EnvConfig
class AppConfig(EnvConfig):
"""App env config."""
HOST = param.Str(required=True)
PORT = param.Int(required=True)
PASSWORD = param.Str(override="SECRET_REDIS_PW", required=True)
SERVICE = param.Str(prefix="MY_APP_")
VERSION = param.Int(override="RELEASE_NUMBER")
ENV = param.Str(default="prod")
config = AppConfig()
# Access by class attribute or subscript
config.USER
config["USER"]
Setup flask config:
config = AppConfig()
app.config.from_object(config)
Point to a .env file
config = AppConfig("./.env")
Load Dotenv
Some functionality provided by dotenv
-
Increase verbosity
AppConfig(verbose=True)
-
Override existing env vars with the env vars defined in
.env.AppConfig(override=True)
Development
To publish package and tag git:
make tag
Metadata
Release files for py-envconfig 0.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 |
|---|---|---|---|---|
| py-envconfig-0.7.0.tar.gz | 3.3 kB | Without provenance | Details for py-envconfig-0.7.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| py_envconfig-0.7.0-py3-none-any.whl | Python 3 | none | any | Details for py_envconfig-0.7.0-py3-none-any.whl |
Total release size: 7.3 kB
Release files / py-envconfig-0.7.0.tar.gz
| Download URL | py-envconfig-0.7.0.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
687bc3a127e03f4c7a5ef5b3d9b08e31fe8c98839cbfde2b74d0a93439a54b39
|
|
BLAKE2b-256 checksum How to use checksums |
bb8e2499680347528c86ede4fd437a69b3cb03dbaff53fa1cc06e889e75f83a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.7
|
Release files / py_envconfig-0.7.0-py3-none-any.whl
| Download URL | py_envconfig-0.7.0-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e9207903ca31dfb099b5e4bf9660c843835974d99a63c7e3b132287e734d2425
|
|
BLAKE2b-256 checksum How to use checksums |
6758f5afa7ff79c29003051b84e35d1d1eacdde7415d01df56e16487d591953c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.7
|
Security for py-envconfig 0.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.