Python -> AST string -> Python #13123
Replies: 1 comment 2 replies
-
Can you describe your use case? Are you looking for some kind of API or do you just want to use Ruff's Python parser? For the latter, you can do so in your Rust project (example, https://github.com/fpgmaas/deptry/blob/4fa5a91c8e8d3d14466921808181e479a7543859/Cargo.toml#L21-L22, https://github.com/fpgmaas/deptry/blob/4fa5a91c8e8d3d14466921808181e479a7543859/src/imports/shared.rs#L25-L28). And, we also have a The following code is a reference that you can use to perform this roundtrip: ruff/crates/ruff_python_codegen/src/generator.rs Lines 1429 to 1435 in 8db147c |
Beta Was this translation helpful? Give feedback.
-
Is there any easy way to convert Python code into AST, then store this AST as some readable format that could be converted back into a Python code?
Beta Was this translation helpful? Give feedback.
All reactions