Skip to main content

Project for making it easier to write configuration files which may be automatically converted into a set of alternative system setups

Project description

CuCo

CuCo (Cute Configuration) is a project for making it easier to write configuration files which may be automatically converted into a set of alternative system setups.

Installation

To install the package, execute the following command:

pip install cuco

Usage

To use the package, first, annotate some of your classes with annotator config_parser according to the following example:

from dataclasses import dataclass
from cuco import config_parser, Config

@config_parser()
@dataclass
class Foo(Config):
    bar: int = 0
    baz: str = None

    name: str = None  # This field contains configuration name, which includes values for alternating configuration fields in a particular setup

Then you would need to create a file with name assets/types/foo.yml for this class with specification of keys which are allowed to set up in this file (the following example demonstrates that field qux from configuration file will be translated into the field bar of the generated objects):

qux: bar

After that you finally can create a file with name assets/foo/default.yml with some value for the configurable fields (the given example demonstrates array consisting of 2 values, which will lead to generation of 2 config objects):

_type: foo

qux:
    - 1
    - 2

The last step is calling method make_configs which will read all the configuration files and decide how they should be parsed, returning the list of generated configuration objects:

from .Foo import Foo

configs = make_configs(
    path = 'assets/foo/default.yml', type_specification_root = 'assets/types'
)

Testing

To run the tests, execute the following command:

python -m unittest discover test

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

cuco-0.9.0.tar.gz (14.0 kB view details)

Uploaded Source

File details

Details for the file cuco-0.9.0.tar.gz.

File metadata

  • Download URL: cuco-0.9.0.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for cuco-0.9.0.tar.gz
Algorithm Hash digest
SHA256 17e6e989dce8f90635377738a61727d7cdfe0bad63e157aea75fd651103ca96b
MD5 e5625584b023f1650e7f3843840e4dd7
BLAKE2b-256 627af686d9050c4a7cf29d4a2dbcbc77e0a5893611eb1e331a14c87223bb96b3

See more details on using hashes here.

Supported by

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