Skip to content

gh-133403: Type Tools/build/verify_ensurepip_wheels.py and check it with mypy #133453

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

Merged
merged 8 commits into from
May 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ on:
- "Lib/test/libregrtest/**"
- "Lib/tomllib/**"
- "Misc/mypy/**"
- "Tools/build/compute-changes.py"
- "Tools/build/generate_sbom.py"
- "Tools/build/verify_ensurepip_wheels.py"
- "Tools/build/update_file.py"
- "Tools/cases_generator/**"
- "Tools/clinic/**"
- "Tools/jit/**"
Expand Down
4 changes: 4 additions & 0 deletions Tools/build/mypy.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
[mypy]

# Please, when adding new files here, also add them to:
# .github/workflows/mypy.yml
files =
Tools/build/compute-changes.py,
Tools/build/generate_sbom.py,
Tools/build/verify_ensurepip_wheels.py,
Tools/build/update_file.py

pretty = True
Expand Down
6 changes: 4 additions & 2 deletions Tools/build/verify_ensurepip_wheels.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
GITHUB_ACTIONS = os.getenv("GITHUB_ACTIONS") == "true"


def print_notice(file_path: str, message: str) -> None:
def print_notice(file_path: str | Path, message: str) -> None:
if GITHUB_ACTIONS:
message = f"::notice file={file_path}::{message}"
print(message, end="\n\n")


def print_error(file_path: str, message: str) -> None:
def print_error(file_path: str | Path, message: str) -> None:
if GITHUB_ACTIONS:
message = f"::error file={file_path}::{message}"
print(message, end="\n\n")
Expand Down Expand Up @@ -67,6 +67,7 @@ def verify_wheel(package_name: str) -> bool:
return False

release_files = json.loads(raw_text)["releases"][package_version]
expected_digest = ""
for release_info in release_files:
if package_path.name != release_info["filename"]:
continue
Expand Down Expand Up @@ -95,6 +96,7 @@ def verify_wheel(package_name: str) -> bool:
return True



if __name__ == "__main__":
exit_status = int(not verify_wheel("pip"))
raise SystemExit(exit_status)
Loading