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.2.tar.gz (16.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.2-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pydantic_conf-1.0.2.tar.gz
Algorithm Hash digest
SHA256 83705db45210e384d34972485734a3d09acd5cb3d733a5790754cf03c0c0af61
MD5 c91100ca519b7f2875d1ce0314c87f84
BLAKE2b-256 20b72ec1ac760f0617381a8eae70f2788e37acf511f6b46bb110d8b468b3d9a0

See more details on using hashes here.

File details

Details for the file pydantic_conf-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for pydantic_conf-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 20c292dc3db8799c4bf17245756eb92e4106d8db00e365f39c1d959cbc39ba64
MD5 760674f33b4ee63aae3b242d867fb279
BLAKE2b-256 0b2d139a78d572456d6bf15015168c089407d7ddfb1a381c4389ca1bce00a3e7

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