Skip to main content

Pydantic based application configuration

Project description

pydantic-conf

Overview

pydantic-conf is a Python library for managing application configuration using Pydantic. It supports loading configuration from environment variables and allows for custom startup actions.

Installation

To install the package, use:

pip install pydantic-conf

Usage

Defining Configuration

Create a configuration class by inheriting from EnvAppConfig:

from pydantic_conf.config import EnvAppConfig


class MyConfig(EnvAppConfig):
    app_name: str
    debug: bool = False

Loading Configuration

Load the configuration using the load method:

config = MyConfig.load()
print(config.app_name)
print(config.debug)

Adding Startup Actions

Add startup actions by appending to the STARTUP list:

def startup_action(config):
    print(f"Starting up with {config.app_name}")

MyConfig.STARTUP.append(startup_action)
config = MyConfig.load()

License

This project is licensed under the MIT License.

Project details


Download files

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

Source Distribution

pydantic_conf-1.0.1.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydantic_conf-1.0.1-py2.py3-none-any.whl (4.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pydantic_conf-1.0.1.tar.gz.

File metadata

  • Download URL: pydantic_conf-1.0.1.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.9

File hashes

Hashes for pydantic_conf-1.0.1.tar.gz
Algorithm Hash digest
SHA256 155b4b1fe8fb0a588dd15036f4f6209e3b4849a5dfba8247e2dce6570c5efefd
MD5 ca6d01fc88fd7625e5646f38cb2dcf46
BLAKE2b-256 626fb23fb3a9b69d19aa66c8ff639c178e34478098cea34aec48a68f407b1df6

See more details on using hashes here.

File details

Details for the file pydantic_conf-1.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pydantic_conf-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f659ffd9b335bee024bf76ecce1b537e67a75a416c01a49628799789a93bcd6a
MD5 e2767c8b3a1f00a500daad9c663c408b
BLAKE2b-256 14047fd5b3a44d153bb6e67d10d963ea95c96ad8677498855dbb3c6ac03063c5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page