3 releases (breaking)

0.19.0 Mar 9, 2021
0.17.0 Oct 27, 2020
0.16.1 Oct 26, 2020

#179 in Parser implementations

Download history 133/week @ 2021-01-13 7/week @ 2021-01-20 2/week @ 2021-01-27 50/week @ 2021-02-03 14/week @ 2021-02-10 29/week @ 2021-02-17 47/week @ 2021-02-24 102/week @ 2021-03-03 11/week @ 2021-03-10 27/week @ 2021-03-17 144/week @ 2021-03-24 103/week @ 2021-03-31 303/week @ 2021-04-07 89/week @ 2021-04-14 45/week @ 2021-04-21 50/week @ 2021-04-28

147 downloads per month
Used in 3 crates (via rust-code-analysis)

MIT license

1.5MB
53K SLoC

C 52K SLoC JavaScript 854 SLoC // 0.0% comments C++ 342 SLoC // 0.0% comments Scheme 112 SLoC // 0.0% comments Rust 43 SLoC // 0.1% comments

tree-sitter-python

This crate provides a Python grammar for the tree-sitter parsing library. To use this crate, add it to the [dependencies] section of your Cargo.toml file. (Note that you will probably also need to depend on the tree-sitter crate to use the parsed result in any useful way.)

[dependencies]
tree-sitter = "0.17"
tree-sitter-python = "0.17"

Typically, you will use the language function to add this grammar to a tree-sitter Parser, and then use the parser to parse some code:

let code = r#"
    def double(x):
        return x * 2
"#;
let mut parser = Parser::new();
parser.set_language(tree_sitter_python::language()).expect("Error loading Python grammar");
let parsed = parser.parse(code, None);

If you have any questions, please reach out to us in the tree-sitter discussions page.

Dependencies

~1.4–2MB
~52K SLoC