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

Add support for Python 3.8 and later #51

Open
Technologicat opened this issue Dec 10, 2020 · 5 comments
Open

Add support for Python 3.8 and later #51

Technologicat opened this issue Dec 10, 2020 · 5 comments
Assignees

Comments

@Technologicat
Copy link
Owner

We need to support ast.NamedExpr a.k.a. the walrus operator (name := value).

That's probably the only AST change that Pyan needs to be aware of. To be sure, check GTS, and mcpyrate's unparser (to which I added Python 3.8 support already).

@Technologicat
Copy link
Owner Author

Eh, there's also ast.Constant, to replace the old constant types (Num, Str, Bytes, NameConstant, Ellipsis). Python 3.6 already has ast.Constant, but doesn't use it; Python 3.8 changes the compiler to actually emit ast.Constant.

@jdb78
Copy link
Collaborator

jdb78 commented Jan 5, 2021

We currently have issues with projects that do not have an __init__.py in every directory that is a package.

@Technologicat
Copy link
Owner Author

@jdb78: good to know, thanks.

In other news, for 3.8, we should also add support for __pypackages__ (PEP 582 - Python local packages directory). The __pypackages__ directory itself needs to be omitted from the dotted name of the module when Pyan generates the fully qualified module name from a .py filename.

These should also be preferred over site-packages, but for that, maybe a simple rule to prefer earlier entries on the command line (plus instructions saying so) might be enough in practice.

@Technologicat Technologicat changed the title Add support for Python 3.8 Add support for Python 3.8 and later Feb 11, 2021
@Technologicat
Copy link
Owner Author

Heads-up for 3.9: the AST format has changed again. As of February 2021, this isn't yet documented in GTS.

Particularly, at least ast.Subscript now no longer has ast.Index and ast.ExtSlice containers. Good riddance, the new design is better - but the change causes some headaches to tools that rely on the AST format. (See Technologicat/mcpyrate#20.)

Might be that Pyan, in particular, doesn't have to care about this change - but it's something we should verify before adding a python39 label.

I don't know yet about other AST changes in 3.9 or 3.10. I'll keep an eye out for them.

@Technologicat Technologicat self-assigned this Jun 2, 2021
@Technologicat
Copy link
Owner Author

Technologicat commented Jun 27, 2022

No other AST changes in 3.9 or 3.10... except the new source location fields (end_lineno, end_col_offset), which we don't need here.

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

No branches or pull requests

2 participants