The package tree-sitter-parsers
preinstalls tree-sitter parsers as shared libraries into your $HOME/.tree-sitter/tree-sitter-parsers-$(uname)
folder.
Usage:
import tree_sitter_parsers
The source code are extracted from official nodejs packages by the following script:
#!/bin/bash
for l in bash c cpp c-sharp css elm go html java javascript kotlin lua php python ruby rust scala solidity verilog yaml; do
npm pack tree-sitter-$l
done
for l in *.tgz; do
f=${l/.tgz/}
mkdir -p $f
tar xvfz $l --strip-components=1 -C $f
done
Here we can support more programming languages.
The script below tests the package:
rm -rf dist/*
python3 setup.py sdist bdist_wheel
pip uninstall tree_sitter_parsers -y
pip install dist/tree_sitter_parsers-*-py3-none-any.whl
rm -rf ~/.tree-sitter
python3 -c "import tree_sitter_parsers"
The script below uploads the package into Pypi archive:
twine upload dist/tree_sitter_parsers-*
pip uninstall tree_sitter_parsers -y
pip install tree_sitter_parsers