Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-104050: Run mypy onclinic.py in CI#104421

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
AlexWaygood merged 16 commits intopython:mainfromAlexWaygood:clinic-mypy-check
May 15, 2023

Conversation

AlexWaygood
Copy link
Member

@AlexWaygoodAlexWaygood commentedMay 12, 2023
edited
Loading

Add a basic mypy check toclinic.py in CI (and add some initial type annotations, so that the mypy check passes).

The check will run:

  • On pushes tomain
  • On pull requests that touch files in theTools/clinic directory, and pull requests that touch the workflow file itself
  • When contributors manually request a workflow on their fork, viaworkflow_dispatch.

When itdoes run, mypy will only check files insideTools/clinic/. All other files will be excluded from the mypy check in CI.

The mypy configuration is also deliberately lax, to begin with: only a few of the stricter settings are enabled. This will allow us to make use of "gradual typing": mypy will only check functions insideTools/clinic/ that we've added annotations to. It will assume all other functions are to be ignored by mypy, for now; we will therefore be able to gradually increase the level of type annotations inside this directory.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I usually put my mypy config in apyproject.toml file these days, but amypy.ini file feels like it makes more "sense" unless we're planning on adding other linters/formatters to checkclinic.py in the future

erlend-aasland reacted with thumbs up emoji
AlexWaygoodand others added3 commitsMay 12, 2023 14:18
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
@@ -0,0 +1,2 @@
# Requirements file for external linters and checks we run on Tools/clinic/ in CI
mypy==1.2.0
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

We're deliberately pinning to an older version here, in order to test that dependabot updates are working on this file, as per@hugovk's suggestion in#104421 (comment)

Copy link
Member

@hugovkhugovk left a comment

Choose a reason for hiding this comment

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

CI changes look good 👍

AlexWaygood reacted with hooray emoji
@AlexWaygood
Copy link
MemberAuthor

AlexWaygood commentedMay 12, 2023
edited
Loading

(Thetest_zoneinfo failure is obviously unrelated.)

Edit: As is thetest_threading failure.

Copy link
Contributor

@erlend-aaslanderlend-aasland left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

AlexWaygood reacted with heart emojiAlexWaygood reacted with rocket emoji
@AlexWaygood
Copy link
MemberAuthor

LGTM. Thanks!

Very happy to help!

erlend-aasland reacted with heart emoji

@AlexWaygoodAlexWaygoodenabled auto-merge (squash)May 15, 2023 08:29
@AlexWaygoodAlexWaygood merged commit9d41f83 intopython:mainMay 15, 2023
@AlexWaygoodAlexWaygood deleted the clinic-mypy-check branchMay 15, 2023 10:22
carljm added a commit to carljm/cpython that referenced this pull requestMay 15, 2023
* main: (29 commits)pythongh-101819: Fix _io clinic input for unused base class method stubs (python#104418)pythongh-101819: Isolate `_io` (python#101948)  Bump mypy from 1.2.0 to 1.3.0 in /Tools/clinic (python#104501)pythongh-104494: Update certain Tkinter pack/place tests for Tk 8.7 errors (python#104495)pythongh-104050: Run mypy on `clinic.py` in CI (python#104421)pythongh-104490: Consistently define phony make targets (python#104491)pythongh-67056: document that registering/unregistering an atexit func from within an atexit func is undefined (python#104473)pythongh-104487: PYTHON_FOR_REGEN must be minimum Python 3.10 (python#104488)pythongh-101282: move BOLT config after PGO (pythongh-104493)pythongh-104469 Convert _testcapi/float.c to use AC (pythongh-104470)pythongh-104456: Fix ref leak in _ctypes.COMError (python#104457)pythongh-98539: Make _SSLTransportProtocol.abort() safe to call when closed (python#104474)pythongh-104337: Clarify random.gammavariate doc entry  (python#104410)  Minor improvements to typing docs (python#104465)pythongh-87092: avoid gcc warning on uninitialized struct field in assemble.c (python#104460)pythonGH-71383: IDLE - Document testing subsets of modules (python#104463)pythongh-104454: Fix refleak in AttributeError_reduce (python#104455)pythongh-75710: IDLE - add docstrings and comments to editor module (python#104446)pythongh-91896: Revert some very noisy DeprecationWarnings for `ByteString` (python#104424)  Add a mention of PYTHONBREAKPOINT to breakpoint() docs (python#104430)  ...
carljm added a commit to carljm/cpython that referenced this pull requestMay 15, 2023
* main: (204 commits)pythongh-101819: Fix _io clinic input for unused base class method stubs (python#104418)pythongh-101819: Isolate `_io` (python#101948)  Bump mypy from 1.2.0 to 1.3.0 in /Tools/clinic (python#104501)pythongh-104494: Update certain Tkinter pack/place tests for Tk 8.7 errors (python#104495)pythongh-104050: Run mypy on `clinic.py` in CI (python#104421)pythongh-104490: Consistently define phony make targets (python#104491)pythongh-67056: document that registering/unregistering an atexit func from within an atexit func is undefined (python#104473)pythongh-104487: PYTHON_FOR_REGEN must be minimum Python 3.10 (python#104488)pythongh-101282: move BOLT config after PGO (pythongh-104493)pythongh-104469 Convert _testcapi/float.c to use AC (pythongh-104470)pythongh-104456: Fix ref leak in _ctypes.COMError (python#104457)pythongh-98539: Make _SSLTransportProtocol.abort() safe to call when closed (python#104474)pythongh-104337: Clarify random.gammavariate doc entry  (python#104410)  Minor improvements to typing docs (python#104465)pythongh-87092: avoid gcc warning on uninitialized struct field in assemble.c (python#104460)pythonGH-71383: IDLE - Document testing subsets of modules (python#104463)pythongh-104454: Fix refleak in AttributeError_reduce (python#104455)pythongh-75710: IDLE - add docstrings and comments to editor module (python#104446)pythongh-91896: Revert some very noisy DeprecationWarnings for `ByteString` (python#104424)  Add a mention of PYTHONBREAKPOINT to breakpoint() docs (python#104430)  ...
@@ -2558,15 +2570,15 @@ class CConverter(metaclass=CConverterAutoRegister):
"""

# The C name to use for this variable.
name = None
name: str | None = None
Copy link
Contributor

@erlend-aaslanderlend-aaslandMay 16, 2023
edited
Loading

Choose a reason for hiding this comment

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

So, thesestr | None are now starting to cause frustrations, as I gradually add typing to other parts of clinic.py. Since there are no guards anywhere, I obviously get errors and warnings aboutstr plusNone, etc. Wecould change the defaults to the empty string, but that can also create a lot of havoc.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@JelleZijlstraJelleZijlstraJelleZijlstra left review comments

@sobolevnsobolevnsobolevn left review comments

@erlend-aaslanderlend-aaslanderlend-aasland approved these changes

@hugovkhugovkhugovk approved these changes

@ezio-melottiezio-melottiAwaiting requested review from ezio-melottiezio-melotti is a code owner

Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

6 participants
@AlexWaygood@JelleZijlstra@hugovk@sobolevn@erlend-aasland@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp