the_conf


Namethe_conf JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/jaesivsm/the_conf
SummaryConfig build from multiple sources
upload_time2024-12-05 18:27:29
maintainerNone
docs_urlNone
authorFrançois Schmidts
requires_python>=3.9
licenseGPLv3
keywords conf configuration json yaml
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            [![Build Status](https://travis-ci.org/jaesivsm/the_conf.svg?branch=master)](https://travis-ci.org/jaesivsm/the_conf) [![Coverage Status](https://coveralls.io/repos/github/jaesivsm/the_conf/badge.svg?branch=master)](https://coveralls.io/github/jaesivsm/the_conf?branch=master)

From [this](http://sametmax.com/les-plus-grosses-roues-du-monde/)

    Une bonne lib de conf doit:

    * Offrir une API standardisée pour définir les paramètres qu’attend son programme sous la forme d’un schéma de données.
    * Permettre de générer depuis ce schéma les outils de parsing de la ligne de commande et des variables d’env.
    * Permettre de générer depuis ce schéma des validateurs pour ces schémas.
    * Permettre de générer des API pour modifier la conf.
    * Permettre de générer des UIs pour modifier la conf.
    * Séparer la notion de configuration du programme des paramètres utilisateurs.
    * Pouvoir marquer des settings en lecture seule, ou des permissions sur les settings.
    * Notifier le reste du code (ou des services) qu’une valeur à été modifiée. Dispatching, quand tu nous tiens…
    * Charger les settings depuis une source compatible (bdd, fichier, api, service, etc).
    * Permettre une hiérarchie de confs, avec une conf principale, des enfants, des enfants d’enfants, etc. et la récupération de la valeur qui cascade le long de cette hiérarchie. Un code doit pouvoir plugger sa conf dans une branche de l’arbre à la volée.
    * Fournir un service de settings pour les architectures distribuées.
    * Etre quand même utile et facile pour les tous petits scripts.
    * Auto documentation des settings.


Beforehand: for more clarity ```the_conf``` will designate the current program, its configuration will be referred to as the _meta conf_ and the configurations it will absorb (files / cmd line / environ) simply as the _configurations_.

# 1. read the _meta conf_

```the_conf``` should provide a singleton.
On instantiation the singleton would read the _meta conf_ (its configuration) from a file. YML and JSON will be considered first. This file will provide names, types, default values and if needed validator for options.

```the_conf``` will the validate the conf file. For each config value :
 * if value has _choices_ and _default value_, _default value_ has to be among _choices_.
 * if the value is nested, a node can't hold anything else than values
 * _required_ values can't have default

# 2. read the _configurations_

Once the _meta conf_ has been processed, ```the_conf``` will assemble all values at its reach from several sources.
Three types are to be considered:
 * files (again YML/JSON but maybe also later ini)
 * command line
 * environ
in this order of importance. This order must be itself overridable. ```the_conf``` must provide a backend for values from the configuration to be reached.

```python
the_conf.load('path/to/meta/conf.yml')
the_conf.nested.value
> 1
```

Upon reading _configurations_, ```the_conf``` will validate gathered values.
 * _configurations_ file type will be guessed from file extention (yaml / yml, json, ini), anything else must raise an error. Parsing errors won't also be silenced. Although, missing won't be an issue as long as all required values are gathered.
 * values must be in the type there declared in or cast to it without error
 * required values must be provided
 * if a value is configured with _choices_, the gathered value must be in _choices_

The first writable, readable available _configuration_ file found will be set as the main. Values will be edited on it but values from it will still be overridden according to the priorities. A warning should be issued if the main _configuration_ is overriddable.
If no suitable file is found, a warning should also be issued ; edition will be impossible and will generate an error.

# 3. generate the _configurations_

Provide an API to list and validate values needed from the _configurations_ (the required ones).
Provide a command line UI to process that list to let a user generate a _configuration_ file.

# 4. write the _configurations_

Depending on the permissions set in the _meta conf_, ```the_conf``` must allow to edit the values in the configuration file set as _main_ on read phase.
If editing a value which will be ignored for being overriden, a warning must be issued.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/jaesivsm/the_conf",
    "name": "the_conf",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "conf, configuration, json, yaml",
    "author": "Fran\u00e7ois Schmidts",
    "author_email": "francois@schmidts.fr",
    "download_url": "https://files.pythonhosted.org/packages/bb/5c/d639b089358d57ab93c7d7ed6c828cc73b59e2bc07d6c5fe30276745c073/the_conf-1.0.0.tar.gz",
    "platform": null,
    "description": "[![Build Status](https://travis-ci.org/jaesivsm/the_conf.svg?branch=master)](https://travis-ci.org/jaesivsm/the_conf) [![Coverage Status](https://coveralls.io/repos/github/jaesivsm/the_conf/badge.svg?branch=master)](https://coveralls.io/github/jaesivsm/the_conf?branch=master)\n\nFrom [this](http://sametmax.com/les-plus-grosses-roues-du-monde/)\n\n    Une bonne lib de conf doit:\n\n    * Offrir une API standardis\u00e9e pour d\u00e9finir les param\u00e8tres qu\u2019attend son programme sous la forme d\u2019un sch\u00e9ma de donn\u00e9es.\n    * Permettre de g\u00e9n\u00e9rer depuis ce sch\u00e9ma les outils de parsing de la ligne de commande et des variables d\u2019env.\n    * Permettre de g\u00e9n\u00e9rer depuis ce sch\u00e9ma des validateurs pour ces sch\u00e9mas.\n    * Permettre de g\u00e9n\u00e9rer des API pour modifier la conf.\n    * Permettre de g\u00e9n\u00e9rer des UIs pour modifier la conf.\n    * S\u00e9parer la notion de configuration du programme des param\u00e8tres utilisateurs.\n    * Pouvoir marquer des settings en lecture seule, ou des permissions sur les settings.\n    * Notifier le reste du code (ou des services) qu\u2019une valeur \u00e0 \u00e9t\u00e9 modifi\u00e9e. Dispatching, quand tu nous tiens\u2026\n    * Charger les settings depuis une source compatible (bdd, fichier, api, service, etc).\n    * Permettre une hi\u00e9rarchie de confs, avec une conf principale, des enfants, des enfants d\u2019enfants, etc. et la r\u00e9cup\u00e9ration de la valeur qui cascade le long de cette hi\u00e9rarchie. Un code doit pouvoir plugger sa conf dans une branche de l\u2019arbre \u00e0 la vol\u00e9e.\n    * Fournir un service de settings pour les architectures distribu\u00e9es.\n    * Etre quand m\u00eame utile et facile pour les tous petits scripts.\n    * Auto documentation des settings.\n\n\nBeforehand: for more clarity ```the_conf``` will designate the current program, its configuration will be referred to as the _meta conf_ and the configurations it will absorb (files / cmd line / environ) simply as the _configurations_.\n\n# 1. read the _meta conf_\n\n```the_conf``` should provide a singleton.\nOn instantiation the singleton would read the _meta conf_ (its configuration) from a file. YML and JSON will be considered first. This file will provide names, types, default values and if needed validator for options.\n\n```the_conf``` will the validate the conf file. For each config value :\n * if value has _choices_ and _default value_, _default value_ has to be among _choices_.\n * if the value is nested, a node can't hold anything else than values\n * _required_ values can't have default\n\n# 2. read the _configurations_\n\nOnce the _meta conf_ has been processed, ```the_conf``` will assemble all values at its reach from several sources.\nThree types are to be considered:\n * files (again YML/JSON but maybe also later ini)\n * command line\n * environ\nin this order of importance. This order must be itself overridable. ```the_conf``` must provide a backend for values from the configuration to be reached.\n\n```python\nthe_conf.load('path/to/meta/conf.yml')\nthe_conf.nested.value\n> 1\n```\n\nUpon reading _configurations_, ```the_conf``` will validate gathered values.\n * _configurations_ file type will be guessed from file extention (yaml / yml, json, ini), anything else must raise an error. Parsing errors won't also be silenced. Although, missing won't be an issue as long as all required values are gathered.\n * values must be in the type there declared in or cast to it without error\n * required values must be provided\n * if a value is configured with _choices_, the gathered value must be in _choices_\n\nThe first writable, readable available _configuration_ file found will be set as the main. Values will be edited on it but values from it will still be overridden according to the priorities. A warning should be issued if the main _configuration_ is overriddable.\nIf no suitable file is found, a warning should also be issued ; edition will be impossible and will generate an error.\n\n# 3. generate the _configurations_\n\nProvide an API to list and validate values needed from the _configurations_ (the required ones).\nProvide a command line UI to process that list to let a user generate a _configuration_ file.\n\n# 4. write the _configurations_\n\nDepending on the permissions set in the _meta conf_, ```the_conf``` must allow to edit the values in the configuration file set as _main_ on read phase.\nIf editing a value which will be ignored for being overriden, a warning must be issued.\n",
    "bugtrack_url": null,
    "license": "GPLv3",
    "summary": "Config build from multiple sources",
    "version": "1.0.0",
    "project_urls": {
        "Documentation": "https://github.com/jaesivsm/the_conf#readme",
        "Homepage": "https://github.com/jaesivsm/the_conf",
        "Repository": "https://github.com/jaesivsm/the_conf"
    },
    "split_keywords": [
        "conf",
        " configuration",
        " json",
        " yaml"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d19164134467f7f0dc6897f7462a7eb98389bd2c13256fedd05b13e5ecaddb33",
                "md5": "5c5e440dd68d612f55b36f59dde2119f",
                "sha256": "86a5dad853494b63c9d01299615d8ac0f4a8d5e7e381aa8acec38113bb0f0e2a"
            },
            "downloads": -1,
            "filename": "the_conf-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5c5e440dd68d612f55b36f59dde2119f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 21458,
            "upload_time": "2024-12-05T18:27:28",
            "upload_time_iso_8601": "2024-12-05T18:27:28.670704Z",
            "url": "https://files.pythonhosted.org/packages/d1/91/64134467f7f0dc6897f7462a7eb98389bd2c13256fedd05b13e5ecaddb33/the_conf-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bb5cd639b089358d57ab93c7d7ed6c828cc73b59e2bc07d6c5fe30276745c073",
                "md5": "90d40e7aeaf7caca567a3982c9867478",
                "sha256": "68101370b7e4d0ffb84998d864c0e95fa00a8fe7ac410f858890219aa6b24f5f"
            },
            "downloads": -1,
            "filename": "the_conf-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "90d40e7aeaf7caca567a3982c9867478",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 20992,
            "upload_time": "2024-12-05T18:27:29",
            "upload_time_iso_8601": "2024-12-05T18:27:29.880391Z",
            "url": "https://files.pythonhosted.org/packages/bb/5c/d639b089358d57ab93c7d7ed6c828cc73b59e2bc07d6c5fe30276745c073/the_conf-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-05 18:27:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jaesivsm",
    "github_project": "the_conf",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "lcname": "the_conf"
}
        
Elapsed time: 0.37198s