pydanticutils
Pydantic utility helpers
Usage
- Install the package from pypi
> pip install pydanticutils
- Create a pydantic settings class
class DatabaseSettings(BaseModel):
host: str = Field(default="0.0.0.0")
port: int = Field(default=5432)
class AppSettings(BaseSettings):
model_config = SettingsConfigDict(env_prefix="APP_", env_nested_delimiter="__")
log_level: str = Field(default="INFO")
database: DatabaseSettings = Field(default_factory=DatabaseSettings)
- Read a configuration file into the settings class
from pydanticutils import read_yaml
settings = read_yaml("/path/to/config.yaml", AppSettings)
Development
This repository manages the dev environment as a Nix flake and requires Nix to be installed
> nix develop -c $SHELL
> make setup
> make test
Publish Package to PyPi
> make distribution
License
pydanticutils is released under the MIT license
Metadata
Release files for pydanticutils 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pydanticutils-0.0.3.tar.gz | 4.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pydanticutils-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.0 kB
Release files / pydanticutils-0.0.3.tar.gz
| Download URL | pydanticutils-0.0.3.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7cdba917b940d555eca6157c8988fdac5185a6ec1bbb58d11a5e5b79fa3f84b7
|
|
BLAKE2b-256 checksum How to use checksums |
9e4d58506f95317ee045cf4dc9178fe18c6e944061593a4723a3f3bb6fd1f1cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.9
|
Release files / pydanticutils-0.0.3-py3-none-any.whl
| Download URL | pydanticutils-0.0.3-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
13de2540373a42500ea8a889b710da3a3a1250048967b1a048beda9ce7c5f116
|
|
BLAKE2b-256 checksum How to use checksums |
27793e9385cc5b220667b4dc7a4b12ac9877e91491a8862bc86ad3cd80740438
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.9
|