pydantic loader module.
Project description
from pydantic import BaseSettings
PyConfig
Configuration management using pydantic and a bit of sugar.
This library provides a load and save method for pydantic config settings.
Settings can be saved in .json
and .toml
format. The latter is experimental.
Installation
pip install pydantic_loader
for loading and saving json files.
pip install pydantic_loader[yaml]
for loading and saving yaml and json files.
pip install pydantic_loader[toml]
for loading and saving toml and json.
"""Simple example."""
from pathlib import Path
from pydantic_loader import load_json, save_json
from pydantic import BaseSettings
class DummyConfig(BaseSettings):
"""An app configuration class"""
a: int = 1
b: str = "ABC"
config = DummyConfig()
save_json(config, Path("config.json"))
config = load_json(DummyConfig, Path("config.json"))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pydantic_loader-0.9.0.tar.gz
(9.4 kB
view hashes)
Built Distribution
Close
Hashes for pydantic_loader-0.9.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa4faaa8c3a0cc245983e16b4f1dd29739a23d2decf5f39338f293e6e10a7553 |
|
MD5 | bbec266f97f4d8c96aa8dfb5cb395ef2 |
|
BLAKE2b-256 | b3a53b5ec1852c97704b3d3cda0f38cc995f0a3570027239f1b89819bb1936df |