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

gh-89610: Add syntax highlighting for .pyi files in IDLE #28950

Merged
merged 34 commits into from
Feb 13, 2022

Conversation

AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Oct 14, 2021

This commit adds syntax highlighting for .pyi files in IDLE.
It also adds an option to open Python stub files in the "File-open" dialogue,
and an option to save a file as a .pyi file in the "File-save" dialogue.

This commit adds syntax highlighting for `.pyi` files in IDLE.
It also adds an option to open Python stub files in the "File-open" dialogue,
and an option to save a file as a `.pyi` file in the "File-save" dialogue.
Lib/idlelib/browser.py Outdated Show resolved Hide resolved
Lib/idlelib/util.py Outdated Show resolved Hide resolved
Lib/idlelib/idle_test/test_util.py Outdated Show resolved Hide resolved
Lib/idlelib/util.py Outdated Show resolved Hide resolved
@AlexWaygood AlexWaygood added the type-feature A feature request or enhancement label Dec 6, 2021
@AlexWaygood
Copy link
Member Author

AlexWaygood commented Dec 6, 2021

@terryjreedy, would this be easier to review if I split it into several smaller PRs? 🙂 I'm happy to do so.

Copy link
Member

@terryjreedy terryjreedy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides inline comments, add file requested on issue.

Lib/idlelib/util.py Outdated Show resolved Hide resolved
Lib/idlelib/idle_test/test_browser.py Outdated Show resolved Hide resolved
from idlelib import util


class ExtensionTest(unittest.TestCase):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will condense the extension tests.

Lib/idlelib/browser.py Outdated Show resolved Hide resolved
Lib/idlelib/browser.py Outdated Show resolved Hide resolved
@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

AlexWaygood and others added 2 commits January 16, 2022 09:19
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
@AlexWaygood AlexWaygood reopened this Jan 18, 2022
@terryjreedy
Copy link
Member

  1. Manual test: are you sure that stub users will prefer a separate entry to load stub files?
  2. I should look at IDLE doc for possible revision.
  3. Please update branch after updating main: 'git merge origin/main' or whatever. (Good to do this before every uploaded commit(s).
  4. Change 'example.py' to 'example_stub.py' and add 'example_noext' (no extension) with #! line and 'normal' function.
  5. For me, updated coverage module is not working with updated main. (Submitted report.) Leave alone for now.

@AlexWaygood
Copy link
Member Author

I think that this is now ready to merge. In manual testing all of py, .pyw, .pyi, and '' files can be opened and are syntax-highlighted.

Thanks for all your help, Terry. Let me know if there's anything else you'd like me to do!

@terryjreedy
Copy link
Member

Reread the diff. Try the open on your system if different from Windows.

@terryjreedy terryjreedy merged commit 50cf499 into python:main Feb 13, 2022
@miss-islington
Copy link
Contributor

Thanks @AlexWaygood for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry, @AlexWaygood and @terryjreedy, I could not cleanly backport this to 3.10 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 50cf4991c49e19f917305dd7b9c71085c11edddb 3.10

@miss-islington
Copy link
Contributor

Sorry @AlexWaygood and @terryjreedy, I had trouble checking out the 3.9 backport branch.
Please backport using cherry_picker on command line.
cherry_picker 50cf4991c49e19f917305dd7b9c71085c11edddb 3.9

@AlexWaygood AlexWaygood deleted the idle-pyi-syntax-highlighting branch February 13, 2022 00:05
terryjreedy pushed a commit to terryjreedy/cpython that referenced this pull request Feb 13, 2022
…-28950)

Also add .pyi to the python extensions in the "File-open" and "File-save" dialogues.
Add util.py to contain objects that are used in multiple idlelib modules
and have no dependencies on any of them.

Co-authored-by: E-Paine <63801254+E-Paine@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
(cherry picked from commit 50cf499)
@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Feb 13, 2022
@bedevere-bot
Copy link

GH-31303 is a backport of this pull request to the 3.10 branch.

terryjreedy added a commit that referenced this pull request Feb 13, 2022
Also add .pyi to the python extensions in the "File-open" and "File-save" dialogues.
Add util.py to contain objects that are used in multiple idlelib modules
and have no dependencies on any of them.

Co-authored-by: E-Paine <63801254+E-Paine@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
(cherry picked from commit 50cf499)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 13, 2022
…-28950)

Also add .pyi to the python extensions in the "File-open" and "File-save" dialogues.
Add util.py to contain objects that are used in multiple idlelib modules
and have no dependencies on any of them.

Co-authored-by: E-Paine <63801254+E-Paine@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
(cherry picked from commit 50cf499)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
(cherry picked from commit 9fabcfb)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label Feb 13, 2022
@bedevere-bot
Copy link

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

miss-islington added a commit that referenced this pull request Feb 13, 2022
Also add .pyi to the python extensions in the "File-open" and "File-save" dialogues.
Add util.py to contain objects that are used in multiple idlelib modules
and have no dependencies on any of them.

Co-authored-by: E-Paine <63801254+E-Paine@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
(cherry picked from commit 50cf499)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
(cherry picked from commit 9fabcfb)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
@AlexWaygood
Copy link
Member Author

Thanks for all the time you spent reviewing this, @terryjreedy! Hugely appreciate it.

hello-adam pushed a commit to hello-adam/cpython that referenced this pull request Jun 2, 2022
…-28950)

Also add .pyi to the python extensions in the "File-open" and "File-save" dialogues.
Add util.py to contain objects that are used in multiple idlelib modules
and have no dependencies on any of them.

Co-authored-by: E-Paine <63801254+E-Paine@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
(cherry picked from commit 50cf499)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
(cherry picked from commit 9fabcfb)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
@terryjreedy terryjreedy changed the title bpo-45447: Add syntax highlighting for .pyi files in IDLE gh-89610: Add syntax highlighting for .pyi files in IDLE Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants