$npx skillfedfor your agent

python-hcl2

A parser for HCL2

Worth itPyPI Python ModulesReleased Apr 20266.3M downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — python_hcl2-8.1.2-py3-none-any.whl
v8.1.2 · released 2026-04-10 · Python >=3.8.0 · 2 runtime deps: lark, regex

Yes. The package is actively maintained, has no known vulnerabilities, installs with minimal friction (two lightweight dependencies), supports current Python versions, and solves a real problem for anyone working with Terraform or other HCL2-based tools. The permissive MIT license poses no barrier. Install it if you need to parse, query, or generate HCL2 files from Python.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python 3.8 or higher.
  • Low friction: pure Python wheel with only two runtime dependencies (lark and regex).
  • Actively maintained with a recent release; last commit was 2026-07-18 and the project is not archived.

License · maintenance · safety

MIT (permissive) — MIT license (permissive) means you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.

last release 2026-04-10 (126 days) · last repo commit 2026-07-18 · 316 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 6,339,437 downloads/mo, #1,929 on PyPI

Verify before relying

pip install python-hcl2

import hcl2

with open("main.tf") as f:
    data = hcl2.load(f)

hcl_string = hcl2.dumps(data)
  • Whether the package handles all HCL2 syntax edge cases or has known parsing limitations beyond those documented.
  • Performance characteristics when parsing very large HCL2 files or directories.
Same gist for agents: .md · .json

What it is and what it does

python-hcl2 is a parser that reads HCL2 configuration syntax—the language used by Terraform and other HashiCorp tools—and converts it into Python dictionaries, or vice versa. It uses the Lark parsing library and the regex module as its core dependencies. The package supports HCL2 only (not the older HCL v1) and works with any HCL2 config file, including Terraform configurations.

Beyond basic parsing, the package provides a Builder API for constructing HCL2 documents programmatically from Python, and ships three CLI tools: hcl2tojson and jsontohcl2 for format conversion, and hq—a jq-like query tool for extracting and inspecting parts of HCL2 files. It is actively maintained, supports Python 3.8 through 3.13, and carries no known security vulnerabilities.

Use it for

  • Convert Terraform .tf files to JSON for programmatic inspection or transformation in a Python application.
  • Build HCL2 configuration files dynamically from Python code without hand-writing HCL syntax.
  • Query specific values from HCL2 files using the hq CLI tool for compliance checks or configuration audits.
  • Integrate HCL2 parsing into infrastructure-as-code tooling or configuration management scripts.
  • Round-trip HCL2 ↔ JSON for data pipeline or API integration workflows.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

The package is actively maintained, has no known vulnerabilities, installs with minimal friction (two lightweight dependencies), supports current Python versions, and solves a real problem for anyone working with Terraform or other HCL2-based tools. The permissive MIT license poses no barrier. Install it if you need to parse, query, or generate HCL2 files from Python.

Install

python-hcl2 on PyPI

Before you install

Low friction: pure Python wheel with only two runtime dependencies (lark and regex). Actively maintained with a recent release; last commit was 2026-07-18 and the project is not archived.

Requires Python 3.8 or higher.

License in practice

MIT license (permissive) means you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.

Quickstart

pip install python-hcl2

import hcl2

with open("main.tf") as f:
    data = hcl2.load(f)

hcl_string = hcl2.dumps(data)

Verify before relying

  • Whether the package handles all HCL2 syntax edge cases or has known parsing limitations beyond those documented.
  • Performance characteristics when parsing very large HCL2 files or directories.

Package facts

LicenseMIT permissive
Python supportSupports the current Python release >=3.8.0
Install frictionLow. Pure-Python wheel
Runtime dependencies
2 packages
larkregex
MaintenanceActively maintained 126 days since the last release
Last repo commit
First released
Downloads6,339,437 / month, #1,929 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python Modules

Evidence: python_hcl2-8.1.2-py3-none-any.whl

Tags

Capabilities
HCL2 parser PythonTerraform config parserHCL to JSON converterparse HCL2 filesHCL2 query toolinfrastructure as code parser
Topics
terraformconfiguration-parsinginfrastructure-as-code

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “HCL2 parser Python”

  • python-hcl2Parses HCL2 configuration files (used by Terraform and other…
  • bc-python-hcl2Parses HCL2 configuration files (such as Terraform configs) into…
  • pyhclParses HCL (HashiCorp Configuration Language) files into Python…

Give your agent the search over MCP, or paste the wish link into any chat.

More Python Modules packages

idna Worth it
PyPI · Python Modules · released Jun 2026

Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.

Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.

BSD-3-Clausepure Python · 3.9+
1.8Bdownloads / mo
setuptools Worth it
PyPI · Python Modules · released Aug 2026

Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.

MITpure Python · 3.10+
1.6Bdownloads / mo
PyYAML Worth it
PyPI · Python Modules · released Sep 2025

PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.

MITcompiled wheel · 3.8+
1.2Bdownloads / mo
pydantic Worth it
PyPI · Python Modules · released May 2026

Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.

MITpure Python · 3.9+
1.1Bdownloads / mo
annotated-types Worth it
PyPI · Python Modules · released Jul 2026

Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.

Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…

MITpure Python · 3.10+
871.3Mdownloads / mo
typing-inspection Worth it
PyPI · Python Modules · released Aug 2026

Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.

MITpure Python · 3.10+
783.0Mdownloads / mo

See also bc-python-hcl2 · pyhcl · tfparse · tree-sitter-hcl · fhconfparser · cdktf · lark-js · python-terraform · lark-parser · hvac