Skip to content

Commit 748f62c

Browse files
committed
chore: bump deps
Signed-off-by: Henry Schreiner <[email protected]>
1 parent 8e6e394 commit 748f62c

File tree

6 files changed

+43
-33
lines changed

6 files changed

+43
-33
lines changed

.pre-commit-config.yaml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ exclude: ^src/scikit_build_core/_vendor
77

88
repos:
99
- repo: https://github.com/pre-commit/pre-commit-hooks
10-
rev: v4.6.0
10+
rev: v5.0.0
1111
hooks:
1212
- id: check-added-large-files
1313
- id: check-case-conflict
@@ -25,7 +25,7 @@ repos:
2525
exclude: "^tests"
2626

2727
- repo: https://github.com/astral-sh/ruff-pre-commit
28-
rev: v0.6.9
28+
rev: v0.7.1
2929
hooks:
3030
- id: ruff
3131
args: ["--fix", "--show-fixes"]
@@ -39,7 +39,7 @@ repos:
3939
- id: rst-inline-touching-normal
4040

4141
- repo: https://github.com/adamchainz/blacken-docs
42-
rev: 1.18.0
42+
rev: 1.19.1
4343
hooks:
4444
- id: blacken-docs
4545
additional_dependencies: [black==24.*]
@@ -59,7 +59,7 @@ repos:
5959
exclude: "^tests|src/scikit_build_core/resources/scikit-build.schema.json|^docs/projects.md"
6060

6161
- repo: https://github.com/pre-commit/mirrors-mypy
62-
rev: v1.11.2
62+
rev: v1.13.0
6363
hooks:
6464
- id: mypy
6565
exclude: |
@@ -81,16 +81,17 @@ repos:
8181
- markdown-it-py<3 # Python 3.7 compat needed for mypy check
8282
- ninja
8383
- nox
84+
- orjson
8485
- packaging
85-
- pytest<8
86+
- pytest
8687
- pytest-subprocess
8788
- rich
8889
- setuptools-scm
8990
- tomli
9091
- types-setuptools>=70.1
9192

9293
- repo: https://github.com/henryiii/check-sdist
93-
rev: "v1.0.0"
94+
rev: "v1.2.0"
9495
hooks:
9596
- id: check-sdist
9697
args: [--inject-junk]
@@ -129,12 +130,12 @@ repos:
129130
additional_dependencies: [cogapp]
130131

131132
- repo: https://github.com/henryiii/validate-pyproject-schema-store
132-
rev: 2024.09.23
133+
rev: 2024.10.21
133134
hooks:
134135
- id: validate-pyproject
135136

136137
- repo: https://github.com/python-jsonschema/check-jsonschema
137-
rev: 0.29.3
138+
rev: 0.29.4
138139
hooks:
139140
- id: check-dependabot
140141
- id: check-github-workflows

pyproject.toml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,8 @@ dependencies = [
4242
"tomli >=1.2.2; python_version<'3.11'",
4343
"typing-extensions >=3.10.0; python_version<'3.9'",
4444
]
45-
# Note: for building wheels and sdists, there are also additional dependencies
46-
# in the pyproject extra. And cmake and possibly ninja if those are not already
47-
# present (user controllable)
45+
# Note: cmake and possibly ninja are also required if those are not already
46+
# present (user controllable) - but a system version is fine.
4847

