Skip to main content

pydantic loader module.

Project description

Code style: black codecov

PyConfig

Configuration management using pydantic and a bit of sugar.

This library provides a load and save functions to load and save serialized pydantic settings. Settings can be saved in .json, .yaml and .toml format.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pydantic_loader, version 0.9.1
Filename, size File type Python version Upload date Hashes
Filename, size pydantic_loader-0.9.1-py3-none-any.whl (6.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pydantic_loader-0.9.1.tar.gz (9.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page