3 unstable releases

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

#51 in Programming languages

Download history 456/week @ 2023-12-23 407/week @ 2023-12-30 681/week @ 2024-01-06 619/week @ 2024-01-13 767/week @ 2024-01-20 697/week @ 2024-01-27 689/week @ 2024-02-03 702/week @ 2024-02-10 613/week @ 2024-02-17 565/week @ 2024-02-24 643/week @ 2024-03-02 1842/week @ 2024-03-09 730/week @ 2024-03-16 502/week @ 2024-03-23 451/week @ 2024-03-30 682/week @ 2024-04-06

2,497 downloads per month
Used in 22 crates (7 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
~156K SLoC