Skip to content

Add typing to more build tools #133403

@sobolevn

Description

@sobolevn
Member

Feature or enhancement

Right now we support typing in several build tools:

files =
Tools/build/compute-changes.py,
Tools/build/generate_sbom.py

I think that some other files / tools from this folder can benefit from being checked with mypy.

I have a PR ready for Tools/build/update_file.py of parser.c generation.
What else can be easily typed?

Linked PRs

Activity

added
infraCI, GitHub Actions, buildbots, Dependabot, etc.
type-featureA feature request or enhancement
on May 4, 2025
self-assigned this
on May 4, 2025
added 3 commits that reference this issue on May 4, 2025
9b37430
acc0ebe
63668b0
added a commit that references this issue on May 4, 2025
7c10f27
sobolevn

sobolevn commented on May 4, 2025

@sobolevn
MemberAuthor

Tools/build/verify_ensurepip_wheels.py also has annotations, but it is not checked. Will add in a separate PR, since it requires a bit of modification:

Tools/build/verify_ensurepip_wheels.py:41: error: Argument 1 to "print_error" has
incompatible type "Path"; expected "str"  [arg-type]
                    print_error(p, f"Found more than one wheel for package {package_n...
                                ^
Tools/build/verify_ensurepip_wheels.py:56: error: Argument 1 to "print_error" has
incompatible type "Path"; expected "str"  [arg-type]
                package_path,
                ^~~~~~~~~~~~
Tools/build/verify_ensurepip_wheels.py:66: error: Argument 1 to "print_error" has
incompatible type "Path"; expected "str"  [arg-type]
            print_error(package_path, f"Could not fetch JSON metadata for {package_na...
                        ^~~~~~~~~~~~
Tools/build/verify_ensurepip_wheels.py:76: error: Argument 1 to "print_error" has
incompatible type "Path"; expected "str"  [arg-type]
            print_error(package_path, f"No digest for {package_name} found from PyPI....
                        ^~~~~~~~~~~~
Tools/build/verify_ensurepip_wheels.py:82: error: Name "expected_digest" may be undefined 
[possibly-undefined]
        print(f"Expected digest: {expected_digest}")
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tools/build/verify_ensurepip_wheels.py:87: error: Argument 1 to "print_error" has
incompatible type "Path"; expected "str"  [arg-type]
                package_path, f"Failed to verify the checksum of the {package_name} w...
                ^~~~~~~~~~~~
Tools/build/verify_ensurepip_wheels.py:92: error: Argument 1 to "print_notice" has
incompatible type "Path"; expected "str"  [arg-type]
            package_path,
            ^~~~~~~~~~~~
Found 7 errors in 1 file (checked 4 source files)
                                          
sobolevn

sobolevn commented on May 4, 2025

@sobolevn
MemberAuthor

We should also merge #133405 before any other PR.

Flosckow

Flosckow commented on May 5, 2025

@Flosckow
Contributor

Can I work on it?

sobolevn

sobolevn commented on May 5, 2025

@sobolevn
MemberAuthor

@Flosckow sure, you can help with #133403 (comment) I haven't started yet :)

Thank you!

Flosckow

Flosckow commented on May 5, 2025

@Flosckow
Contributor

@Flosckowконечно, вы можете помочь с #133403 (комментарий) Я еще не начал :)

Спасибо!

Yes, I'll try to do this, the only thing I might be a little slow is this is my first pr in cpython.

sobolevn

sobolevn commented on May 5, 2025

@sobolevn
MemberAuthor

No worries, I can surely help with any questions you might have. Feel free to ask them :)

48 remaining items

added a commit that references this issue on Aug 12, 2025
added a commit that references this issue on Aug 12, 2025
added 2 commits that reference this issue on Aug 12, 2025
added a commit that references this issue on Aug 13, 2025
added 3 commits that reference this issue on Aug 13, 2025
added 2 commits that reference this issue on Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

infraCI, GitHub Actions, buildbots, Dependabot, etc.type-featureA feature request or enhancement

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @chrisgramberg678@sobolevn@Flosckow

      Issue actions

        Add typing to more build tools · Issue #133403 · python/cpython