Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Python parser with ruff parser #5453

Draft
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

etaloof
Copy link

@etaloof etaloof commented Dec 2, 2024

This PR replaces the Python parser with the ruff Parser. It is based on the work of the earlier PR #5423 (thanks @qingshi163)! Code generation has been updated and should mostly work now. There is is still some work left to fix the built-in AST module, REPL (probably) and I haven't looked into WASM support.

Running the tests with cargo test --workspace --exclude rustpython_wasm --features freeze-stdlib gives me one remaining test failure: test_run_script in src/lib.rs. It seems fail when importing the extra_tests/snippets/dir_main but I am not sure why that happens.

Concerning the AST module: The previous implementation is using a lot of generated code (script). Not sure if we should continue updating this script, I'll look into it. @youknowone do you have any suggestions on this?

@youknowone
Copy link
Member

Thank you so much! Since ruff already has its own ast coworking with same parser, how about starting from ruff side again about it too?
I couldnt look in details yet, but i feel like code generated ast module is not cost efficient anymore. We now can borrow lots of code from other repository easy

@youknowone
Copy link
Member

@qingshi163 @coolreader18 do you also have advices?

@youknowone
Copy link
Member

I have to look in this PR, sorry for delay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants