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
bpo-41504: Add links to asttokens, leoAst, LibCST and parso #21773
Conversation
This comment has been minimized.
This comment has been minimized.
|
@gvanrossum I have just added my github name here. Perhaps this will mollify the bot. If not, I don't know what else to do. As noted in an edit to the first comment of this PR, I submitted this CLA yesterday. |
|
Don’t worry, there’s a delay. On Monday, try the “check yourself” UI again. |
|
On Sat, Aug 8, 2020 at 10:01 AM Guido van Rossum ***@***.***> wrote:
Don’t worry, there’s a delay. On Monday, try the “check yourself” UI again.
Thanks. Will do.
|
| `leoAst.py <http://leoeditor.com/appendices.html#leoast-py>`_ unifies the | ||
| token-based and parse-tree-based views of python programs by inserting | ||
| two-way links between tokens and ast nodes. |
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.
Is this a commonly-known tool? I never heard of it, until today.
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.
@edreamleo This is a reasonable question. What shall we say?
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.
@isidentical This is a perfectly reasonable question and it would be reasonable to omit the link to leoAst.py on the grounds of "obscurity". I'll make a pitch for inclusion below.
The first widely public announcement appeared here on July 25. I discussed it extensively on leo-editor late last year and earlier this year, but surely not many people read about it. This comment gives an overview of the history of the project.
Why many people may be interested in leoAst.py
In a private communication, Guido said, "I think your approach is fascinating -- visit the AST in token order and match up with the corresponding list of tokens, dealing with the various exceptional cases along the way."
In this comment, the section called "Applicability and Importance" contains:
Many python developers will find asttokens meets all their needs. asttokens is well documented and easy to use. Nevertheless, two-way links are significant additions to python's tokenize and ast modules:
-
Links from tokens to nodes are assigned to the nearest possible ast node, not the nearest statement, as in asttokens. Links can easily be reassigned, if desired.
-
The TOG and TOT classes are intended to be the foundation of tools such as fstringify and black.
-
The TOG class solves real problems, such as this FAQ.
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.
Oh, that looks like a pretty good approach but as far as I can see, it looks like a small utility file in a very big project. I guess that you are the maintainer of that project, so can you make any assertions about whether that simple utility will go into the official API of your editor and will be maintained or not?
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.
Yes, leoAst.py is part of Leo, a much bigger project. Leo's beautify and fstringify commands, defined in leoBeautify.py, use leoAst.py. All of Leo's sources have been processed with those commands.
I'll maintain leoAst.py while I am able. However, I am about to turn 71 years old. This post expresses my confidence that Leo will outlive me. A few days ago I wrote this post, asking for a volunteer to maintain leoAst.py. It's not a huge job, as described here.
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.
Thank you for the explanations, and all the work you have freely put into this. I'd be glad to see leoAst.py as a resource over there!
|
@isidentical Thank you. |
|
Thanks @edreamleo for the PR, and @gvanrossum for merging it |
|
Thanks @edreamleo for the PR, and @gvanrossum for merging it |
|
GH-21828 is a backport of this pull request to the 3.9 branch. |
|
GH-21829 is a backport of this pull request to the 3.8 branch. |
…ythonGH-21773) (cherry picked from commit e3c971c) Co-authored-by: Edward K. Ream <edreamleo@gmail.com>
…ast docs (GH-21773) (GH-21829) (cherry picked from commit e3c971c) Co-authored-by: Edward K. Ream <edreamleo@gmail.com> https://bugs.python.org/issue41504
@gvanrossum Here are the links we discussed. Except for the formatting of the rST links, the text is exactly as provided by these devs:
asttokens: Dmitry Sagalovskiy, dmitry@getgrist.com
parso: Dave Halter, davidhalter88@gmail.com
libCst: jimmylai, jimmylai@fb.com
Note 1: I submitted this CLA four hours ago. Is this the correct agreement?
Note 2: I have no idea why the bot thinks my user name is
@edreamleo. My user name is simply edreamleo.https://bugs.python.org/issue41504