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

#16 in Programming languages

Download history 24411/week @ 2024-12-01 21342/week @ 2024-12-08 17571/week @ 2024-12-15 1494/week @ 2024-12-22 3368/week @ 2024-12-29 22210/week @ 2025-01-05 21143/week @ 2025-01-12 12105/week @ 2025-01-19 12771/week @ 2025-01-26 14202/week @ 2025-02-02 16483/week @ 2025-02-09 11765/week @ 2025-02-16 22765/week @ 2025-02-23 18707/week @ 2025-03-02 27039/week @ 2025-03-09 18575/week @ 2025-03-16

88,091 downloads per month
Used in 42 crates (10 directly)

MIT and LGPL-3.0-only

425KB
12K SLoC

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

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

lib.rs:

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

Dependencies

~8.5MB
~158K SLoC