{ "info": { "author": "Liam Childs", "author_email": "liam.h.childs@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "[![Build Status](https://travis-ci.org/childsish/dynamic-yaml.svg?branch=master)](https://travis-ci.org/childsish/dynamic-yaml)\n\ndynamic-yaml\n============\n\nDynamic YAML is a couple of classes and functions that add extra functionality to YAML that turns it into a great configuration language for Python. If you prefer JSON, then see [dynamic-json][dynamic-json].\n\nYAML already provides:\n\n* A very readable and clean syntax\n* Infinitely nestable key:value pairs\n* Sequence types\n* A regulated portable syntax that conforms to strict standards\n\nIn addition, the PyYAML parser provides:\n\n* Automatic type identification (a result of implementing the YAML standard)\n\nFinally, the classes introduced by Dynamic YAML enable:\n\n* Dynamic string resolution\n\nDynamic PyYAML requires PyYAML (https://bitbucket.org/xi/pyyaml).\n\nUsage\n-----\nThe key feature that was introduced is the ability for a string scalar to reference other parts of the configuration tree. This is done using the Python string formatting syntax. The characters '{' and '}' enclose a reference to another entry in the configuration structure. The reference takes the form key1.key2 where key1 maps to another mapping object and can be found in the root mapping, and key2 can be found in key1's mapping object. Multiple levels of nesting can be used (eg. key1.key2.key3 etc...).\n\nAn example yaml configuration:\n```yaml\nproject_name: hello-world\ndirs:\n home: /home/user\n venv: \"{dirs.home}/venvs/{project_name}\"\n bin: \"{dirs.venv}/bin\"\n data: \"{dirs.venv}/data\"\n errors: \"{dirs.data}/errors\"\n sessions: \"{dirs.data}/sessions\"\n databases: \"{dirs.data}/databases\"\nexes:\n main: \"{dirs.bin}/main\"\n test: tests\n```\n\nReading in a yaml file:\n\n```python\nimport dynamic_yaml\n\nwith open('/path/to/file.yaml') as fileobj:\n cfg = dynamic_yaml.load(fileobj)\n```\n\nNow, the entry `cfg.dirs.venv` will resolve to `\"/home/user/venvs/hello-world\"`.\n\nInstallation\n------------\n\nTo install, simply run:\n\n```bash\npip install git+https://github.com/childsish/dynamic-yaml\n```\n\nRestrictions\n------------\n\nDue to the short amount of time I was willing to spend on working upon this, there are a few restrictions required for a valid YAML configuration file.\n\n* **Wild card strings must be surrounded by quotes.** Braces ('{' and '}') in a YAML file usually enclose a mapping object. However, braces are also used by the Python string formatting syntax to enclose a reference. As there is no way to change either of these easily, strings that contain wildcards must be explicitly declared using single or double quotes to enclose them.\n* **Variables are always dynamically resolved.** This possibly introduces significant slow downs, but hopefully your configuration object isn't too big anyway.\n\n[dynamic-json]: https://github.com/childsish/dynamic-json", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/childsish/dynamic-yaml", "keywords": "development yaml configuration", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "dynamic-yaml", "package_url": "https://pypi.org/project/dynamic-yaml/", "platform": "", "project_url": "https://pypi.org/project/dynamic-yaml/", "project_urls": { "Homepage": "https://github.com/childsish/dynamic-yaml" }, "release_url": "https://pypi.org/project/dynamic-yaml/1.1.4/", "requires_dist": null, "requires_python": "", "summary": "Enables self referential yaml entries", "version": "1.1.4" }, "last_serial": 5231697, "releases": { "1.1.4": [ { "comment_text": "", "digests": { "md5": "062e02a37d1b6c5fc00c43d629eb7541", "sha256": "4743492c2c94d8cd17e848ccc11b33ae670546b13257fdabc8acb13908340e70" }, "downloads": -1, "filename": "dynamic-yaml-1.1.4.tar.gz", "has_sig": false, "md5_digest": "062e02a37d1b6c5fc00c43d629eb7541", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3295, "upload_time": "2019-05-06T09:34:53", "url": "https://files.pythonhosted.org/packages/1c/82/e84611e87221b8f2668a7e9884b8876f9c449b97a9dba81afad192e4b7c5/dynamic-yaml-1.1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "062e02a37d1b6c5fc00c43d629eb7541", "sha256": "4743492c2c94d8cd17e848ccc11b33ae670546b13257fdabc8acb13908340e70" }, "downloads": -1, "filename": "dynamic-yaml-1.1.4.tar.gz", "has_sig": false, "md5_digest": "062e02a37d1b6c5fc00c43d629eb7541", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3295, "upload_time": "2019-05-06T09:34:53", "url": "https://files.pythonhosted.org/packages/1c/82/e84611e87221b8f2668a7e9884b8876f9c449b97a9dba81afad192e4b7c5/dynamic-yaml-1.1.4.tar.gz" } ] }