Skip to content

Python: Output JSON from tsg-python - #22527

Draft
tausbn wants to merge 1 commit into
mainfrom
tausbn/python-output-json-from-tsg-python
Draft

Python: Output JSON from tsg-python#22527
tausbn wants to merge 1 commit into
mainfrom
tausbn/python-output-json-from-tsg-python

Conversation

@tausbn

@tausbn tausbn commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Changes the current text-based dump of the tsg-python graph to the native JSON output that tree-sitter-graph provides. This saves us the hassle of parsing the output ourselves, including the recently added bug fix that allowed us to interpret Rust-style string escapes in Python.

As an added bonus, relying on the json module instead of our own parser roughly cuts the AST reconstruction time in half compared to previously, an extraction speedup in the neighbourhood of 3-4% (when tested on an extraction of python/cpython using only the tsg-python parser).

Changes the current text-based dump of the tsg-python graph to the
native JSON output that tree-sitter-graph provides. This saves us the
hassle of parsing the output ourselves, including the recently added bug
fix that allowed us to interpret Rust-style string escapes in Python.

As an added bonus, relying on the json module instead of our own parser
roughly cuts the AST reconstruction time in half compared to previously,
an extraction speedup in the neighbourhood of 3-4% (when tested on an
extraction of `python/cpython` using only the tsg-python parser).
@tausbn tausbn added the no-change-note-required This PR does not need a change note label Sep 8, 2026
@github-actions github-actions Bot added the Python label Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-change-note-required This PR does not need a change note Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant