Skip to main content

No project description provided

Project description

hcl2-eval

Evaluate HCL2 configurations like a programming language. Based on hcl2-ast.

Usage

The evaluation of the HCL2 AST uses three components: A context, an evaluator an interpreter. The context is responsible for performing attribute reads and writes, looking up functions as well as opening and closing stanzas. The evaluator's responsibility is to evaluate expressions in the AST to Python values, while the interpreter executes statement nodes.

from hcl2_ast import parse_file
from hcl2_eval import Context, Evaluator, Interpreter, Stanza

class HelloStanza(Stanza):
    ...

module = parse_file(open("hello.hcl"), close=True)
context = Context.of(hello=HelloStanza)
Interpreter(Evaluator()).execute(module, context)

Check out the full example at examples/hello.py.

Compatibility

hcl2-eval requires Python 3.6 or higher.

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-eval-0.1.3.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

hcl2_eval-0.1.3-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file hcl2-eval-0.1.3.tar.gz.

File metadata

  • Download URL: hcl2-eval-0.1.3.tar.gz
  • Upload date:
  • Size: 5.5 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-eval-0.1.3.tar.gz
Algorithm Hash digest
SHA256 f4875c27786fc26fb1d89df5e182f4c334feaab6a9b7f071e593ed6bf568cfd5
MD5 177f4eb0dc6a96f0fe08f2817fe42b0d
BLAKE2b-256 294cbf5e4e5d7bdf1c3f9b16947132d83f37243ac5a4fa144e8630bc428218d5

See more details on using hashes here.

File details

Details for the file hcl2_eval-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: hcl2_eval-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 6.4 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_eval-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 982f5b1a4069d0f95f42350a7646805143869bf960df687a3d4845ca0941d16c
MD5 a5b993f2ab49780b6a7dc3dd42dbfd9b
BLAKE2b-256 4000356831039e68bc53a708120045be670b035f97a6dda4ab4045890125c60f

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