Repository navigation
Releases
Releases · amplify-education/python-hcl2
v8.2.0
What's Changed
Changed
- Breaking for direct
cli.*imports. The CLI modules moved from a top-levelclipackage
tohcl2.cli, so installing python-hcl2 no longer claims the generic top-levelcliname.
Since 8.0 the distribution installedcli/intosite-packages, where it collided with
projects that have a top-levelclipackage of their own and made theircli.*imports
resolve to the wrong module. Thehcl2tojson,jsontohcl2, andhqcommands and
python -m hcl2are unaffected; only code importingcli.hcl_to_json,cli.json_to_hcl,
cli.hq, orcli.helpersneeds to add thehcl2.prefix. No compatibility shim ships,
because a shim would still occupy the colliding name.
(#359) - The redundant
cli/py.typedmarker is gone;hcl2/py.typedalready covershcl2.cli.
(#359) - Breaking for direct
hcl2.utils.SerializationContextusers. The context is now a frozen
dataclass andSerializationContext.modify()is removed. Usecontext.replace(...)to derive
a child context; subclasses must also be declared@dataclass(frozen=True).
(#344) StartRule,BodyRule,BlockRuleandAttributeRulenow pass a caller-supplied
SerializationContextdown to their children instead of discarding it, so a non-default
context (e.g.inside_dollar_string=True) passed toStartRule.serialize()now changes the
output.
Added
- Python 3.14 is now tested and declared as supported. No source changes were needed; the full
suite passes on 3.14 as-is.
(#360)
Fixed
- Concurrent
load/loadscalls no longer corrupt each other's results. All rules shared one
defaultSerializationContextthat was mutated in place during serialization, so a tuple or
object parsed in one thread could come back as its inline HCL source ('[1, 2, 3]') instead
of a list or dict, with no error raised. The context is now immutable, which also makes a
caller-supplied context safe to share across threads.
(#327,
#344)
Full Changelog: v8.1.4...v8.2.0
v8.1.4
What's Changed
Fixed
- Parse blocks whose type or unquoted label is an HCL keyword, such as the
inblock in Snowflake'ssnowflake_schemasdata source. HCL reserves no keywords, so all are now accepted as block labels. Diagnosed independently in #355. (#357) - Parse keyword-named object keys reliably, fixing a regression of #148. A key such as
inparsed only where the lexer fell back toNAME, so its separator and position decided whether the file parsed. (#357)
Full Changelog: v8.1.3...v8.1.4
v8.1.3
What's Changed
Several fixes below change the values loads() returns for input that already
parsed without error in 8.1.x — negative integer literals, both
strip_string_quotes behaviours, and the two heredoc body fixes. The previous
result was a bug in each case, so this stays a patch release; re-check your
expectations if you built around the old values.
Fixed
- Restore
py.typedmarker so type checkers recognizehcl2(andcli) as typed packages. (#299) - Parse heredocs with an empty body again. A marker immediately followed by its closing delimiter failed to match, and the lexer then ran on to a later delimiter, silently absorbing the attributes in between. Thanks, @livingstaccato (#312)
- Negative integer literals load as numbers again instead of
${-N}expression strings, matching negative floats and the pre-8.x behaviour. Thanks, @livingstaccato (#311) strip_string_quotesno longer unquotes string literals nested inside expressions, which produced invalid HCL such as${upper(x)}fromupper("x"). Thanks, @livingstaccato (#313)strip_string_quotesnow resolves escape sequences, so the values it yields match what the option documents. Escapes naming a codepoint outside the Unicode range, or a lone surrogate, are preserved verbatim rather than raising. Thanks, @livingstaccato (#313)- Parse files with CRLF (
\r\n) line endings, including heredocs. A\racting as part of a line ending is ignored, so a CRLF file reconstructs with LF endings; a\rthat is content — inside a quoted string or a heredoc body — is preserved. Thanks, @agu2347 (#317) - Flattened heredoc bodies keep their trailing blank lines and trailing spaces instead of being right-stripped away, for both
<<MARKERand<<-MARKER. The closing marker line's own indentation is still removed, and a blank line no longer cancels the<<-dedent. Thanks, @agu2347 (#318) - Parse heredocs whose delimiter is a single character, such as
<<E. The spec defines the delimiter as an Identifier, which permits one character. (#323) preserve_heredocs=Falsecombined withstrip_string_quotesnow returns the heredoc body as a plain multi-line string instead of escaping every newline to a literal\n. The escaping is still applied to the quoted source form produced withoutstrip_string_quotes. (#324)
Full Changelog: v8.1.2...v8.1.3
v8.1.2
What's Changed
Fixed
true,false, andnullnow serialize to native JSON types instead of strings. (#293)
Full Changelog: v8.1.1...v8.1.2
v8.1.1
What's Changed
Added
- v7-to-v8 migration guide and absolute GitHub links in README docs table. (#287)
Full Changelog: v8.1.0...v8.1.1
v8.1.0
What's Changed
Added
- Full architecture overhaul: bidirectional HCL2 ↔ JSON pipeline with typed rule classes. (#203)
hqread-only query CLI for HCL2 files (#277)- Agent-friendly conversion CLIs:
hcl2tojsonandjsontohcl2(#274) - Add template directives support (
%{if},%{for}) in quoted strings (#276) - Support loading comments (#134)
- CLAUDE.md (#260)
Fixed
- Ternary with strings parse error (#55)
- "No terminal matches '|' in the current parser context" when parsing multi-line conditional (#142)
- reverse_transform not working with object-type variables (#231)
- reverse_transform not handling nested functions (#235)
writesomits quotes around map keys with/(#236)- Operator precedence bug (#248)
- Empty string dictionary keys can't be parsed twice (#249)
- jsonencode not deserialized correctly (#250)
- Literal string "string" incorrectly quoted (#251)
- Interpolation literals added to locals/variables in maps (#252)
- Object literal expression can't be serialized (#253)
- Heredocs should interpret backslash literally (#262)
- Parsing a multi-line multi-conditional expression causes exception — Unexpected token Token('QMARK', '?') (#269)
- Parsing error for multiline binary operators (#246)
Changed
- Updated package metadata: development status, dropped Python 3.7 support. (#263)
Full Changelog: v8.0.0rc2...v8.1.0
v8.0.0rc2
What's Changed
- add function tuples round-trip test suite by @kkozik-amplify in #268
- SerializationOptions - add an option to strip string quotes in dict/JSON output by @kkozik-amplify in #272
- Add postlexer to support multiline binary operators and ternary expressions by @kkozik-amplify in #270
- more robust whitespace handling in reconstruction by @kkozik-amplify in #271
- update changelog for 8.0.0rc2 by @kkozik-amplify in #273
Full Changelog: v8.0.0rc1...v8.0.0rc2
v8.0.0rc1
Added
- Full architecture overhaul: bidirectional HCL2 ↔ JSON pipeline with typed rule classes. (#203)
- CLAUDE.md (#260)
Fixed
- Ternary with strings parse error (#55)
- reverse_transform not working with object-type variables (#231)
- reverse_transform not handling nested functions (#235)
writesomits quotes around map keys with/(#236)- Operator precedence bug (#248)
- Empty string dictionary keys can't be parsed twice (#249)
- jsonencode not deserialized correctly (#250)
- Literal string "string" incorrectly quoted (#251)
- Interpolation literals added to locals/variables in maps (#252)
- Object literal expression can't be serialized (#253)
- Heredocs should interpret backslash literally (#262)
Changed
- Updated package metadata: development status, dropped Python 3.7 support. (#263)
v7.3.1
v7.3.0
What's Changed
Fixed
- Issue parsing interpolations and escaped interpolations in a single string. (#239)
Full Changelog: v7.2.1...v7.3.0