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
Add tests for new python syntax #219
base: main
Are you sure you want to change the base?
Conversation
I think we use RustPython's parser, but the dependency is pinned to this commit - RustPython/RustPython@b9ed63e, which is 1409 commits behind RustPython/RustPython@b9ed63e...main. |
it looks like ruff doesn't seem to have an external parser dependency: https://github.com/astral-sh/ruff/blob/main/crates/ruff_python_parser/Cargo.toml I wonder if we can depend on their parser since I think that is fairly well tested across a bunch of code bases. |
Another alternative would be to depend on the native CPython ast parser and dump it into json with something like https://pypi.org/project/ast2json/ then parse import in rust or perhaps just do this whole thing in python, but that would mean starting brining dependencies outside of rust ecosystem which is big design decision. |
FWIW I found more constructs that don't work, I think it was mostly around the new |
value = 1 | ||
args = [int, float] | ||
# this is a legal-in-runtime construction | ||
def perform_cast(value, Union[*args]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is legal?
I merged main to pickup: #237 That should fix match issues, but your test surprises me that it is legal syntax. |
Thank you, yes the |
Hello!
Here are tests that are legal python syntax (i.e. https://github.com/astral-sh/ruff parses it fine) but they are currently failing
I'm not sure that currently used parser is a good long-term choice to avoid that kind of problems.
Maybe we can switch to ruff parser altogether?