Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

FastParse Python Binding

Small ctypes binding for the FastParse native C library.

The binding keeps the same design boundary as the native library:

  • Python owns file I/O.
  • Python passes bytes already loaded in RAM.
  • FastParse returns JSON, CSV, MessagePack binary, diagnostics, or stats in RAM.
  • FastParse can execute Tree-sitter queries and return matches/captures in RAM.
  • Python copies the returned native buffer and frees the native result.

Install

From PyPI, once the package is published:

pip install --pre fastparse

From a downloaded wheel:

pip install fastparse-0.1.0rc17-py3-none-macosx_11_0_arm64.whl

The wheel includes the native library for its platform and py.typed markers for type-aware tooling, so normal users do not need FASTPARSE_LIBRARY_PATH.

Quick Use

from fastparse import FastParse, Field, OutputFormat, ParseOptions

parser = FastParse()
source = b"class Demo { void run() {} }"

result = parser.parse_bytes(
    source,
    ParseOptions(
        language="java",
        output_format=OutputFormat.JSON,
        fields=Field.RULE | Field.TEXT | Field.BYTE_RANGE,
    ),
)

print(result.node_count)
print(result.json())

Tree-sitter query output:

from fastparse import QueryOptions

query_result = parser.query_text(
    "class Demo { void run() {} }",
    "(method_declaration name: (identifier) @method.name) @method",
    QueryOptions(
        language="java",
        output_format=OutputFormat.JSON,
        fields=Field.CAPTURE_NAME | Field.RULE | Field.TEXT | Field.RANGE | Field.BYTE_RANGE,
    ),
)

print(query_result.json())

Binary MessagePack output:

result = parser.parse_bytes(
    source,
    language="java",
    output_format="binary",
    fields=["rule", "text", "byte_range"],
)

print(result.node_count)
print(result.data)  # MessagePack bytes

Decode binary output into Python dataclasses:

document = result.binary_document()
print(document.nodes[0].rule)
print(document.nodes[0].text)

If the caller only needs node/output counts and does not need to copy the generated JSON/CSV into Python:

summary = parser.parse_bytes_summary(
    source,
    language="java",
    output_format="json",
)

print(summary.node_count)
print(summary.output_length)

Use FASTPARSE_LIBRARY_PATH to point at a specific native library:

FASTPARSE_LIBRARY_PATH=/path/to/libfastparse.dylib python your_script.py

Examples

From the repository root:

python3 examples/python/03_binary_decode/binary_decode.py
python3 examples/python/04_inventory_to_sqlite/inventory_to_sqlite.py --workers 12
python3 examples/python/05_diagnostics_scan/diagnostics_scan.py /path/to/java/root --glob "*.java" --workers 12

04_inventory_to_sqlite is the enterprise pattern for high-throughput work: the parent Python app reads files, uses threads, decodes binary output into dataclasses, and writes SQLite tables outside the native library.

Metadata

Release files for fastparse 0.1.1rc1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for fastparse 0.1.1rc1
File
fastparse-0.1.1rc1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
fastparse-0.1.1rc1-py3-none-manylinux2014_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details
fastparse-0.1.1rc1-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
fastparse-0.1.1rc1-py3-none-macosx_10_15_x86_64.whl Python 3 none macOS 10.15+ x86-64 Details

Total release size: 700.3 kB

Release files / fastparse-0.1.1rc1-py3-none-win_amd64.whl

Download URL fastparse-0.1.1rc1-py3-none-win_amd64.whl
Size 146.4 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
46bc293bcb3abc055e19db0ffdcfa41e08426b133188b22d3950917b8f225a16
BLAKE2b-256 checksum
How to use checksums
3b5993d9b8a8df85f4801d378decbf644c241538a7209c4300018766d58a6fd1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 21, 2026.

Transparency log

Release files / fastparse-0.1.1rc1-py3-none-manylinux2014_x86_64.whl

Download URL fastparse-0.1.1rc1-py3-none-manylinux2014_x86_64.whl
Size 195.2 kB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
c17e2fc35f4454d7a0a87432fbc5f9b6f95f2fc2de2802dce31fb7ecad44bf64
BLAKE2b-256 checksum
How to use checksums
159c5929ece0ef8859972d758bbc585130464eb46f014368a4ee44d292601226
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 21, 2026.

Transparency log

Release files / fastparse-0.1.1rc1-py3-none-macosx_11_0_arm64.whl

Download URL fastparse-0.1.1rc1-py3-none-macosx_11_0_arm64.whl
Size 177.1 kB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ed3c75c3996e8f9e0a482e7d9186ba9a39f9629464b99a8e28e4d3c8206b3ca6
BLAKE2b-256 checksum
How to use checksums
ada8fa6153466b58fa353b0d4f4cde5d71fd5e6337f63871f9ff69b934300f2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 21, 2026.

Transparency log

Release files / fastparse-0.1.1rc1-py3-none-macosx_10_15_x86_64.whl

Download URL fastparse-0.1.1rc1-py3-none-macosx_10_15_x86_64.whl
Size 181.6 kB
Tags Python 3 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
b23fdec9b1b15e499d71995bb4a69816325dabc71d8dd229e5671c28fa2f3169
BLAKE2b-256 checksum
How to use checksums
535e5b2c8ec3cd7a41649e76c1c7d92ea7c42a43eb1c77f32a67721e85ac1bb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 21, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page