Skip to main content

FOSSA Status codecov

confizzo

confizzo is a configuration management library. It is designed to contain many versions of configuration managed approaches into a single API.

Multi-file Configurations

Multifile configurations, in confizzo terms, are configurations which are partitioned into multiple files. One assumption is that when one configuration contains configuration information of another entity, that that configuration is then stored in a separate configuration file and referenced by type corresponds to filename and the name of the configuration in the file.

Specifications

Here the configuration is parsed into one or more files. When a configuration has a dependency on another object - via composition - the configuration for such objects will be stored in separate files. ALl objects of similar type - save the entry point objects, will be stored in files denoted by name the kind of class (via vase class) for which they will configure. In the 'main.yml' - the entrypoint configuration - the configurations will be

object:
  type: class_type
  conf: SOME CONFIGURATION DICTIONARY
  _dependencies_:
    - List of dependency descriptions

The list of dependency descriptions will have objects as follows

  var_name: NAME OF THE VARIABLE (COMPOSED OBJECT) THIS CONFIGURATION WILL BELONG TO
  name: NAME OF CONFIGURATION FROM THE CONF_TYPE LOCATION
  conf_type: IDENTIFIES THE KIND OF CONFIGURATION - WHERE THEY WILL BE STORED.

The _dependencies_ section is used to

  1. Help populate the configuration repository
  2. Used to identify the references to the Class that can be dynamically injected and to reference the right configuration

The pattern aimed to be used here is to

  1. Create an object from it's configuration (non-injectable objects)
  2. From _dependencies_ find the Class that will be constructed and the name (as a passable conf value) of the key used to reference that objects configuration.

Examples

Assume that we have an application called data_mover. Then for this application, running in local mode, the configuration will be stored at .data_mover at the $HOME path.

main.yml

version: 1

system_1:
  type: ClassA
  conf:
    param_1: something
    param_2: other
  _dependencies_:
    - var_name: db_conn
      name: dev_pg
      conf_type: database

database.yaml

version: 1

dev_pg:
  obj_type: PostgresDB
  user: user
  password: password
  host: 10.0.0.7
  database: root

The usage patter would be something like this: main.py

from providah.factories.package_factory import PackageFactory
from confizzo.multifile.config_manager import ConfigManager
from confizzo.multifile.parser import Parser

def main():
    ConfigManager.config_root = '~/.data_mover/config.yml'
    
    conf_key = 'ClassA' 
    config = Parser.get(conf_key)
    obj_type = config.pop('type')

    system_1 = PackageFactory.create(key=obj_type, **{'conf_key': conf_key})
    system_1.run()

system_1.py

from providah.factories.package_factory import PackageFactory
from confizzo.multifile.parser import Parser


class System1:
    def __init__(self, conf_key: str):
        self.__config = Parser.get(conf_key)
        
        dependencies = self.__config['_dependencies_']
        conf_for_db_conn_ref = [dep for dep in dependencies if dep['var_name'] == 'db_conn']
        self.__db_conn = PackageFactory.create(key=Parser.get(conf_for_db_conn_ref['type']), 
                                               **{'conf_key': conf_for_db_conn_ref['name']})

    def run(self):
        self.__db_conn.execute('SELECT 1')

postgres_db.py

from confizzo.multifile.parser import Parser


class PostgresDB:
    
    def __init__(self, conf_key: str):
        # Configuration contains secrets, so we don't want to expose this except when executing a query.
        self.__config_name = conf_key 

    def execute(self, query: str) -> None:
        conf = Parser.get(self.__config_name)['conf']
        conn = self.__get_connection(conf)

        conn.cursor.execute(query)
        conn.close()

    def __get_connection(self, conf: str) -> Connection:
        pass

TODO

There are a number of feature that could be added

  1. Simpler reference of dependencies from configuration using library and avoiding bespoke solution and
  2. Additional filtering when referencing configurations
  3. Additional configuration that ties to providah package (maybe)

Metadata

Release files for confizzo 0.1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for confizzo 0.1.1.0
File Size Uploaded Provenance Actions
confizzo-0.1.1.0.tar.gz 5.9 kB Without provenance Details for confizzo-0.1.1.0.tar.gz

Release files / confizzo-0.1.1.0.tar.gz

Download URL confizzo-0.1.1.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5ae7612bf6f29fd101c6d2cf76e302fee3b6df981742cb4af58deb65643f73d4
BLAKE2b-256 checksum
How to use checksums
c3256bac683101b30a012195854e1b0b2a2b6c10472f959982fe70720f7f1175
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.7

Security for confizzo 0.1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page