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.1.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.1-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: skirk-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 c3ec74f0433ad6c3c2b7c40d0e5639062fe8752bcec9f3c6679dfa34a1689966
MD5 88e7f8553979381139b2d9e0b1eed1be
BLAKE2b-256 27073b7d286f956686cb2b631d87080784122eee294727bba7768e1f271b0cd9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: skirk-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4a47a7ce5c3695b2eea534c46682c6e72ce67de8366515c76013a6f07c83c567
MD5 b8ea72ba0ed7221cdd26d32e21e97e01
BLAKE2b-256 105e8e6d4484ef19ebb2e9820329eeae5f345cc5b8f0e5fb160a5dcb89ef955a

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