Skip to content

Conversation

@henryiii
Copy link
Collaborator

Fix mypy on current types-setuptools versions.

@henryiii henryiii changed the title fix: handle generic setup return type fix(types): handle generic setup return type Dec 24, 2025
@henryiii henryiii requested a review from Copilot December 24, 2025 16:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes mypy compatibility with the latest types-setuptools versions (>=80.9) by implementing support for TypeVar with the default parameter. The changes add a compatibility layer for TypeVar with default parameter support and update the setup wrapper function to use generic type annotations.

  • Adds TypeVar compatibility wrapper in _compat/typing.py that supports the default parameter for Python versions < 3.13
  • Updates the setup function in setuptools/wrapper.py to use generic type parameters, allowing proper typing of the distclass parameter and return type
  • Updates types-setuptools version constraint to >=80.9, removing the exclusion of a problematic version

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/scikit_build_core/_compat/typing.py Adds TypeVar compatibility wrapper that strips the default parameter at runtime for Python < 3.13 while preserving it for type checking via typing_extensions
src/scikit_build_core/setuptools/wrapper.py Updates setup function signature to use generic TypeVar with default, improving type safety for the distclass parameter and return type
.pre-commit-config.yaml Updates types-setuptools version constraint from >=70.1,!=80.9.0.20251221 to >=80.9

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@henryiii henryiii merged commit abe44e0 into main Dec 24, 2025
70 checks passed
@henryiii henryiii deleted the henryiii/fix/setup_return_type branch December 24, 2025 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants