py-tree-sitter-builds
The py-tree-sitter project
(not to be confused with tree-sitter-python)
provides Python bindings for the awesome tree-sitter parsing library.
The documentation of py-tree-sitter says that you need to have a C compiler installed to use it,
but installing a C compiler can be highly non-trivial depending on which operating system you have.
It's also a huge dependency for what is otherwise a small and simple parsing library.
This project lets you use py-tree-sitter without a C compiler
by providing binary wheels that were built using a C compiler,
but don't require a C compiler to be installed.
The wheels contain:
Installation
$ pip install tree-sitter-builds
After installing, import tree_sitter
and import tree_sitter_languages
should work.
For documentation, see the documentation of:
How does it work?
Read .github/workflows/build.yml
to see how GitHub actions builds the wheels.
Here are the steps, at a high level:
- Download py-tree-sitter v0.20.1 and py-tree-sitter-languages v1.5.0 from GitHub
(these are the latest released versions at the time of writing this)
- Move downloaded files to the correct places,
so that the resulting wheels will contain both
tree_sitter
and tree_sitter_languages
- Apply patches to the tests of
tree_sitter
and tree_sitter_languages
so that they work here - Invoke cibuildwheel with the same configuration as py-tree-sitter-languages uses
- Once the above steps have ran on Windows, MacOS and Linux, upload the wheels to PyPI
License
The wheels consist of various parts licensed under MIT and Apache 2.0 licenses: