Skip to main content

No project description provided

Project description

hcl2-ast

A HCL2 parser and evaluator based on python-hcl2 that produces an Abstract Syntax Tree.

Note: This project is in an early stage. It does not currently cover all HCL2 syntax features and does not have good test coverage.

Usage

from hcl2_ast import parse_string

module = parse_string("""
  hello {
    name = "World"
  }
""")

print(module.pformat())

Outputs:

Module(body=[
  Block(
    name='hello',
    args=[],
    body=[
      Attribute(key='name', value=Literal(value='World')),
    ]
  ),
])

Also check out the hcl2-eval package to evaluate HCL2 configuration ASTs.

Compatibility

hcl2-ast requires Python 3.6 or higher.

Known issues

  • No understanding of operator precedence in expressions (grouping with parentheses works as expected)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hcl2-ast-0.4.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hcl2_ast-0.4.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file hcl2-ast-0.4.0.tar.gz.

File metadata

  • Download URL: hcl2-ast-0.4.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for hcl2-ast-0.4.0.tar.gz
Algorithm Hash digest
SHA256 294c9b257e0c46d4270c3276e9cdbefcc4f9d6a005cf3869a858e8345f118f9f
MD5 1c996a471f6f6035b73b7663ae7b4cb8
BLAKE2b-256 2a2d5b79a98a369b489f75d00de6ffdad4500c9f7b1421ee26eab2dea783ed8a

See more details on using hashes here.

File details

Details for the file hcl2_ast-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: hcl2_ast-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for hcl2_ast-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0137c37ea356d9483adf0b7397a5dbb9aa9e465c3f9f8f6b93cdd9c70599dc5b
MD5 506913dc76a39931bfeb8c564a606883
BLAKE2b-256 22d6e310ca854290f5723ee870923f5c0d4b7e4e0c5c03ef7824116585fa9169

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page