Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joranhonig/python-tree-sitter-types
Generate python types for tree-sitter parsers
https://github.com/joranhonig/python-tree-sitter-types
tree-sitter
Last synced: 14 days ago
JSON representation
Generate python types for tree-sitter parsers
- Host: GitHub
- URL: https://github.com/joranhonig/python-tree-sitter-types
- Owner: JoranHonig
- Created: 2022-12-12T14:47:39.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-14T11:33:59.000Z (almost 2 years ago)
- Last Synced: 2024-10-04T19:29:36.444Z (about 1 month ago)
- Topics: tree-sitter
- Language: Python
- Homepage:
- Size: 15.6 KB
- Stars: 6
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🔧 python-tree-sitter-types
[![Package Version](https://img.shields.io/pypi/v/tree-sitter-types)](https://pypi.org/project/tree-sitter-types/)This repository contains a python typed interface generation tool for tree-sitter grammars.
## Installation
Installation is simple with pip:
```bash
pip install tree-sitter-types
```## Usage
This library provides two functions.As a CLI you can use it to generate the types for your tree-sitter grammar:
```bash
python-tree-sitter-types node-types.json your_language_types.py
```You can then package these and distribute them on pypi, following tree-sitters naming standard `tree-sitter-yourlang`.
As a library it provides the functions to install tree-sitter parsers and to load them into python.
## Why is this useful?
Tree-sitter is a great library for parsing source code. It is fast, easy to use and has a lot of great features.
However, it is written in C and does not provide a typed interface for python. This makes writing tools on top of it a bit cumbersome.With this library you'll be able to use pythons types for your advantage, leveraging autocompletion for fast coding,
types for correctness, and nice features like matching.