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

Support parsing python 3.9/3.10 syntax for dependency inference #10922

Closed
cosmicexplorer opened this issue Oct 7, 2020 · 2 comments
Closed
Assignees

Comments

@cosmicexplorer
Copy link
Contributor

While we became able to parse python 3.8 syntax using libCST via #10907 regardless of the pants python version, we lost the ability to parse e.g. python 3.9 syntax by running pants with python 3.9. We could introduce a workaround using just the ast module as we did before #10907, but it would be fantastic if we could instead contribute that change to libCST itself!

Instagram/LibCST#285 describes that it's likely no major changes to the parser will be necessary until after 3.10, so it's likely to be more feasible to do this for 3.9 and 3.10 than for later.

Let's make sure we search for any existing issues in that repo describing progress on 3.9 support before diving in!

@Eric-Arellano Eric-Arellano self-assigned this Nov 13, 2020
@Eric-Arellano Eric-Arellano changed the title support parsing python 3.9/3.10 syntax with libCST Support parsing python 3.9/3.10 syntax for dependency inference Nov 13, 2020
@Eric-Arellano
Copy link
Contributor

@jsirois pointed out the sensible fix for this is to stop "cheating" by parsing the Python AST in-memory through Pants. Instead, we should be subprocessing. While this may have a perf hit, we are going to need to subprocess for most other languages, so we should figure this out earlier.

This completely solves the interpreter constraints issue. We will choose the interpreter based on the interpreter_constrains field, like we always do. Then use the builtin ast module, rather than typed-ast. No need for guessing what the file is.

I'll be working on this the next week as part of a broader push to support Pants on more platforms.

@Eric-Arellano
Copy link
Contributor

Fixed by #11213.

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

No branches or pull requests

2 participants