NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI
PyPI, #1117 most downloaded on PyPI
A parser for HCL2
Latest stable
8.2.0
Last release 13 days ago
09 Nov 2026
Release timing varies
gaps range from 2 weeks to 8 months
Most releases are documented
notes for 41 of 56 stable releases
Nothing withdrawn
no release was ever pulled
7 years old
59 releases · first in 2019
Drag across the ruler to compare, or tap a release to open it.
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 gene
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)cli/py.typed marker is gone; hcl2/py.typed already covers hcl2.cli.
(#359)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.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: https://github.com/amplify-education/python-hcl2/compare/v8.1.4...v8.2.0
Your coding agent can read these notes before it upgrades. Set up the MCP server →
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 keywor
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)in parsed only where the lexer fell back to NAME, so its separator and position decided whether the file parsed. (#357)Full Changelog: https://github.com/amplify-education/python-hcl2/compare/v8.1.3...v8.1.4
Several fixes below change the values loads() returns for input that already parsed without error in 8.1.x — negative integer literals, both strip_str
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.
py.typed marker so type checkers recognize hcl2 (and cli) as typed packages. (#299)${-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)\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)<<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)<<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: https://github.com/amplify-education/python-hcl2/compare/v8.1.2...v8.1.3
true, false, and null now serialize to native JSON types instead of strings.
true, false, and null now serialize to native JSON types instead of strings. (#293)Full Changelog: https://github.com/amplify-education/python-hcl2/compare/v8.1.1...v8.1.2
v7-to-v8 migration guide and absolute GitHub links in README docs table.
Full Changelog: https://github.com/amplify-education/python-hcl2/compare/v8.1.0...v8.1.1
Full architecture overhaul: bidirectional HCL2 ↔ JSON pipeline with typed rule classes.
hq read-only query CLI for HCL2 files (#277)hcl2tojson and jsontohcl2 (#274)%{if}, %{for}) in quoted strings (#276)writes omits quotes around map keys with / (#236)Full Changelog: https://github.com/amplify-education/python-hcl2/compare/v8.0.0rc2...v8.1.0
add function tuples round-trip test suite by @kkozik-amplify in https://github.com/amplify-education/python-hcl2/pull/268
Full Changelog: https://github.com/amplify-education/python-hcl2/compare/v8.0.0rc1...v8.0.0rc2
Full architecture overhaul: bidirectional HCL2 ↔ JSON pipeline with typed rule classes.
writes omits quotes around map keys with / (#236)Updated pyproject.toml dependencies. Thanks, @kkorlyak
Full Changelog: https://github.com/amplify-education/python-hcl2/compare/v7.3.0...v7.3.1
Issue parsing interpolations and escaped interpolations in a single string.
Full Changelog: https://github.com/amplify-education/python-hcl2/compare/v7.2.1...v7.3.0
More robust escaping for special characters. Thanks, @eranor
Possibility to parse deeply nested interpolations (formerly a Limitation), Thanks again, @weaversam8
for expression (#221)Full Changelog: https://github.com/amplify-education/python-hcl2/compare/v7.1.0...v7.2.0
hcl2.builder.Builder - nested blocks support
hcl2.builder.Builder - nested blocks support (#214)Full Changelog: https://github.com/amplify-education/python-hcl2/compare/v7.0.1...v7.1.0
Issue parsing dot-accessed attribute as an object key
Full Changelog: https://github.com/amplify-education/python-hcl2/compare/v7.0.0...v7.0.1
Limitations section to README.md
Limitations section to README.md (#200)null values (#198)null values in some cases (#206)"$${aws:username}") parsing (#200)Full Changelog: https://github.com/amplify-education/python-hcl2/compare/v6.1.1...v7.0.0
DictTransformer.to_tf_inline - handle float type by @kkozik-amplify in https://github.com/amplify-education/python-hcl2/pull/191
DictTransformer.to_tf_inline - handle float type by @kkozik-amplify in https://github.com/amplify-education/python-hcl2/pull/191Full Changelog: https://github.com/amplify-education/python-hcl2/compare/v6.1.0...v6.1.1
fix e-notation and negative numbers literals by @kkozik-amplify in https://github.com/amplify-education/python-hcl2/pull/182
null by @kkozik-amplify in https://github.com/amplify-education/python-hcl2/pull/184${ and } by @kkozik-amplify in https://github.com/amplify-education/python-hcl2/pull/186Full Changelog: https://github.com/amplify-education/python-hcl2/compare/v6.0.0...v6.1.0
Support full reconstruction of HCL from output dictionary by @weaversam8 in https://github.com/amplify-education/python-hcl2/pull/177
Full Changelog: https://github.com/amplify-education/python-hcl2/compare/v5.1.1...v6.0.0
fix README.md and update CHANGELOG.md by @kkozik-amplify in https://github.com/amplify-education/python-hcl2/pull/175
Full Changelog: https://github.com/amplify-education/python-hcl2/compare/v5.1.0...v5.1.1
support python 3.13 by @kkozik-amplify in https://github.com/amplify-education/python-hcl2/pull/170
Full Changelog: https://github.com/amplify-education/python-hcl2/compare/v5.0.0...v5.1.0
Support full reconstruction of HCL from parse tree by @weaversam8 in https://github.com/amplify-education/python-hcl2/pull/169
This closes #23
Full Changelog: https://github.com/amplify-education/python-hcl2/compare/v4.3.5...v5.0.0
AT-11673 - additional test coverage by @kkozik-amplify in https://github.com/amplify-education/python-hcl2/pull/165
if and for_each keywords to be used as identifiers by @kkozik-amplify in https://github.com/amplify-education/python-hcl2/pull/168Full Changelog: https://github.com/amplify-education/python-hcl2/compare/v4.3.4...v4.3.5
if and for_each keywords to be used as identifiers (#168)fix codacy badge by @kkozik-amplify in https://github.com/amplify-education/python-hcl2/pull/157
Full Changelog: https://github.com/amplify-education/python-hcl2/compare/v4.3.3...v4.3.4
support Python 3.12 by @kkozik-amplify in https://github.com/amplify-education/python-hcl2/pull/153
Full Changelog: https://github.com/amplify-education/python-hcl2/compare/v4.3.2...v4.3.3
support conditional without parentheses inside nested locals by @IButskhrikidze in https://github.com/amplify-education/python-hcl2/pull/138
Full Changelog: https://github.com/amplify-education/python-hcl2/compare/v4.3.1...v4.3.2
Add py.typed file to package by @tedoc2000 in https://github.com/amplify-education/python-hcl2/pull/123
Full Changelog: https://github.com/amplify-education/python-hcl2/compare/v4.3.0...v4.3.1
Refactor tests. in https://github.com/amplify-education/python-hcl2/pull/114
__begin_line__ and __end_line__ meta parameters. Migrate tests. in https://github.com/amplify-education/python-hcl2/pull/120Full Changelog: https://github.com/amplify-education/python-hcl2/compare/v4.2.0...v4.3.0
__begin_line__ and __end_line__ meta parameters (#120)Added support of the lark ≥1.0,<2. Thanks @KOLANICH
lark ≥1.0,<2. Thanks @KOLANICH (#100)lark <1.0.Add support for the python 3.10, 3.11
Nothing published for this version
### Added - Added PEP improvements - Added support of python 3.10 ### Changed - Dropped support of python 3.6 - Setup tox-gh-actions - Migrated from n
Fixed parsing of for expressions when there is a new line before the colon
Handle nested interpolations. Thanks @arielkru and @matt-land
Fixed nested splat statements. Thanks @josh-barker
Fixed an issue of whitespace around for expressions. Thanks @ryanking and @matchaxnb
Included the generated parser in the distribution.
BREAKING CHANGES: Attributes in blocks are no longer transformed into Python lists. Thanks @raymondbutcher
Skipped more exceptions for un-parsable files. Thanks @tanasegabriel
Allowed empty objects. Thanks @santoshankr
Allowed multiline conditional statements. Thanks @stpierre
Fixed errors caused by identifiers named "true", "false", or "null"
Treat one line blocks the same as multi line blocks. This is a breaking change so bumping to 1.0.0 to make sure no one accidentally upgrades to this v…
Added support for colon separators in object definitions as specified in the spec
Added support for legacy array index notation using dot. Thank you @arielkru
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
One column per quarter.