Enviparse
Description
Enviparse let you simply create dataclasses from environment variable.
Supported types are :
- int
- float
- str
- bool
- optional
- list
- enum (with int or string values only)
@attrannotated class@dataclasses.dataclassannotated class
Example
With following environment variables :
DATABASE_CONFIG_USERNAME=postgres
DATABASE_CONFIG_PASSWORD=password
DATABASE_CONFIG_HOST=127.0.0.1
DATABASE_CONFIG_PORT=5432
DATABASE_CONFIG_DATABASE_NAME=appdb
You can parse environment variable with :
import dataclasses
from enviparse import Enviparse
@dataclasses.dataclass
class DatabaseConfig:
username: str
password: str
host: str
port: int
database_name: str
db_config = Enviparse().parse("DATABASE_CONFIG", DatabaseConfig)
print(db_config)
You should get the following result :
DatabaseConfig(username='postgres', password='password', host='127.0.0.1', port=5432, database_name='appdb')
For more example see the test folder.
Metadata
Release files for enviparse 2.0.1
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 |
|---|---|---|---|---|
| enviparse-2.0.1.tar.gz | 14.6 kB | Without provenance | Details for enviparse-2.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| enviparse-2.0.1-py3-none-any.whl | Python 3 | none | any | Details for enviparse-2.0.1-py3-none-any.whl |
Total release size: 20.2 kB
Release files / enviparse-2.0.1.tar.gz
| Download URL | enviparse-2.0.1.tar.gz |
|---|---|
| Size | 14.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dde9ad3411022605215e999ca2bf1282ce366f67287e54234a35562f28cdd0e2
|
|
BLAKE2b-256 checksum How to use checksums |
c0c1d4ce843eb3d2d639ea7176163419e92f467599416672896f85584de76eed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.5
|
Release files / enviparse-2.0.1-py3-none-any.whl
| Download URL | enviparse-2.0.1-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
60343608ff18f87f378aa8e5a9faa1f0d808b9624fe281898489d80f8da08b02
|
|
BLAKE2b-256 checksum How to use checksums |
f217dd61de2837fc027c5fe2464abc4c1924d58a83e780ca0fe31e06599e7dd7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.5
|
Security for enviparse 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.