Skip to main content

astchunk-extended

Drop-in replacement for astchunk with dynamic multi-language support.

What's different

  • 15 languages instead of 4 (C, C++, Go, Rust, Ruby, Bash, Kotlin, Scala, Lua, PHP, Zig + original Python, Java, C#, TypeScript)
  • Dynamic parser discovery — if a tree-sitter parser is installed, it works automatically
  • No hardcoded imports — parsers loaded via importlib on demand
  • Optional extras — install only the languages you need

Installation

# All languages
pip install astchunk-extended[all]

# Or pick what you need
pip install astchunk-extended[core]        # Python, Java, C#, TypeScript
pip install astchunk-extended[systems]     # C, C++, Go, Rust, Zig
pip install astchunk-extended[scripting]   # Ruby, Bash, Lua, PHP
pip install astchunk-extended[jvm]         # Java, Kotlin, Scala

With LEANN:

uv tool install leann-core --with leann --with "astchunk-extended[all]"
python -c "from astchunk.patch_leann import apply; apply()"

Usage

from astchunk import ASTChunkBuilder, get_available_languages

# See what's installed
print(get_available_languages())
# ['bash', 'c', 'cpp', 'go', 'java', 'kotlin', 'lua', 'php', 'python', 'rust', ...]

# Chunk C++ code
builder = ASTChunkBuilder(max_chunk_size=300, language="cpp", metadata_template="default")
chunks = builder.chunkify(code)

Custom languages

from astchunk import register_language

register_language("haskell", "tree_sitter_haskell")
builder = ASTChunkBuilder(max_chunk_size=300, language="haskell", metadata_template="default")

License

MIT (same as upstream astchunk)

Metadata

Release files for astchunk-extended 0.2.0

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

Source distribution (sdist)

Source distribution for astchunk-extended 0.2.0
File Size Uploaded
astchunk_extended-0.2.0.tar.gz 14.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for astchunk-extended 0.2.0
File Interpreter ABI Platform
astchunk_extended-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 30.1 kB

Release files / astchunk_extended-0.2.0.tar.gz

Download URL astchunk_extended-0.2.0.tar.gz
Size 14.7 kB
Tags Source
SHA-256 checksum
How to use checksums
82c93e5b16c632635cd8c5284e39aa08fae8385755d631b5c6c4c2e1e1fe16fe
BLAKE2b-256 checksum
How to use checksums
ad007d7c6bdf189c96c9fa91350c8715eb02822c58eeec5e77ba6148c1f75563
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.2

Release files / astchunk_extended-0.2.0-py3-none-any.whl

Download URL astchunk_extended-0.2.0-py3-none-any.whl
Size 15.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c58507f473c8d8a717f196557a399e83a4c5de02d243e4c0828324027d263c70
BLAKE2b-256 checksum
How to use checksums
b2b1d3c7afcaf38cb0456d91a4ad7b6e3be1c9b5631f7e97d3340263c7dda696
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.2

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

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