tlaplus-community / tree-sitter-tlaplus

A tree-sitter grammar for TLA⁺ and PlusCal
MIT License
57 stars 10 forks source link

Python consumer example doesn't work with tree-sitter ≥ 0.23 #124

Closed smheidrich closed 2 months ago

smheidrich commented 2 months ago

Running the Python consumer example with a 0.23.* version of the tree-sitter Python package results in this exception:

Traceback (most recent call last):
  File "example.py", line 14, in <module>
    for node, capture_name in query.captures(tree.root_node):
        ^^^^^^^^^^^^^^^^^^
ValueError: too many values to unpack (expected 2)

This is due to a change mentioned in the 0.23.0 release notes:

Query.captures(...)

  • [...]
    • Return type was changed to dict[str, list[Node]].

It might make sense to pin the tree-sitter version (or version range) in the example's requirements.txt file to avoid similar issues going forward (but then you probably need something like Renovate to try and auto-update the version periodically).

ahelwer commented 2 months ago

Thanks for the report and sorry for the inconvenience! I think you're right that pinning is probably the way to go. Unpinned versions made sense when there were weekly-ish changes going in so the consumers were regularly exercised by the CI, but since the grammar is basically feature-complete at this point we can assume changes will not come more regularly in the future.