Skip to main content

airyconf

Lightweight configuration manager

Inspired by zifeo/dataconf, implemented with no required dependencies for Python 3.6+ (except Python 3.6 requires dataclasses package to support the corresponding functionality). Supports typing, dataclasses and custom classes:

from typing import List
from dataclasses import dataclass
from airyconf import parse


class CustomObject(object):
    def __init__(self, a: float):
        self.a = a
    
    def __eq__(self, other):
        return isinstance(other, CustomObject) and other.a == self.a

@dataclass
class SomeDataclass:
    b: str
    c: List[CustomObject]

json_config = '{"SomeDataclass": {"b": "str", "c": [{"a": 1.0}, {"a": 2.0}]}}'

expected = SomeDataclass('str', [CustomObject(1.), CustomObject(2.)])

assert parse(json_config, SomeDataclass) == expected

Optionally, supports yaml if installed:

from airyconf import parse_config
parse_config('file/to/config.yaml', SomeDataclass)

Thanks to rossmacarthur/typing-compat by Ross MacArthur, typing is supported for Python 3.6+ (the single-file package is copied to avoid dependencies).

Package is under development. TODO:

  • Add documentation
  • Github actions: tests & coverage & package update
  • Multiple typing arguments (Tuple[int, CustomClass, str])
  • Nested typing arguments (List[Dict[str, List[int]]])
  • Specify classes in config (a: SomeCustomClass({param: 1}))

Download files

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

Source Distribution

airyconf-0.0.1.1.tar.gz (7.6 kB view details)

Uploaded Source

File details

Details for the file airyconf-0.0.1.1.tar.gz.

File metadata

  • Download URL: airyconf-0.0.1.1.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.3

File hashes

Hashes for airyconf-0.0.1.1.tar.gz
Algorithm Hash digest
SHA256 4f471a3786369b8d85948f84a5913a3f6a61ff6b4e8d44f1caf50ac951b1c23e
MD5 61325483ef8dbedfc91f3b181abe5a6f
BLAKE2b-256 5257cf39495b6208264a12efefd937e32016316ac2dff820f45b63101136ee13

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.1.1 This release

1 file

0.0.1

1 file

Supported by

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