Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose bindings for python #59

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Conversation

keewis
Copy link

@keewis keewis commented Jan 21, 2025

py-tree-sitter somewhat recently had a major breaking release that removed Language.build_library and changed the signature of Language to:

import tree_sitter
import tree_sitter_<lang>

lang = tree_sitter.Language(tree_sitter_<lang>.language())

which means that using tree-sitter-rst from python requires language bindings.

If you merge the PR we'd have to publish to tree-sitter-rst on PyPI, which is currently published from py-tree-sitter-rst (cc @Carreau).

In this PR I've copied / adapted the binding implementation from tree-sitter-python, which works but may not be the most elegant. In particular, I had to include all the files that are usually auto-generated by tree-sitter from grammar.js (and any other requires files) in the sdist. Maybe it would be better to call tree-sitter build / tree-sitter generate while building the wheel instead?

tree-sitter also appears to have moved its configuration from package.json to tree-sitter.json, so this is included in the PR. If you prefer a smaller PR I can definitely move all of the automatic changes to a separate PR.

@Carreau
Copy link

Carreau commented Jan 21, 2025

Happy to give access to Pypi if someone wants it.

@stsewd
Copy link
Owner

stsewd commented Jan 28, 2025

Hi, sorry for replying late, I'll try to review it this weekend.

Happy to give access to Pypi if someone wants it.

Nice! I'll may be able to setup an action to publish to pypi. I'm stsewd on pypi.

@Carreau
Copy link

Carreau commented Jan 28, 2025

Invited.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants