$npx skillfedfor your agent

tree-sitter-hcl

HCL and terraform grammar for tree-sitter

With conditionsPyPI LinguisticReleased Jun 2025132.1K downloads / moApache-2.0Platform wheel

Decision gist · record as of 2026-08-14

platform wheels — tree_sitter_hcl-1.2.0-cp310-abi3-macosx_10_9_x86_64.whl · tree_sitter_hcl-1.2.0-cp310-abi3-macosx_11_0_arm64.whl · tree_sitter_hcl-1.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
v1.2.0 · released 2025-06-16 · Python >=3.10

Yes, if you need to parse or analyze HCL/Terraform files programmatically. The package is stable with no known vulnerabilities and permissively licensed. Install friction is moderate due to compilation, but prebuilt wheels are available for common platforms. The aging maintenance status is acceptable for a grammar binding—updates are typically infrequent unless the underlying HCL specification changes.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python >=3.10; compiled wheels provided for common platforms but may require a C compiler on unsupported architectures.
  • Medium install friction due to compiled wheels; prebuilt binaries are available for common platforms (x86_64, ARM64, macOS, Linux, Windows).
  • Repository remains active and unarchived, though last release was 424 days ago.

License · maintenance · safety

Apache-2.0 (permissive) — Licensed under Apache-2.0 (permissive), allowing free use, modification, and distribution with minimal restrictions; suitable for both open-source and commercial projects.

last release 2025-06-16 (424 days) · last repo commit 2026-01-17 · 145 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 132,104 downloads/mo, #11,565 on PyPI

Verify before relying

pip install tree-sitter-hcl

from tree_sitter_hcl import language
parser = language.parser()
tree = parser.parse(b'resource "aws_instance" { }')
  • Whether the parser handles all HCL2 syntax variants beyond the core language specification.
  • Performance characteristics and memory overhead for parsing large configurations.
  • Compatibility with specific tree-sitter versions or ecosystem tooling beyond Python >=3.10.
Same gist for agents: .md · .json

What it is and what it does

tree-sitter-hcl is a tree-sitter grammar binding for parsing HCL and Terraform configuration files in Python. It wraps the tree-sitter incremental parsing engine, which builds a concrete syntax tree that can be queried and traversed programmatically. The package ships as precompiled wheels for most platforms, eliminating the need to build the grammar from source in typical use.

The parser is designed for developers who need to analyze, transform, or validate HCL configurations programmatically—common in infrastructure-as-code tooling, linters, and Terraform-related utilities. Testing against a real-world corpus of HCL files achieved 100% parse success rate across all files tested.

Use it for

  • Build a Terraform linter or static analyzer that inspects HCL syntax and structure.
  • Extract metadata from Terraform configurations such as resource names and variable definitions.
  • Implement IDE features like syntax highlighting and code completion for HCL editors.
  • Validate HCL configuration files before deployment in CI/CD pipelines.
  • Migrate or refactor Terraform code by programmatically rewriting the syntax tree.

Worth the install?

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

With conditions

Yes, if you need to parse or analyze HCL/Terraform files programmatically.

The package is stable with no known vulnerabilities and permissively licensed. Install friction is moderate due to compilation, but prebuilt wheels are available for common platforms. The aging maintenance status is acceptable for a grammar binding—updates are typically infrequent unless the underlying HCL specification changes.

Install

tree-sitter-hcl on PyPI

Before you install

Medium install friction due to compiled wheels; prebuilt binaries are available for common platforms (x86_64, ARM64, macOS, Linux, Windows). Repository remains active and unarchived, though last release was 424 days ago.

Requires Python >=3.10; compiled wheels provided for common platforms but may require a C compiler on unsupported architectures.

License in practice

Licensed under Apache-2.0 (permissive), allowing free use, modification, and distribution with minimal restrictions; suitable for both open-source and commercial projects.

Quickstart

pip install tree-sitter-hcl

from tree_sitter_hcl import language
parser = language.parser()
tree = parser.parse(b'resource "aws_instance" { }')

