{"id":5733,"library":"tree-sitter-languages","title":"tree-sitter-languages","description":"The `tree-sitter-languages` library provides pre-compiled binary Python wheels for various Tree-sitter language parsers. It simplifies the setup for `py-tree-sitter` users by bundling common language grammars, eliminating the need for manual compilation. As of its last updates, the library is largely unmaintained, with official recommendations to consider `tree-sitter-language-pack` for active development and broader compatibility.","status":"deprecated","version":"1.10.2","language":"python","source_language":"en","source_url":"https://github.com/grantjenks/py-tree-sitter-languages","tags":["tree-sitter","parsing","syntax-tree","language-parsers","binary-wheels"],"install":[{"cmd":"pip install tree-sitter-languages","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"Provides the core Tree-sitter Python bindings; specific versions are required for compatibility.","package":"tree-sitter"}],"imports":[{"symbol":"get_language","correct":"from tree_sitter_languages import get_language"},{"symbol":"get_parser","correct":"from tree_sitter_languages import get_parser"}],"quickstart":{"code":"from tree_sitter_languages import get_language, get_parser\nimport tree_sitter # The underlying tree-sitter library\n\n# IMPORTANT: This library has known compatibility issues with newer versions of `tree-sitter`.\n# For versions of `tree-sitter-languages` up to 1.10.2, you might need to pin `tree-sitter`\n# to an earlier version for functionality, e.g., `pip install tree-sitter==0.21.3`.\n\ntry:\n    # Get a language object for Python\n    python_language = get_language('python')\n    print(f\"Loaded language: {python_language}\")\n\n    # Get a parser instance for Python\n    python_parser = get_parser('python')\n    print(f\"Created parser: {python_parser}\")\n\n    # Example usage: parse some Python code\n    code_bytes = b\"\"\"\n    def hello_world():\n        print('Hello, Tree-sitter!')\n    \"\"\"\n    tree = python_parser.parse(code_bytes)\n    \n    print(\"\\nParsed code:\")\n    print(code_bytes.decode())\n    print(\"\\nRoot node of the syntax tree (S-expression form):\")\n    print(tree.root_node.sexp())\n\nexcept ImportError as e:\n    print(f\"Error: {e}. Ensure 'tree-sitter-languages' and 'tree-sitter' are installed.\")\nexcept Exception as e:\n    print(f\"An error occurred during parsing: {e}. Check tree-sitter version compatibility.\")\n","lang":"python","description":"Demonstrates how to load a language and obtain a parser, then use it to parse a simple Python code snippet. It highlights the crucial dependency on `tree-sitter` and the potential need for version pinning."},"warnings":[{"fix":"Pin `tree-sitter` to an earlier, compatible version, such as `0.21.3`, when installing: `pip install tree-sitter-languages tree-sitter==0.21.3`.","message":"Versions of `tree-sitter` equal to or greater than `0.22` (especially `0.25.1` and higher) introduce breaking changes that are incompatible with `tree-sitter-languages`. Attempting to use newer `tree-sitter` versions will result in runtime errors.","severity":"breaking","affected_versions":"tree-sitter-languages all versions (when used with tree-sitter >= 0.22)"},{"fix":"Evaluate migrating your projects to `tree-sitter-language-pack` or another actively maintained Tree-sitter binding. Consult their documentation for equivalent usage patterns.","message":"The `tree-sitter-languages` library is largely unmaintained. The original maintainers recommend migrating to `tree-sitter-language-pack` for continued support, new features, and broader compatibility with modern `tree-sitter` versions.","severity":"deprecated","affected_versions":"All versions"},{"fix":"Ensure your Python environment can correctly utilize pre-compiled binary wheels (e.g., compatible OS/architecture). Do not attempt to install directly from source.","message":"Source installs of `tree-sitter-languages` are not supported. The library is distributed exclusively as pre-compiled binary wheels. Attempts to install from source will fail.","severity":"gotcha","affected_versions":"All versions"},{"fix":"After obtaining a `language` or `parser` object, refer to the `py-tree-sitter` documentation for its API to perform detailed parsing, analysis, and manipulation tasks.","message":"The API provided by `tree-sitter-languages` is extremely minimal, offering only `get_language` and `get_parser`. For any advanced operations, such as traversing the syntax tree, querying nodes, or modifying parsers, you must directly interact with the underlying `py-tree-sitter` library's API.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'activ':67 'binari':15,83 'binary-wheel':82 'broader':70 'bundl':36 'common':37 'compat':71 'compil':14,45 'consid':60 'develop':68 'elimin':40 'grammar':39 'languag':4,9,23,38,64,80 'language-pars':79 'larg':54 'last':49 'librari':10,52 'manual':44 'need':42 'offici':57 'pack':65 'pars':75 'parser':24,81 'pre':13 'pre-compil':12 'provid':11 'py':31 'py-tree-sitt':30 'python':16 'recommend':58 'setup':28 'simplifi':26 'sitter':3,8,22,33,63,74 'syntax':77 'syntax-tre':76 'tree':2,7,21,32,62,73,78 'tree-sitt':20,72 'tree-sitter-languag':1,6 'tree-sitter-language-pack':61 'unmaintain':55 'updat':50 'user':34 'various':19 'wheel':17,84","created_at":"2026-04-14T03:41:23.753583+00:00","updated_at":"2026-04-16T23:15:49.415110+00:00","problems":[{"fix":"Ensure the package is installed using `pip install tree-sitter-languages`.","cause":"The `tree-sitter-languages` package is not installed or is not accessible in the current Python environment.","error":"ModuleNotFoundError: No module named 'tree_sitter_languages'"},{"fix":"Try specifying an older version, e.g., `pip install tree-sitter-languages==1.8.0`, or consider `pip install tree-sitter-language-pack` as it is the actively maintained successor.","cause":"`pip` failed to find compatible pre-compiled binary wheels for your specific operating system and Python version, often due to the library being unmaintained for newer environments.","error":"ERROR: Could not find a version that satisfies the requirement tree-sitter-languages"},{"fix":"Always check if the result of `get_language()` or `get_parser()` is not `None` before using it, and ensure the language string is correct and supported by your installed version of `tree-sitter-languages`. For broader and updated language support, consider `tree-sitter-language-pack`.","cause":"The `get_language()` or `get_parser()` function returned `None` because the requested language was not found or supported, and subsequent code attempted to use this `None` object as a valid parser or language object.","error":"AttributeError: 'NoneType' object has no attribute 'parse'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.10.2","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/grantjenks/py-tree-sitter-languages","docs":"https://github.com/grantjenks/py-tree-sitter-languages","changelog":null,"pypi":"https://pypi.org/project/tree-sitter-languages/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-30","next_check":"2026-07-28","install_tag":null}}