py-tree-sitter
py-tree-sitter copied to clipboard
Distribute binary wheels with all languages?
I've used GitHub Actions in the past to distribute binary wheels. Would you be open to do that with py-tree-sitter?
Also, the current workflow for adding language support is hard to integrate with CI systems. For the sake of developer productivity, would it be possible to simply distribute all languages with the package by default?
I made this for the same purpose but just for the python language. Note this is not a binary wheel, but one that will compile tree-sitter-python on install. Would love to make it more generic and move it to this repo tho
https://github.com/NorthIsUp/tree-sitter-python-language
py-tree-sitter-languages
FYI I created https://github.com/grantjenks/py-tree-sitter-languages to distribute binary Python wheels with all tree-sitter languages supported.
Install
$ pip install tree_sitter_languages
Source installs are not supported. To see how the binary wheels are built, look at:
- setup.py — Python package setup.
- build.sh — Shell script to download support for all languages.
- build.py — Python script to build support for all languages.
- .github/workflows/release.yml — GitHub action to invoke cibuildwheel and release to PyPI.
Usage
from tree_sitter_languages import get_language, get_parser
language = get_language('python')
parser = get_parser('python')
That's the whole API!
Refer to py-tree-sitter for the language and parser API. Notice the Language.build_library(...) step can be skipped! The binary wheel includes the language binary.
I have a local branch that compiles languages directly into our library, I'm planning to put more work into that.
With either approach, you might want to be mindful of the parser licenses.
Good point about licenses. I checked them this morning and included a list at the bottom of the README: https://github.com/grantjenks/py-tree-sitter-languages#license
Parsers can now easily build wheels themselves with the updated bindings in https://github.com/tree-sitter/tree-sitter/commit/9e5bf6591fbf69f7cf79d178e4bcae98408bae40.