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 hashes)
Built Distribution
Close
Hashes for hcl2_eval-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 982f5b1a4069d0f95f42350a7646805143869bf960df687a3d4845ca0941d16c |
|
MD5 | a5b993f2ab49780b6a7dc3dd42dbfd9b |
|
BLAKE2b-256 | 4000356831039e68bc53a708120045be670b035f97a6dda4ab4045890125c60f |