4 releases (2 breaking)

0.4.0 Aug 6, 2024
0.3.1 Apr 6, 2024
0.3.0 Aug 29, 2023
0.2.0 Jan 11, 2023

#148 in Rust patterns

Download history 12680/week @ 2025-01-28 14133/week @ 2025-02-04 15809/week @ 2025-02-11 19365/week @ 2025-02-18 15455/week @ 2025-02-25 21874/week @ 2025-03-04 26643/week @ 2025-03-11 18382/week @ 2025-03-18 17407/week @ 2025-03-25 16943/week @ 2025-04-01 21523/week @ 2025-04-08 34761/week @ 2025-04-15 43569/week @ 2025-04-22 22172/week @ 2025-04-29 8904/week @ 2025-05-06 11815/week @ 2025-05-13

93,206 downloads per month
Used in 43 crates (10 directly)

MIT and LGPL-3.0-only

425KB
12K SLoC

Rust 11K SLoC // 0.0% comments Python 2K SLoC // 0.2% comments

Python AST node definitions and utilities.

AST nodes are very similary defined like Python AST. But a few exceptions exist due to parser optimization. They can be transformed to matching Python-styled AST in reasonable cost.

[PythonArguments] is replaced by [Arguments]. The new [Arguments] type representation uses a new type [ArgWithDefault] to represent arguments with default values. See each type documentation for more details.

A few top-level sum types are renamed to human friendly names. [CmpOp] refers cmpop [UnaryOp] refers unaryop [BoolOp] refers boolop [WithItem] refers withitem [ExceptHandler] refers excepthandler


RustPython parser as a library

This project is forked from RustPython project. The parser is one of the core part of RustPython and Ruff project.

We try to keep these crates as a well-packaged library for more potential users.

Projects

  • RustPython is a Python interpreter
  • Ruff is an extremely fast Python linter
  • Pylyzer is a static code analyzer / language server for Python
  • Baembal is a Python package to accelerate ast.parse

Dependencies

~8.5MB
~161K SLoC