{ "info": { "author": "Adobe", "author_email": "noreply@adobe.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Text Processing :: Markup :: HTML" ], "description": "# himl\nA hierarchical config using yaml in Python.\n\nLatest version is: 0.2.2\n\n## Description\n\nA python module which allows you to merge hierarchical config files using YAML syntax. It offers deep merge, variable interpolation and secrets retrieval from secrets managers.\n\nIt is ideal if you want to structure your hierarchy in such a way that you avoid duplication. You can define a structure for your configuration using a hierarchy such environment/project/cluster/app. It is up to you what layers you want to use in this hierarchy. The tool will read all yaml files starting from the root (where default values would be) all the way to the leaf (where most specific values would be, which will take precedence).\n\nIdea came from puppet's hiera.\n\n## Table of Contents \n\n1. [Installation](#installation)\n2. [Examples](#examples)\n3. [Features](#features)\n * [Interpolation](#feature-interpolation)\n * [Deep merge](#feature-deep-merge)\n * [Secrets retrieval](#feature-secrets-retrieval)\n * [Merge with Terraform remote state](#feature-terraform-remote-state)\n\n\n\n## Installation\n\n### Using `pip`\n\n```sh\npip install himl\n```\n\n### From Source\n\n```\ngit clone https://github.com/adobe/himl\ncd himl\nsudo python setup.py install\n```\n\n\n\n## Examples\n\n### Using the python module\n\nThis will merge simple/default.yaml with simple/production/env.yaml\n```py\nfrom himl import ConfigProcessor\n\nconfig_processor = ConfigProcessor()\npath = \"examples/simple/production\"\nfilters = () # can choose to output only specific keys\nexclude_keys = () # can choose to remove specific keys\noutput_format = \"yaml\" # yaml/json\n\n\nconfig_processor.process(path=path, filters=filters, exclude_keys=exclude_keys, \n output_format=output_format, print_data=True)\n\n```\n\nThe above example will merge `simple/default.yaml` with `simple/production/env.yaml`:\n```\n$ tree examples/simple\nexamples/simple\n\u251c\u2500\u2500 default.yaml\n\u2514\u2500\u2500 production\n \u2514\u2500\u2500 env.yaml\n```\n\n\n\nThe example also showcases deep merging of lists and maps.\n\n`examples/simple/default.yaml`\n```yaml\n---\nenv: default\ndeep:\n key1: v1\n key2: v2\ndeep_list:\n - item1\n - item2\n```\n\n`examples/simple/production/env.yaml`\n```yaml\n---\nenv: prod\ndeep:\n key3: v3\ndeep_list:\n - item3\n```\n\nResult:\n```yaml\nenv: prod\ndeep:\n key1: v1\n key2: v2\n key3: v3\ndeep_list:\n- item1\n- item2\n- item3\n```\n\n### Using the cli\n\nA cli tool called `himl` is automatically installed via `pip`. You can use it to parse a tree of yamls and it will either output the combined configuration at standard output or write it to a file.\n\n```sh\nusage: himl [-h] [--output-file OUTPUT_FILE] [--format OUTPUT_FORMAT]\n [--filter FILTER] [--exclude EXCLUDE]\n [--skip-interpolation-validation]\n [--skip-interpolation-resolving] [--enclosing-key ENCLOSING_KEY]\n [--cwd CWD]\n path\n```\n\n```sh\nhiml examples/complex/env=dev/region=us-east-1/cluster=cluster2\n```\n\nBased on the configuration tree from the [examples/complex](examples/complex) folder, the output of the above command will be the following:\n```\ncluster:\n description: 'This is cluster: cluster2. It is using c3.2xlarge instance type.'\n name: cluster2\n node_type: c3.2xlarge\nregion:\n location: us-east-1\nenv: dev\n```\n\nWhere the examples folder looks something like this:\n```\n$ tree examples/complex\nexamples/complex\n\u251c\u2500\u2500 default.yaml\n\u251c\u2500\u2500 env=dev\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 env.yaml\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 region=us-east-1\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 cluster=cluster1\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 cluster.yaml\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 cluster=cluster2\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 cluster.yaml\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 region.yaml\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 region=us-west-2\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 cluster=cluster1\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 cluster.yaml\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 region.yaml\n\u2514\u2500\u2500 env=prod\n \u251c\u2500\u2500 env.yaml\n \u2514\u2500\u2500 region=eu-west-2\n \u251c\u2500\u2500 cluster=ireland1\n \u2502\u00a0\u00a0 \u2514\u2500\u2500 cluster.yaml\n \u2514\u2500\u2500 region.yaml\n```\n\n\n\n## Features\n\n\n\n### Interpolation\n\nIn order to avoid repetition, we wanted to make it possible to define a value once and reuse it in other parts of the yaml config.\nUnlike yaml anchors, these interpolations work across multiple files.\n\n#### Interpolating simple values\n\n`data/default.yaml`:\n```yaml\nallowed_roles:\n - \"arn:aws:iam::{{account.id}}:role/myrole\"\n```\n\n`data/dev/env.yaml`:\n```\naccount:\n id: \"123456\"\n```\n\n#### Interpolating whole `dict`\n\n```yaml\nprojects:\n webapp1:\n tagging:\n Owner: \"Web Service Team\"\n Environment: \"dev\"\n CostCenter: \"123\"\n data-store:\n Owner: \"Backend Team\"\n Environment: \"dev\"\n CostCenter: \"455\"\n\n# this will copy the whole projects.webapp1.tagging dict to this key\ntagging: \"{{projects.webapp1.tagging}}\"\n\n# or even a double interpolation\ntagging: \"{{projects.{{project.name}}.tagging}}\"\n```\n\n\n\n### Deep merge\n\nIt's possible to have the same key (eg. a dict/list) in multiple files and combine them using a deep merge.\nSee an example [here](https://github.com/adobe/himl#deep-merge-example).\n\n\n\n### Secrets retrieval\n\n#### [AWS SSM](https://docs.aws.amazon.com/systems-manager/latest/userguide/integration-ps-secretsmanager.html)\n\n```yaml\npassphrase: \"{{ssm.path(/key/coming/from/aws/secrets/store/manager).aws_profile(myprofile)}}\"\n```\n\n#### [Vault](https://www.vaultproject.io/)\n\nNot yet implemented.\n\n\n\n\n### Merge with [Terraform remote state](https://www.terraform.io/docs/state/remote.html)\n\n```yaml\n### Terraform remote states ###\nremote_states:\n - name: cluster_composition\n type: terraform\n aws_profile: \"my_aws_profile\"\n s3_bucket: \"my_terraform_bucket\"\n s3_key: \"mycluster.tfstate\"\n\n\nendpoint: \"{{outputs.cluster_composition.output.value.redis_endpoint}}\"\n```", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/adobe/himl", "keywords": "", "license": "Apache2", "maintainer": "", "maintainer_email": "", "name": "himl", "package_url": "https://pypi.org/project/himl/", "platform": "", "project_url": "https://pypi.org/project/himl/", "project_urls": { "Homepage": "https://github.com/adobe/himl" }, "release_url": "https://pypi.org/project/himl/0.2.2/", "requires_dist": null, "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "summary": "A hierarchical config using yaml", "version": "0.2.2" }, "last_serial": 5809231, "releases": { "0.1.15": [ { "comment_text": "", "digests": { "md5": "209665acbb7990118d702c5cd6a4634b", "sha256": "9c8f5cd3a756bf0fec9ac4587f39efc83093bde3207ea46ec6f91f0126dcb3a5" }, "downloads": -1, "filename": "himl-0.1.15.tar.gz", "has_sig": false, "md5_digest": "209665acbb7990118d702c5cd6a4634b", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 9695, "upload_time": "2019-08-16T15:29:56", "url": "https://files.pythonhosted.org/packages/75/2b/5f2768512571240fafb7ec8cbee0a1af235c9d1cddf6f69b1e064bad82d6/himl-0.1.15.tar.gz" } ], "0.1.16": [ { "comment_text": "", "digests": { "md5": "b04ab9ab83717f76599e8ee23959742e", "sha256": "c600311be87746024ded93532169e6fa1e6cbd420d70ecc20ea497ddc4f70aed" }, "downloads": -1, "filename": "himl-0.1.16.tar.gz", "has_sig": false, "md5_digest": "b04ab9ab83717f76599e8ee23959742e", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 9690, "upload_time": "2019-08-16T15:42:50", "url": "https://files.pythonhosted.org/packages/92/22/5fd2c716342953f79cc4c45a6a27056a9bd96703b9778469676f25b1183b/himl-0.1.16.tar.gz" } ], "0.1.17": [ { "comment_text": "", "digests": { "md5": "570aea53bd8bcf4abb832ba9f7f3dabd", "sha256": "7e8db44f75834afec66cb5d1a97831d0c18c67fc53b555d89702141945e1be76" }, "downloads": -1, "filename": "himl-0.1.17.tar.gz", "has_sig": false, "md5_digest": "570aea53bd8bcf4abb832ba9f7f3dabd", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 9696, "upload_time": "2019-08-16T15:53:19", "url": "https://files.pythonhosted.org/packages/52/01/a19ead2cf5cc16cac46f81bafea848e493d1fc163381286cf28e145af55c/himl-0.1.17.tar.gz" } ], "0.1.18": [ { "comment_text": "", "digests": { "md5": "0a0d04d27ee37c6b34be291d04f079ca", "sha256": "35a75dd707761ea1d04f28bddeb64516bb7383ce5530c0b81f44a4b37b168636" }, "downloads": -1, "filename": "himl-0.1.18.tar.gz", "has_sig": false, "md5_digest": "0a0d04d27ee37c6b34be291d04f079ca", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 11725, "upload_time": "2019-08-16T20:08:52", "url": "https://files.pythonhosted.org/packages/01/b0/7edee769468093f3770473aa3a69a1be7149c53ac26e4692a06b4c281a78/himl-0.1.18.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "d548b3634dccc4fc52a7afaea0fa8f9d", "sha256": "da03bdabd227ca623d85f346e6133460db30cec36a589bbfcf14ee85ab87fefc" }, "downloads": -1, "filename": "himl-0.2.0.tar.gz", "has_sig": false, "md5_digest": "d548b3634dccc4fc52a7afaea0fa8f9d", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 11707, "upload_time": "2019-08-22T19:21:29", "url": "https://files.pythonhosted.org/packages/9d/d2/d6a93da173a81bf02579819295d028ebd641becceb3e9f12caa665d7d7c3/himl-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "4047cb3b9accf119538d201cf358aa77", "sha256": "d418b65795b6499a0312b41581eabffc70a1185b45c38c1cbab7c026b3f712f7" }, "downloads": -1, "filename": "himl-0.2.1.tar.gz", "has_sig": false, "md5_digest": "4047cb3b9accf119538d201cf358aa77", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 11711, "upload_time": "2019-08-26T14:19:25", "url": "https://files.pythonhosted.org/packages/2f/07/d0705b1dcaf3a7f9d73941103b5e5c1a2b121c45c27b96ec90e73f6601ca/himl-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "83f8491241deb6f37760007c7b776e50", "sha256": "ea68ed185ad8766ae9b956d359d459720b3d94f101cdfa24bee3de9c0d0dd7a1" }, "downloads": -1, "filename": "himl-0.2.2.tar.gz", "has_sig": false, "md5_digest": "83f8491241deb6f37760007c7b776e50", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 11753, "upload_time": "2019-09-10T14:13:33", "url": "https://files.pythonhosted.org/packages/d3/16/9ee49386f738e06e2abd32cb7e437016d8f6b3baf13f015473e2dca9cfa7/himl-0.2.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "83f8491241deb6f37760007c7b776e50", "sha256": "ea68ed185ad8766ae9b956d359d459720b3d94f101cdfa24bee3de9c0d0dd7a1" }, "downloads": -1, "filename": "himl-0.2.2.tar.gz", "has_sig": false, "md5_digest": "83f8491241deb6f37760007c7b776e50", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", "size": 11753, "upload_time": "2019-09-10T14:13:33", "url": "https://files.pythonhosted.org/packages/d3/16/9ee49386f738e06e2abd32cb7e437016d8f6b3baf13f015473e2dca9cfa7/himl-0.2.2.tar.gz" } ] }