Skip to content
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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ repos:
- rich
- setuptools-scm
- tomli
- "types-setuptools>=70.1,!=80.9.0.20251221"
- types-setuptools>=80.9

- repo: https://github.com/henryiii/check-sdist
rev: "v1.3.0"
Expand Down
17 changes: 16 additions & 1 deletion src/scikit_build_core/_compat/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,29 @@
def assert_never(_: object) -> None:
msg = "Expected code to be unreachable"
raise AssertionError(msg)

else:
from typing import Self, assert_never

if sys.version_info < (3, 13):
if typing.TYPE_CHECKING:
from typing_extensions import TypeVar
else:
# The final noqa is a false positive, see https://github.com/astral-sh/ruff/issues/22178
def TypeVar( # noqa: N802
*args: object,
default: object = None, # noqa: ARG001
**kwargs: object, # noqa: ARG001
) -> typing.TypeVar:
return typing.TypeVar(*args, **kwargs)
else:
from typing import TypeVar


__all__ = [
"Annotated",
"Self",
"TypeAlias",
"TypeVar",
"assert_never",
"get_args",
"get_origin",
Expand Down
17 changes: 15 additions & 2 deletions src/scikit_build_core/setuptools/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,22 @@
if TYPE_CHECKING:
from collections.abc import Callable, Sequence

from .._compat.typing import TypeVar

__all__ = ["setup"]


def __dir__() -> list[str]:
return __all__


_DistributionT = TypeVar(
"_DistributionT",
bound="setuptools._distutils.dist.Distribution",
default=setuptools.Distribution,
)


def setup(
*,
cmake_args: Sequence[str] = (),
Expand All @@ -25,8 +34,9 @@ def setup(
cmake_minimum_required_version: str | None = None,
cmake_process_manifest_hook: Callable[[list[str]], list[str]] | None = None,
cmake_install_target: str = "install",
distclass: type[_DistributionT] = setuptools.Distribution, # type: ignore[assignment]
**kw: Any,
) -> setuptools.Distribution:
) -> _DistributionT:
assert not cmake_install_dir, "cmake_install_dir not supported yet"
assert not cmake_with_sdist, "cmake_with_sdist not supported yet"
assert cmake_process_manifest_hook is None, (
Expand All @@ -41,5 +51,8 @@ def setup(
warnings.warn("Set via pyproject.toml", stacklevel=2)

return setuptools.setup(
cmake_source_dir=cmake_source_dir, cmake_args=cmake_args, **kw
cmake_source_dir=cmake_source_dir,
cmake_args=cmake_args,
distclass=distclass,
**kw,
)
Loading