Verify before relying

  • Whether the parser handles all HCL2 syntax variants beyond the core language specification.
  • Performance characteristics and memory overhead for parsing large configurations.
  • Compatibility with specific tree-sitter versions or ecosystem tooling beyond Python >=3.10.

Package facts

LicenseApache-2.0 permissive
Python supportSupports the current Python release >=3.10
Install frictionMedium. Platform-specific wheel
Runtime dependenciesNone
MaintenanceAging 424 days since the last release
Last repo commit
First released
Downloads132,104 / month, #11,565 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Intended Audience :: DevelopersTopic :: Software Development :: CompilersTopic :: Text Processing :: LinguisticTyping :: Typed

Evidence: tree_sitter_hcl-1.2.0-cp310-abi3-macosx_10_9_x86_64.whl; tree_sitter_hcl-1.2.0-cp310-abi3-macosx_11_0_arm64.whl; tree_sitter_hcl-1.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; tree_sitter_hcl-1.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; tree_sitter_hcl-1.2.0-cp310-abi3-musllinux_1_2_x86_64.whl; tree_sitter_hcl-1.2.0-cp310-abi3-win_amd64.whl; tree_sitter_hcl-1.2.0-cp310-abi3-win_arm64.whl

Tags

Capabilities
HCL parsertree-sitter grammarterraform parsingincremental parsingHCL syntax analysisconfiguration language parsertree-sitter HCL
Topics
terraformparsingsyntax-tree
PyPI keywords
incrementalparsingtree-sitterhcl

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 › “HCL parser”

  • tree-sitter-hclProvides a tree-sitter parser grammar for HCL and Terraform, enabling…
  • pyhclParses HCL (HashiCorp Configuration Language) files into Python…
  • bc-python-hcl2Parses HCL2 configuration files (such as Terraform configs) into…

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

More Linguistic packages

charset-normalizer Worth it
PyPI · Utilities · released Aug 2026

Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.

permissive licensepure Python · 3.7+
1.7Bdownloads / mo
tiktoken Worth it
PyPI · Linguistic · released May 2026

tiktoken is a fast BPE tokenizer that converts text into token sequences compatible with OpenAI models, supporting multiple encoding schemes including o200k_base and model-specific encodings.

Install it if you work with OpenAI APIs or need to understand token boundaries in GPT-family models.

permissive licensecompiled wheel · 3.9+
233.0Mdownloads / mo
chardet Worth it
PyPI · Python Modules · released Aug 2026

Detects character encoding and language in byte sequences with high accuracy, supporting 99 encodings and returning confidence scores, language tags, and MIME types.

Install it if you need to detect character encoding or language in byte data; the rewrite makes it substantially faster and more accurate than its predecessors.

0BSDpure Python · 3.10+
199.0Mdownloads / mo
text-unidecode With conditions
PyPI · Python Modules · released Aug 2019

Converts Unicode text to ASCII by transliterating non-ASCII characters into their closest ASCII equivalents, with no runtime dependencies.

However, if transliteration quality or ongoing maintenance matters, consider unidecode instead despite its GPL-only license.

GPL-2.0-or-laterpure Pythonabandoned
89.0Mdownloads / mo
lark Worth it
PyPI · Python Modules · released Oct 2025

Lark is a parsing library that builds abstract syntax trees from context-free grammars, supporting multiple parsing algorithms (Earley, LALR(1), CYK) with automatic line and column tracking.

MITpure Python · 3.8+
79.7Mdownloads / mo
tree-sitter Worth it
PyPI · Linguistic · released Jun 2026

Python bindings to the tree-sitter parsing library, enabling incremental parsing and syntax tree analysis for source code.

MITcompiled wheel · 3.10+
79.0Mdownloads / mo

See also tree-sitter-elixir · tfparse · python-hcl2 · pyhcl · bc-python-hcl2 · tree-sitter-java · tree-sitter-go · tree-sitter-python · tree-sitter-sql · tree-sitter-powershell