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

bpo-41504: Add links to asttokens, leoAst, LibCST and parso #21773

Merged
merged 1 commit into from Aug 11, 2020
Merged

bpo-41504: Add links to asttokens, leoAst, LibCST and parso #21773

merged 1 commit into from Aug 11, 2020

Conversation

edreamleo
Copy link
Contributor

@edreamleo edreamleo commented Aug 7, 2020

@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

@the-knights-who-say-ni

This comment has been minimized.

Copy link
Member

@gvanrossum gvanrossum left a comment

LGTM. Please sign the contributor agreement.

@edreamleo
Copy link
Contributor Author

edreamleo commented Aug 8, 2020

@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.

@gvanrossum
Copy link
Member

gvanrossum commented Aug 8, 2020

Don’t worry, there’s a delay. On Monday, try the “check yourself” UI again.

@edreamleo
Copy link
Contributor Author

edreamleo commented Aug 8, 2020

`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.
Copy link
Sponsor Member

@isidentical isidentical Aug 10, 2020

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.

Copy link
Member

@gvanrossum gvanrossum Aug 10, 2020

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?

Copy link
Contributor Author

@edreamleo edreamleo Aug 10, 2020

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.

Copy link
Sponsor Member

@isidentical isidentical Aug 10, 2020

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?

Copy link
Contributor Author

@edreamleo edreamleo Aug 10, 2020

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.

Copy link
Sponsor Member

@isidentical isidentical Aug 11, 2020

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!

@edreamleo
Copy link
Contributor Author

edreamleo commented Aug 11, 2020

@isidentical Thank you.

@gvanrossum gvanrossum merged commit e3c971c into python:master Aug 11, 2020
4 checks passed
@miss-islington
Copy link
Contributor

miss-islington commented Aug 11, 2020

Thanks @edreamleo for the PR, and @gvanrossum for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9.
🐍🍒🤖 I'm not a witch! I'm not a witch!

@miss-islington
Copy link
Contributor

miss-islington commented Aug 11, 2020

Thanks @edreamleo for the PR, and @gvanrossum for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 11, 2020
…H-21773)

(cherry picked from commit e3c971c)

Co-authored-by: Edward K. Ream <edreamleo@gmail.com>
@bedevere-bot
Copy link

bedevere-bot commented Aug 11, 2020

GH-21828 is a backport of this pull request to the 3.9 branch.

@bedevere-bot
Copy link

bedevere-bot commented Aug 11, 2020

GH-21829 is a backport of this pull request to the 3.8 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 11, 2020
…H-21773)

(cherry picked from commit e3c971c)

Co-authored-by: Edward K. Ream <edreamleo@gmail.com>
gvanrossum pushed a commit to gvanrossum/cpython that referenced this pull request Aug 11, 2020
…ythonGH-21773)

(cherry picked from commit e3c971c)

Co-authored-by: Edward K. Ream <edreamleo@gmail.com>
gvanrossum pushed a commit that referenced this pull request Aug 11, 2020
…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 added a commit that referenced this pull request Aug 11, 2020
…ast docs (GH-21773) (GH-21830)

(cherry picked from commit e3c971c)

Co-authored-by: Edward K. Ream <edreamleo@gmail.com>

Co-authored-by: Edward K. Ream <edreamleo@gmail.com>
shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request Aug 20, 2020
xzy3 pushed a commit to xzy3/cpython that referenced this pull request Oct 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants