Skip to main content

A lightweight configuration management library that supports loading configurations from multiple sources with type conversion and validation.

Project description

Skirk

A lightweight configuration management library that supports loading configurations from multiple sources with type conversion and validation.

Features

  • Multi-source Configuration Loading: Load configurations from files, command-line arguments, and other sources
  • Type Safety: Provide type conversion and validation to ensure configuration values match expected types
  • Flexible Extension: Customize configuration sources, parsers, and type factories
  • Dataclass Integration: Based on Python dataclasses for simple and intuitive usage
  • Multiple Format Support: Built-in YAML and JSON parsers

Installation

Install with pip:

pip install skirk

Or install with uv:

uv add skirk

Quick Start

from dataclasses import dataclass
from pathlib import Path
from skirk import BaseConfig, FileSource

@dataclass
class AppConfig(BaseConfig):
    host: str
    port: int
    debug: bool = False

# Load configuration from file
config = AppConfig.from_file("config.yaml")

print(config.host)
print(config.port)
print(config.debug)

Custom Config Parser

from skirk import config_parser, BaseConfigParser

@config_parser(suffix="custom")
class CustomParser(BaseConfigParser):
    @classmethod
    def parse(cls, f):
        ...

    @classmethod
    def dump(cls, f):
        # support for dump config to custom format config file
        ...

Custom Type Support

from skirk import type_factory
from datetime import datetime

@type_factory
def datetime_factory(value: str) -> datetime:
    return datetime.fromisoformat(value)

class DateConfig(BaseConfig):
    launch_date: datetime

Contact

For any questions or suggestions, please contact kujou-kazuya@outlook.com

© 2025 Kujou Kazuya

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

skirk-0.1.1a1.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

skirk-0.1.1a1-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file skirk-0.1.1a1.tar.gz.

File metadata

  • Download URL: skirk-0.1.1a1.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.2

File hashes

Hashes for skirk-0.1.1a1.tar.gz
Algorithm Hash digest
SHA256 9468c3096c67aba8c4d5cbf9f195af4277442bbfc3fdececa99ad01f1b592228
MD5 c32ef8c05c27bf493b25df0ac916b6b2
BLAKE2b-256 2717df86e50d416f0fe321b7d32bc21f25b529892d0ee0ee1142e3b32b2e9eec

See more details on using hashes here.

File details

Details for the file skirk-0.1.1a1-py3-none-any.whl.

File metadata

  • Download URL: skirk-0.1.1a1-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.2

File hashes

Hashes for skirk-0.1.1a1-py3-none-any.whl
Algorithm Hash digest
SHA256 8e7f9bfe7b1e0549eda5adc443f5d130ab7c24bda39f3891b266f6bd2d4e81f1
MD5 d3a6950f0ed279b978f1a5cf0e969fa4
BLAKE2b-256 8a8ad641456e1ce3357666c121690cb920c2efc9cac3f6e8a29baf4ff90b3d9d

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