{ "info": { "author": "", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "Configcrunch\n============\n\n|build| |docs|\n\n.. |build| image:: https://jenkins.riptide.parakoopa.de/buildStatus/icon?job=configcrunch%2Fmaster\n :target: https://jenkins.riptide.parakoopa.de/blue/organizations/jenkins/configcrunch/activity\n :alt: Build Status\n\n.. |docs| image:: https://readthedocs.org/projects/configcrunch/badge/?version=latest\n :target: https://configcrunch.readthedocs.io/en/latest/?badge=latest\n :alt: Documentation Status\n\nConfigcrunch is a Python library for reading YAML-based configuration files that aims to be simple\nwhile also providing some very powerful features.\n\nConfigcrunch is compatible with Python 3.6 and up.\n\nInstall it via pip: ``pip install configcrunch``\n\nFeatures:\n\n- Read configuration files from YAML files.\n- Define various types of configuration files, that can be validated via a schema.\n- Types of configuration files are defined as separate Python classes.\n- Documents can be configured to contain sub-documents of any type.\n- Documents can contain `Jinja2 `_ based variables that can\n reference any other field inside the same or parent document.\n- The classes that represent your document types can contain methods that can be used\n inside the configuration files.\n- Documents can reference documents from other files. Configcrunch will merge them together.\n You decide where referenced documents are looked up.\n- Configuration objects can also be created without YAML files, by using default Python dicts.\n- All features are optional.\n\nUsed by:\n\n- `Riptide `_\n- (Your project here! Open an issue.)\n\nBy default Configcrunch uses `schema `_ to validate schemas.\nBut you can also use your own validation logic!\n\nExample\n-------\n\nThis is an example that uses most of the features described above, using two document types.\n\n.. code-block:: yaml\n\n # doc1.yml - Type: one\n one:\n name: Document\n number: 1\n sub:\n # Sub-document of type \"two\"\n $ref: /doc2\n two_field: \"{{ parent().method() }}\"\n\n\n.. code-block:: yaml\n\n # /doc2.yml - Type: two\n two:\n name: Doc 2\n number: 2\n two_field: This is overridden\n\n\n.. code-block:: python\n\n # classes.py\n from schema import Schema, Optional\n\n from configcrunch import YamlConfigDocument, DocReference, load_subdocument, variable_helper, REMOVE\n\n\n class One(YamlConfigDocument):\n @classmethod\n def header(cls) -> str:\n return \"one\"\n\n def schema(self) -> Schema:\n return Schema(\n {\n Optional('$ref'): str, # reference to other One documents\n 'name': str,\n 'number': int,\n Optional('sub'): DocReference(Two)\n }\n )\n\n def _load_subdocuments(self, lookup_paths):\n if \"sub\" in self and \"sub\" != REMOVE:\n self[\"sub\"] = load_subdocument(self[\"sub\"], self, Two, lookup_paths)\n return self\n\n @variable_helper\n def method(self):\n return \"I will return something\"\n\n\n class Two(YamlConfigDocument):\n @classmethod\n def header(cls) -> str:\n return \"two\"\n\n def schema(self) -> Schema:\n return Schema(\n {\n Optional('$ref'): str, # reference to other Two documents\n 'name': str,\n 'number': int,\n 'two_field': str\n }\n )\n\n\nThe document \"one.yml\" can then be read via Python:\n\n >>> import yaml\n >>> from classes import One\n >>> doc = One.from_yaml('./doc1.yml')\n >>> doc.resolve_and_merge_references([''])\n >>> doc.process_vars()\n >>> print(yaml.dump(doc.to_dict(), default_flow_style=False))\n one:\n name: Document\n number: 1\n sub:\n name: Doc 2\n number: 2\n two_field: I will return something\n\n\nTests\n-----\n\nInside the ``configcrunch.tests`` package are acceptance tests. Unit tests are WIP.\n\nTo run the tests, see ``run_tests.sh``.\n\nDocumentation\n-------------\n\nThe complete documentation can be found at `Read the Docs `_ (or in the docs directory).\n\n", "description_content_type": "text/x-rst", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Parakoopa/configcrunch/", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "configcrunch", "package_url": "https://pypi.org/project/configcrunch/", "platform": "", "project_url": "https://pypi.org/project/configcrunch/", "project_urls": { "Homepage": "https://github.com/Parakoopa/configcrunch/" }, "release_url": "https://pypi.org/project/configcrunch/0.2.0/", "requires_dist": [ "schema (>=0.6)", "pyyaml (>=5.1)", "jinja2 (>=2.10.1)" ], "requires_python": "", "summary": "Configuration parser based on YAML-Files with support for variables, overlaying and hierarchies", "version": "0.2.0" }, "last_serial": 5841169, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "026317bbfab80f80ad7ee490c9da6521", "sha256": "70567b8c4c7bfce7dc4e3ddcf471b5602e087d511eab42daa863df25f04bf803" }, "downloads": -1, "filename": "configcrunch-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "026317bbfab80f80ad7ee490c9da6521", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 24515, "upload_time": "2019-04-19T19:07:50", "url": "https://files.pythonhosted.org/packages/57/53/f92fed38730116ca3901a24663428218448ff9858b613af74689d3ae9e1c/configcrunch-0.1.1-py3-none-any.whl" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "571ebd7f2877596b9c972a200056c27e", "sha256": "917b32f3e199d258b2bf6853d654cb722bcc0dcb1349e9128f0247132dcfa0b9" }, "downloads": -1, "filename": "configcrunch-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "571ebd7f2877596b9c972a200056c27e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 23045, "upload_time": "2019-04-24T01:15:16", "url": "https://files.pythonhosted.org/packages/e5/24/fb1fc98b924ac4311fae0cbe2de5aea8ff6e44e74d3b7437515d216fbc89/configcrunch-0.1.2-py3-none-any.whl" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "747de9b8a32f3f9fab84c4183202416e", "sha256": "b6312e2af0d433c78f94b25822dd0862cd64434ed0faac5e3c425caf259b14c5" }, "downloads": -1, "filename": "configcrunch-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "747de9b8a32f3f9fab84c4183202416e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 23057, "upload_time": "2019-06-07T09:19:28", "url": "https://files.pythonhosted.org/packages/f3/1b/934f28935a6825bec8c5d385504b2139cb139601d075da434b5699f20444/configcrunch-0.1.3-py3-none-any.whl" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "2102449719a3f04caf2bb9ce418648d6", "sha256": "b349da34352331315deaca1bdae607180dc43363fbb7040f677c2ab1d54290f8" }, "downloads": -1, "filename": "configcrunch-0.1.4-py3-none-any.whl", "has_sig": false, "md5_digest": "2102449719a3f04caf2bb9ce418648d6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 23080, "upload_time": "2019-08-06T10:15:05", "url": "https://files.pythonhosted.org/packages/4b/7d/50096ff06e1b9543059c6010d4a1e3bd1d1ad7b5822ed6b7adecde63605f/configcrunch-0.1.4-py3-none-any.whl" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "fb31025f453ff3b4bf160902972cb2bb", "sha256": "a345fadf94f2b90317bdb6f932f562e46cceec02c810ecf4e705aa0b4c6901d1" }, "downloads": -1, "filename": "configcrunch-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "fb31025f453ff3b4bf160902972cb2bb", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 23372, "upload_time": "2019-09-17T11:18:21", "url": "https://files.pythonhosted.org/packages/67/a0/3169f1fa41be07ba1cd6d25169f7b30349a314f105711ac79eab97e9ec72/configcrunch-0.2.0-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "fb31025f453ff3b4bf160902972cb2bb", "sha256": "a345fadf94f2b90317bdb6f932f562e46cceec02c810ecf4e705aa0b4c6901d1" }, "downloads": -1, "filename": "configcrunch-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "fb31025f453ff3b4bf160902972cb2bb", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 23372, "upload_time": "2019-09-17T11:18:21", "url": "https://files.pythonhosted.org/packages/67/a0/3169f1fa41be07ba1cd6d25169f7b30349a314f105711ac79eab97e9ec72/configcrunch-0.2.0-py3-none-any.whl" } ] }