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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pydanticutils-0.0.3.tar.gz
(4.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pydanticutils-0.0.3.tar.gz.
File metadata
- Download URL: pydanticutils-0.0.3.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cdba917b940d555eca6157c8988fdac5185a6ec1bbb58d11a5e5b79fa3f84b7
|
|
| MD5 |
29ada23aa29646833ce973817808d1ce
|
|
| BLAKE2b-256 |
9e4d58506f95317ee045cf4dc9178fe18c6e944061593a4723a3f3bb6fd1f1cc
|
File details
Details for the file pydanticutils-0.0.3-py3-none-any.whl.
File metadata
- Download URL: pydanticutils-0.0.3-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13de2540373a42500ea8a889b710da3a3a1250048967b1a048beda9ce7c5f116
|
|
| MD5 |
685819bf05a19dbee6dc8e2ba66b3d65
|
|
| BLAKE2b-256 |
27793e9385cc5b220667b4dc7a4b12ac9877e91491a8862bc86ad3cd80740438
|