Skip to content

Releases

v8.2.0

Choose a tag to compare

@kkozik-amplify kkozik-amplify released this 09 Nov 14:50
bdaf508

What's Changed

Changed

  • Breaking for direct cli.* imports. The CLI modules moved from a top-level cli package
    to hcl2.cli, so installing python-hcl2 no longer claims the generic top-level cli name.
    Since 8.0 the distribution installed cli/ into site-packages, where it collided with
    projects that have a top-level cli package of their own and made their cli.* imports
    resolve to the wrong module. The hcl2tojson, jsontohcl2, and hq commands and
    python -m hcl2 are unaffected; only code importing cli.hcl_to_json, cli.json_to_hcl,
    cli.hq, or cli.helpers needs to add the hcl2. prefix. No compatibility shim ships,
    because a shim would still occupy the colliding name.
    (#359)
  • The redundant cli/py.typed marker is gone; hcl2/py.typed already covers hcl2.cli.
    (#359)
  • Breaking for direct hcl2.utils.SerializationContext users. The context is now a frozen
    dataclass and SerializationContext.modify() is removed. Use context.replace(...) to derive
    a child context; subclasses must also be declared @dataclass(frozen=True).
    (#344)
  • StartRule, BodyRule, BlockRule and AttributeRule now pass a caller-supplied
    SerializationContext down to their children instead of discarding it, so a non-default
    context (e.g. inside_dollar_string=True) passed to StartRule.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/loads calls no longer corrupt each other's results. All rules shared one
    default SerializationContext that 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

Choose a tag to compare

@kkozik-amplify kkozik-amplify released this 08 Sep 08:25
5f51c8b

What's Changed

Fixed

  • Parse blocks whose type or unquoted label is an HCL keyword, such as the in block in Snowflake's snowflake_schemas data 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 in parsed only where the lexer fell back to NAME, so its separator and position decided whether the file parsed. (#357)

Full Changelog: v8.1.3...v8.1.4

v8.1.3

Choose a tag to compare

@kkozik-amplify kkozik-amplify released this 26 Aug 13:02
1874eb7

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.typed marker so type checkers recognize hcl2 (and cli) 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_quotes no longer unquotes string literals nested inside expressions, which produced invalid HCL such as ${upper(x)} from upper("x"). Thanks, @livingstaccato (#313)
  • strip_string_quotes now 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 \r acting as part of a line ending is ignored, so a CRLF file reconstructs with LF endings; a \r that 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 <<MARKER and <<-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=False combined with strip_string_quotes now 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 without strip_string_quotes. (#324)

Full Changelog: v8.1.2...v8.1.3

v8.1.2

Choose a tag to compare

@kkozik-amplify kkozik-amplify released this 10 Apr 14:27
a602753

What's Changed

Fixed

  • true, false, and null now serialize to native JSON types instead of strings. (#293)

Full Changelog: v8.1.1...v8.1.2

v8.1.1

Choose a tag to compare

@kkozik-amplify kkozik-amplify released this 07 Apr 17:39
472f033

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

Choose a tag to compare

@kkozik-amplify kkozik-amplify released this 07 Apr 12:03
33590fc

What's Changed

Added

  • Full architecture overhaul: bidirectional HCL2 ↔ JSON pipeline with typed rule classes. (#203)
  • hq read-only query CLI for HCL2 files (#277)
  • Agent-friendly conversion CLIs: hcl2tojson and jsontohcl2 (#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)
  • writes omits 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

v8.0.0rc2 Pre-release
Pre-release

Choose a tag to compare

@kkozik-amplify kkozik-amplify released this 11 Mar 12:52
c886e46

What's Changed

Full Changelog: v8.0.0rc1...v8.0.0rc2

v8.0.0rc1

v8.0.0rc1 Pre-release
Pre-release

Choose a tag to compare

@kkozik-amplify kkozik-amplify released this 09 Mar 13:26
a80e8e2

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)
  • writes omits 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

Choose a tag to compare

@kkozik-amplify kkozik-amplify released this 24 Jul 12:33
d36c5be

What's Changed

Fixed

Full Changelog: v7.3.0...v7.3.1

v7.3.0

Choose a tag to compare

@kkozik-amplify kkozik-amplify released this 23 Jul 09:09
128aaee

What's Changed

Fixed

  • Issue parsing interpolations and escaped interpolations in a single string. (#239)

Full Changelog: v7.2.1...v7.3.0