tree-sitter-containerfile
A maintained Containerfile and Dockerfile grammar for tree-sitter.
This project is intended to be a reliable, actively maintained grammar for modern container build files, with published packages and generated bindings for Node.js, Python, Rust, Go, Swift, and C.
Why This Package
Containerfile and Dockerfile syntax continues to evolve across Docker, BuildKit, Podman, and related tooling. This grammar aims to close the gap for modern Dockerfile features, keep real-world fixtures parsing cleanly, and ship usable packages across the common tree-sitter binding ecosystems.
The historical tree-sitter-dockerfile npm package is not a dependable
installation target: it currently resolves to a 0.0.1-security placeholder
release. tree-sitter-containerfile is the maintained package name for this
grammar and its generated artifacts.
Installation
npm
npm install tree-sitter-containerfile
PyPI
pip install tree-sitter-containerfile
Cargo
cargo add tree-sitter-containerfile
Go
import containerfile "github.com/wharflab/tree-sitter-containerfile"
Usage
Node.js
import Parser from "tree-sitter";
import Containerfile from "tree-sitter-containerfile";
const parser = new Parser();
parser.setLanguage(Containerfile);
const tree = parser.parse("FROM alpine:3.20\nRUN echo ok\n");
console.log(tree.rootNode.toString());
Python
from tree_sitter import Language, Parser
import tree_sitter_containerfile
parser = Parser(Language(tree_sitter_containerfile.language()))
tree = parser.parse(b"FROM alpine:3.20\nRUN echo ok\n")
print(tree.root_node.sexp())
Rust
let mut parser = tree_sitter::Parser::new();
let language = tree_sitter_containerfile::LANGUAGE;
parser.set_language(&language.into()).unwrap();
let tree = parser.parse("FROM alpine:3.20\nRUN echo ok\n", None).unwrap();
println!("{}", tree.root_node().to_sexp());
Go
package main
import (
"fmt"
sitter "github.com/tree-sitter/go-tree-sitter"
containerfile "github.com/wharflab/tree-sitter-containerfile"
)
func main() {
parser := sitter.NewParser()
defer parser.Close()
_ = parser.SetLanguage(containerfile.GetLanguage())
tree := parser.Parse([]byte("FROM alpine:3.20\nRUN echo ok\n"), nil)
defer tree.Close()
fmt.Println(tree.RootNode().ToSexp())
}
Development
npm ci
npm run generate
tree-sitter test
The test suite includes the upstream corpus and integration parsing of the
real-world Containerfile fixtures in examples/.
Migration Notes
Spaced ENV values can span line continuations. Consumers that inspect
unquoted_string children should handle line_continuation nodes in addition
to expansion nodes, because the internal _spaced_env_value rule aliases those
values to unquoted_string.
Credits
This grammar started from
camdencheek/tree-sitter-dockerfile.
The project is being maintained and extended here under the
tree-sitter-containerfile package name.
License
Licensed under MIT.
The original MIT notice for the upstream grammar and fixtures is preserved in LICENSE-MIT-CamdenCheek.
Metadata
Release files for tree-sitter-containerfile 0.9.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| tree_sitter_containerfile-0.9.2.tar.gz | 58.2 kB | With provenance | Details |
Built distributions (wheels)
Total release size: 442.0 kB
Release files / tree_sitter_containerfile-0.9.2.tar.gz
| Download URL | tree_sitter_containerfile-0.9.2.tar.gz |
|---|---|
| Size | 58.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c7365153fcb37d9ad09453a165d8e768e998e0e09928158a37aabed0698700b9
|
|
BLAKE2b-256 checksum How to use checksums |
0787b5a407d7d9fa3a989c01db022e43383d10ade8c94a6d86a0a714b797e536
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 4, 2026.
Transparency logRelease files / tree_sitter_containerfile-0.9.2-cp310-abi3-win_arm64.whl
| Download URL | tree_sitter_containerfile-0.9.2-cp310-abi3-win_arm64.whl |
|---|---|
| Size | 37.4 kB |
| Tags | CPython 3.10 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
b7ee3d8c0fc718a9aca787e2d96e383a62f3a6ba65780debde908ff2beb5287c
|
|
BLAKE2b-256 checksum How to use checksums |
f4ab9b3ce56465664b75bd923be8429a0825df7bc672f2e4ed26544dc2867bd2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 4, 2026.
Transparency logRelease files / tree_sitter_containerfile-0.9.2-cp310-abi3-win_amd64.whl
| Download URL | tree_sitter_containerfile-0.9.2-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 38.2 kB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
3e2487743ddbaad2f255f9b17b93b7d97f466992b4627baafb3fe80e7ed4beab
|
|
BLAKE2b-256 checksum How to use checksums |
7f82ebc862ec8fcc1d698e76b04d0c174e7c96233be9a66bee0d5cdcda40890a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 4, 2026.
Transparency logRelease files / tree_sitter_containerfile-0.9.2-cp310-abi3-musllinux_1_2_x86_64.whl
| Download URL | tree_sitter_containerfile-0.9.2-cp310-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 58.5 kB |
| Tags | CPython 3.10 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
93d9bab4f7a39508a6b2954e2bded6a47f68d4bdf4e533532c11a387c65f0ad3
|
|
BLAKE2b-256 checksum How to use checksums |
a23ad575af8ff40f3c7fce3842160f52b2c4748ce52bbe6c5325e8ff08234459
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 4, 2026.
Transparency logRelease files / tree_sitter_containerfile-0.9.2-cp310-abi3-musllinux_1_2_aarch64.whl
| Download URL | tree_sitter_containerfile-0.9.2-cp310-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 58.5 kB |
| Tags | CPython 3.10 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
6e46a9226826f78abe1fe84c05eac8e808ce38e74d86cbf5db42f6d7e67cacab
|
|
BLAKE2b-256 checksum How to use checksums |
9f849524ef81d48d5a2b488d7eeae1dd42f67136408cc52327b3f2868be70dec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 4, 2026.
Transparency logRelease files / tree_sitter_containerfile-0.9.2-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | tree_sitter_containerfile-0.9.2-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 58.6 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
2aea1b436deb7d3d595a52da0885285bb2f61f0778da8ff37a2e2b77d3382ed4
|
|
BLAKE2b-256 checksum How to use checksums |
4c956e57d042508f6319cf06c99d924c90363a399c178a8cb378749eaacfc48f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 4, 2026.
Transparency logRelease files / tree_sitter_containerfile-0.9.2-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
| Download URL | tree_sitter_containerfile-0.9.2-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 59.4 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
329778ceb55904b3472072bd4fcf8d9666d69297be5e7fae8beb494bae0eae74
|
|
BLAKE2b-256 checksum How to use checksums |
e1d12682ef208f26f04ca433959c1ee2b856e1f13d61e129d9312e666472a69b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 4, 2026.
Transparency logRelease files / tree_sitter_containerfile-0.9.2-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | tree_sitter_containerfile-0.9.2-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 37.4 kB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
434f068285951f3bb84db600f7eafa1c1389ee9c7ad0c97498fcb8f4c26a0a52
|
|
BLAKE2b-256 checksum How to use checksums |
8560931d935aeca9486211ecd23111babe4a85f0a22e872dec5b0d18e5430ffd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 4, 2026.
Transparency logRelease files / tree_sitter_containerfile-0.9.2-cp310-abi3-macosx_10_9_x86_64.whl
| Download URL | tree_sitter_containerfile-0.9.2-cp310-abi3-macosx_10_9_x86_64.whl |
|---|---|
| Size | 35.8 kB |
| Tags | CPython 3.10 abi3 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
93b905d981de46bba3bbb810bfe16c7ee5888a10cbb6cbb40c25b13edcdf58b9
|
|
BLAKE2b-256 checksum How to use checksums |
c7f4fbf66d0b858d8ae17af4b7e1741e9bf1245995b855ab56c23f3a095dacdb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 4, 2026.
Transparency logSecurity for tree-sitter-containerfile 0.9.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 9 files in this release have been uploaded with provenance metadata.
Attestation for tree_sitter_containerfile-0.9.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 4, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.