4948
[project.optional-dependencies]
5049
pyproject = [
@@ -82,7 +81,7 @@ test-schema = [
8281
"validate-pyproject",
8382
]
8483
cov = [
85-
"pytest-cov[toml]",
84+
"pytest-cov",
8685
]
8786
wheels = [
8887
"cmake",
@@ -126,8 +125,11 @@ version.source = "vcs"
126125
build.hooks.vcs.version-file = "src/scikit_build_core/_version.py"
127126

128127

129-
[tool.uv.pip]
130-
reinstall-package = ["scikit-build-core"]
128+
[tool.uv]
129+
dev-dependencies = ["scikit-build-core[test,test-hatchling,test-meta,test-numpy,test-schema,cov,dev]"]
130+
environments = ["python_version >= '3.11'"]
131+
pip.reinstall-package = ["scikit-build-core"]
132+
workspace.members = ["tmp/hello/hello"]
131133

132134

133135
[tool.pytest.ini_options]
@@ -222,7 +224,7 @@ ignore = ["W002"] # Triggers on __init__.py's
222224

223225

224226
[tool.ruff]
225-
exclude = ["src/scikit_build_core/_vendor/*"] # Required due to "build" module
227+
exclude = ["src/scikit_build_core/_vendor/*"]
226228

227229
[tool.ruff.lint]
228230
extend-select = [

src/scikit_build_core/file_api/reply.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def make_class(self, data: InputDict, target: Type[T]) -> T:
5656
):
5757
return self._load_from_json(Path(data["jsonFile"]), target)
5858

59-
input_dict = {}
59+
input_dict: Dict[str, Type[Any]] = {}
6060
exceptions: List[Exception] = []
6161

6262
# We don't have DataclassInstance exposed in typing yet
@@ -65,12 +65,14 @@ def make_class(self, data: InputDict, target: Type[T]) -> T:
6565
"cmakefiles", "cmakeFiles"
6666
)
6767
if json_field in data:
68+
field_type = field.type
69+
assert isinstance(field_type, type)
6870
try:
6971
input_dict[field.name] = self._convert_any(
70-
data[json_field], field.type
72+
data[json_field], field_type
7173
)
7274
except TypeError as err:
73-
msg = f"Failed to convert field {field.name!r} of type {field.type}"
75+
msg = f"Failed to convert field {field.name!r} of type {field_type}"
7476
if sys.version_info < (3, 11):
7577
err.__notes__ = [*getattr(err, "__notes__", []), msg] # type: ignore[attr-defined]
7678
else:

src/scikit_build_core/settings/documentation.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,14 @@ def mk_docs(dc: type[object], prefix: str = "") -> Generator[DCDoc, None, None]:
6969
docs = pull_docs(dc)
7070

7171
for field in dataclasses.fields(dc):
72-
if dataclasses.is_dataclass(field.type):
73-
yield from mk_docs(field.type, prefix=f"{prefix}{field.name}.")
72+
field_type = field.type
73+
if isinstance(field_type, type) and dataclasses.is_dataclass(field_type):
74+
yield from mk_docs(field_type, prefix=f"{prefix}{field.name}.")
7475
continue
7576

7677
if get_origin(field.type) is list:
7778
field_type = get_args(field.type)[0]
79+
assert isinstance(field_type, type)
7880
if dataclasses.is_dataclass(field_type):
7981
yield from mk_docs(field_type, prefix=f"{prefix}{field.name}[].")
8082
continue

src/scikit_build_core/settings/json_schema.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ def to_json_schema(dclass: type[Any], *, normalize_keys: bool) -> dict[str, Any]
2929
errs = []
3030
required = []
3131
for field in dataclasses.fields(dclass):
32-
if dataclasses.is_dataclass(field.type):
32+
field_type = field.type
33+
if isinstance(field_type, type) and dataclasses.is_dataclass(field.type):
3334
props[field.name] = to_json_schema(
34-
field.type, normalize_keys=normalize_keys
35+
field_type, normalize_keys=normalize_keys
3536
)
3637
continue
3738

@@ -110,7 +111,7 @@ def to_json_schema(dclass: type[Any], *, normalize_keys: bool) -> dict[str, Any]
110111

111112

112113
def convert_type(t: Any, *, normalize_keys: bool) -> dict[str, Any]:
113-
if dataclasses.is_dataclass(t):
114+
if isinstance(t, type) and dataclasses.is_dataclass(t):
114115
return to_json_schema(t, normalize_keys=normalize_keys)
115116
if t is str or t is Path or t is Version or t is SpecifierSet:
116117
return {"type": "string"}

src/scikit_build_core/settings/sources.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def _process_annotated(target: type[Any]) -> tuple[Any, tuple[Any, ...]]:
122122
return target, ()
123123

124124

125-
def _get_target_raw_type(target: type[Any]) -> Any:
125+
def _get_target_raw_type(target: type[Any] | Any) -> Any:
126126
"""
127127
Takes a type like ``Optional[str]`` and returns str, or ``Optional[Dict[str,
128128
int]]`` and returns dict. Returns Union for a Union with more than one
@@ -151,12 +151,14 @@ def _get_inner_type(__target: type[Any]) -> type[Any]:
151151
raise AssertionError(msg)
152152

153153

154-
def _nested_dataclass_to_names(__target: type[Any], *inner: str) -> Iterator[list[str]]:
154+
def _nested_dataclass_to_names(
155+
__target: type[Any] | Any, *inner: str
156+
) -> Iterator[list[str]]:
155157
"""
156158
Yields each entry, like ``("a", "b", "c")`` for ``a.b.c``.
157159
"""
158160

159-
if dataclasses.is_dataclass(__target):
161+
if isinstance(__target, type) and dataclasses.is_dataclass(__target):
160162
for field in dataclasses.fields(__target):
161163
yield from _nested_dataclass_to_names(field.type, *inner, field.name)
162164
else:
@@ -194,7 +196,7 @@ def get_item(self, *fields: str, is_dict: bool) -> Any:
194196
...
195197

196198
@classmethod
197-
def convert(cls, item: Any, target: type[Any]) -> object:
199+
def convert(cls, item: Any, target: type[Any] | Any) -> object:
198200
"""
199201
Convert an ``item`` from the base representation of the source's source
200202
into a ``target`` type. Raises TypeError if the conversion fails.
@@ -246,7 +248,7 @@ def get_item(
246248
raise KeyError(msg)
247249

248250
@classmethod
249-
def convert(cls, item: str, target: type[Any]) -> object:
251+
def convert(cls, item: str, target: type[Any] | Any) -> object:
250252
"""
251253
Convert an item from the environment (always a string) into a target type.
252254
"""
@@ -322,7 +324,7 @@ def _unrecognized_dict(
322324
continue
323325
(inner_option_field,) = matches
324326
inner_option = inner_option_field.type
325-
if dataclasses.is_dataclass(inner_option):
327+
if isinstance(inner_option, type) and dataclasses.is_dataclass(inner_option):
326328
yield from _unrecognized_dict(
327329
settings[keystr], inner_option, (*above, keystr)
328330
)
@@ -386,7 +388,7 @@ def get_item(
386388

387389
@classmethod
388390
def convert(
389-
cls, item: str | list[str] | dict[str, str] | bool, target: type[Any]
391+
cls, item: str | list[str] | dict[str, str] | bool, target: type[Any] | Any
390392
) -> object:
391393
target, _ = _process_annotated(target)
392394
raw_target = _get_target_raw_type(target)
@@ -484,13 +486,13 @@ def get_item(self, *fields: str, is_dict: bool) -> Any: # noqa: ARG002
484486
raise KeyError(msg) from None
485487

486488
@classmethod
487-
def convert(cls, item: Any, target: type[Any]) -> object:
489+
def convert(cls, item: Any, target: type[Any] | Any) -> object:
488490
"""
489491
Convert an ``item`` from TOML into a ``target`` type.
490492
"""
491493
target, annotations = _process_annotated(target)
492494
raw_target = _get_target_raw_type(target)
493-
if dataclasses.is_dataclass(raw_target):
495+
if isinstance(raw_target, type) and dataclasses.is_dataclass(raw_target):
494496
fields = dataclasses.fields(raw_target)
495497
values = ((k.replace("-", "_"), v) for k, v in item.items())
496498
return raw_target(
@@ -579,7 +581,7 @@ def convert_target(self, target: type[T], *prefixes: str) -> T:
579581
errors = []
580582
prep: dict[str, Any] = {}
581583
for field in dataclasses.fields(target): # type: ignore[arg-type]
582-
if dataclasses.is_dataclass(field.type):
584+
if isinstance(field.type, type) and dataclasses.is_dataclass(field.type):
583585
try:
584586
prep[field.name] = self.convert_target(
585587
field.type, *prefixes, field.name

0 commit comments

Comments
 (0)