{"id":13505898,"url":"https://github.com/virtuald/pyhcl","last_synced_at":"2025-04-11T11:48:12.155Z","repository":{"id":20571141,"uuid":"23851495","full_name":"virtuald/pyhcl","owner":"virtuald","description":"HCL is a configuration language. pyhcl is a python parser for it.","archived":false,"fork":false,"pushed_at":"2024-09-03T22:28:39.000Z","size":201,"stargazers_count":339,"open_issues_count":12,"forks_count":59,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-04-03T15:07:13.316Z","etag":null,"topics":["configuration","hcl","python"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/virtuald.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-09-09T21:51:09.000Z","updated_at":"2025-03-09T23:08:34.000Z","dependencies_parsed_at":"2024-01-03T02:29:35.609Z","dependency_job_id":"3e4302ed-506b-42f5-9ee3-7bc966fcbcac","html_url":"https://github.com/virtuald/pyhcl","commit_stats":{"total_commits":114,"total_committers":22,"mean_commits":5.181818181818182,"dds":0.5087719298245614,"last_synced_commit":"5dcf8b8a5e826e24cd6e572c4215283bf4b06d45"},"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/virtuald%2Fpyhcl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/virtuald%2Fpyhcl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/virtuald%2Fpyhcl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/virtuald%2Fpyhcl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/virtuald","download_url":"https://codeload.github.com/virtuald/pyhcl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248388549,"owners_count":21095404,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["configuration","hcl","python"],"created_at":"2024-08-01T00:01:16.596Z","updated_at":"2025-04-11T11:48:12.134Z","avatar_url":"https://github.com/virtuald.png","language":"Python","readme":"pyhcl\n=====\n\nImplements a parser for `HCL (HashiCorp Configuration\nLanguage) \u003chttps://github.com/hashicorp/hcl\u003e`__ in Python. This\nimplementation aims to be compatible with the original golang version of\nthe parser.\n\npyhcl does not support HCL2 (which is what modern terraform uses). You might try\nhttps://pypi.org/project/python-hcl2/ instead (though I've never personally tried it).\n\nThe grammar and many of the tests/fixtures were copied/ported from the\ngolang parser into pyhcl. All releases are tested with a variety of \npython versions from Python 2.7 onward.\n\nThis version has been modified to work with terraform 0.12 syntax.  \nIt should be backward compatible with earlier versions.  \nIt doesn't cover every situation.  See discussion in pull request:\nhttps://github.com/virtuald/pyhcl/pull/57\n\nInstallation\n============\n\n::\n\n    pip install pyhcl\n\nUsage\n=====\n\nThis module is intended to be used in mostly the same way that one would\nuse the json module in python, and load/loads/dumps are implemented.\n\n::\n\n    import hcl\n\n    with open('file.hcl', 'r') as fp:\n        obj = hcl.load(fp)\n\nCurrently the dumps function outputs JSON, and not HCL.\n\nConvert HCL to JSON\n-------------------\n\npyhcl comes with a script that you can use to easily convert HCL to JSON,\nsimilar to the json.tool that comes with python::\n\n\thcltool INFILE [OUTFILE]\n\t\nStructure Validation\n--------------------\n\nSimilar to JSON, the output of parsing HCL is a python dictionary with\nno defined structure. The golang library for HCL implements support for\nparsing HCL according to defined objects, but this implementation does\nnot currently support such constructs.\n\nInstead, I recommend that you use tools designed to validate JSON, such\nas the `schematics \u003chttps://pypi.python.org/pypi/schematics\u003e`_ library. \n\nSyntax\n======\n\n-  Single line comments start with ``#`` or ``//``\n\n-  Multi-line comments are wrapped in ``/*`` and ``*/``\n\n-  Values are assigned with the syntax ``key = value`` (whitespace\n   doesn't matter). The value can be any primitive: a string, number,\n   boolean, object, or list.\n\n-  Strings are double-quoted and can contain any UTF-8 characters.\n   Example: ``\"Hello, World\"``\n\n-  Numbers are assumed to be base 10. If you prefix a number with 0x, it\n   is treated as a hexadecimal. If it is prefixed with 0, it is treated\n   as an octal. Numbers can be in scientific notation: \"1e10\".\n\n-  Boolean values: ``true``, ``false``\n\n-  Arrays can be made by wrapping it in ``[]``. Example:\n   ``[\"foo\", \"bar\", 42]``. Arrays can contain primitives and other\n   arrays, but cannot contain objects. Objects must use the block syntax\n   shown below.\n\nObjects and nested objects are created using the structure shown below::\n\n    variable \"ami\" {\n        description = \"the AMI to use\"\n    }\n\nTesting\n=======\n\nTo run the tests::\n\n    pip install -r testing-requirements.txt\n    tests/run_tests.sh\n    \nDebug Mode\n----------\n\nTo enable debug mode::\n\n    import hcl\n    hcl.parser.DEBUG = True\n\nAuthors\n=======\n\nDustin Spicuzza (dustin@virtualroadside.com)\n\nNote: This project is not associated with Hashicorp\n","funding_links":[],"categories":["Libraries","Python"],"sub_categories":["Miscellaneous","IDE"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvirtuald%2Fpyhcl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvirtuald%2Fpyhcl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvirtuald%2Fpyhcl/lists"}