Pydantic AWS AppConfig
Ever wanted to use AWS AppConfig for your Python app, but can’t bear configs without pydantic?
Well, your days of using evil .env or .ini files, ENVIRONMENT variables or even custom providers is over!
With just a simple
pip install pydantic-appconfig
With a lot of inspiration from this AWS sample.
Introducing pydantic_appconfig.
Set yourself up with your favourite pydantic.BaseModel:
class MyAppConfig(pydantic.BaseModel): """My app config.""" test_field_string: str test_field_int: int class Config: """The pydantic config, including title for the JSON schema.""" title = "MyAppConfig"Set up the config helper using your shiny config class:
from pydantic_appconfig import AppConfigHelper my_config: AppConfigHelper[MyAppConfig] = AppConfigHelper( appconfig_application="AppConfig-App", appconfig_environment="AppConfig-Env", appconfig_profile="AppConfig-Profile", max_config_age=15, fetch_on_init=True, config_schema_model=MyAppConfig, )Use it:
my_val = my_config.config.test_field_string
AWS AppConfig also has support for validators.
Pydantic is able to generate a JSON schema for you to upload:
print(MyAppConfig.schema_json(indent=2)){ "title": "MyAppConfig", "description": "My app config.", "type": "object", "properties": { "test_field_string": { "title": "Test Field String", "type": "string" }, "test_field_int": { "title": "Test Field Int", "type": "integer" } }, "required": [ "test_field_string", "test_field_int" ] }
Metadata
Release files for pydantic-appconfig 2.0.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 | |
|---|---|---|---|---|
| pydantic_appconfig-2.0.0.tar.gz | 8.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pydantic_appconfig-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.8 kB
Release files / pydantic_appconfig-2.0.0.tar.gz
| Download URL | pydantic_appconfig-2.0.0.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b2df25431698f27672529f49c2bfd40b1ad73cc7022dc2280525b749dd2029ce
|
|
BLAKE2b-256 checksum How to use checksums |
d682fcfc83f3703a1947fb478957ca1bd480d2ac0656e0e2a39c3cc7ba5ed589
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.10.2 Linux/5.15.0-1041-azure
|
Release files / pydantic_appconfig-2.0.0-py3-none-any.whl
| Download URL | pydantic_appconfig-2.0.0-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ccfadece32d0ed5f20665b900c52b4ae23633047d758054d9788db0422af3bed
|
|
BLAKE2b-256 checksum How to use checksums |
323929504e852062de70fdd11dbc54fdde89ff67260faf03fc0421e44841f377
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.10.2 Linux/5.15.0-1041-azure
|
Security for pydantic-appconfig 2.0.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.