Skip to content

Commit b6887be

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

File tree

6 files changed

+49
-30
lines changed

6 files changed

+49
-30
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: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,15 @@ 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+
assert isinstance(field_type, type)
74+
if dataclasses.is_dataclass(field_type):
75+
yield from mk_docs(field_type, prefix=f"{prefix}{field.name}.")
7476
continue
7577

7678
if get_origin(field.type) is list:
7779
field_type = get_args(field.type)[0]
80+
assert isinstance(field_type, type)
7881
if dataclasses.is_dataclass(field_type):
7982
yield from mk_docs(field_type, prefix=f"{prefix}{field.name}[].")
8083
continue

src/scikit_build_core/settings/json_schema.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ 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+
field_type = field.type
33+
assert isinstance(field_type, type)
3234
if dataclasses.is_dataclass(field.type):
3335
props[field.name] = to_json_schema(
34-
field.type, normalize_keys=normalize_keys
36+
field_type, normalize_keys=normalize_keys
3537
)
3638
continue
3739

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

111113

112114
def convert_type(t: Any, *, normalize_keys: bool) -> dict[str, Any]:
113-
if dataclasses.is_dataclass(t):
115+
if isinstance(t, type) and dataclasses.is_dataclass(t):
114116
return to_json_schema(t, normalize_keys=normalize_keys)
115117
if t is str or t is Path or t is Version or t is SpecifierSet:
116118
return {"type": "string"}

src/scikit_build_core/settings/sources.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ def _dig_fields(__opt: Any, *names: str) -> Any:
9494
return __opt
9595

9696

97+
def _field_type(__field: dataclasses.Field[Any]) -> type[Any]:
98+
field_type = __field.type
99+
assert isinstance(field_type, type)
100+
return field_type
101+
102+
97103
def _process_union(target: type[Any]) -> Any:
98104
"""
99105
Filters None out of Unions. If a Union only has one item, return that item.
@@ -158,7 +164,9 @@ def _nested_dataclass_to_names(__target: type[Any], *inner: str) -> Iterator[lis
158164

159165
if dataclasses.is_dataclass(__target):
160166
for field in dataclasses.fields(__target):
161-
yield from _nested_dataclass_to_names(field.type, *inner, field.name)
167+
yield from _nested_dataclass_to_names(
168+
_field_type(field), *inner, field.name
169+
)
162170
else:
163171
yield list(inner)
164172

@@ -321,7 +329,7 @@ def _unrecognized_dict(
321329
yield ".".join((*above, keystr))
322330
continue
323331
(inner_option_field,) = matches
324-
inner_option = inner_option_field.type
332+
inner_option = _field_type(inner_option_field)
325333
if dataclasses.is_dataclass(inner_option):
326334
yield from _unrecognized_dict(
327335
settings[keystr], inner_option, (*above, keystr)
@@ -490,12 +498,12 @@ def convert(cls, item: Any, target: type[Any]) -> object:
490498
"""
491499
target, annotations = _process_annotated(target)
492500
raw_target = _get_target_raw_type(target)
493-
if dataclasses.is_dataclass(raw_target):
501+
if isinstance(raw_target, type) and dataclasses.is_dataclass(raw_target):
494502
fields = dataclasses.fields(raw_target)
495503
values = ((k.replace("-", "_"), v) for k, v in item.items())
496504
return raw_target(
497505
**{
498-
k: cls.convert(v, *[f.type for f in fields if f.name == k])
506+
k: cls.convert(v, *[_field_type(f) for f in fields if f.name == k])
499507
for k, v in values
500508
}
501509
)
@@ -579,24 +587,25 @@ def convert_target(self, target: type[T], *prefixes: str) -> T:
579587
errors = []
580588
prep: dict[str, Any] = {}
581589
for field in dataclasses.fields(target): # type: ignore[arg-type]
582-
if dataclasses.is_dataclass(field.type):
590+
field_type = _field_type(field)
591+
if dataclasses.is_dataclass(field_type):
583592
try:
584593
prep[field.name] = self.convert_target(
585-
field.type, *prefixes, field.name
594+
field_type, *prefixes, field.name
586595
)
587596
except Exception as e:
588597
name = ".".join([*self.prefixes, *prefixes, field.name])
589598
e.__notes__ = [*getattr(e, "__notes__", []), f"Field: {name}"] # type: ignore[attr-defined]
590599
errors.append(e)
591600
continue
592601

593-
is_dict = _get_target_raw_type(field.type) is dict
602+
is_dict = _get_target_raw_type(field_type) is dict
594603

595604
for source in self.sources:
596605
if source.has_item(*prefixes, field.name, is_dict=is_dict):
597606
simple = source.get_item(*prefixes, field.name, is_dict=is_dict)
598607
try:
599-
tmp = source.convert(simple, field.type)
608+
tmp = source.convert(simple, field_type)
600609
except Exception as e:
601610
name = ".".join([*self.prefixes, *prefixes, field.name])
602611
e.__notes__ = [*getattr(e, "__notes__", []), f"Field {name}"] # type: ignore[attr-defined]

0 commit comments

Comments
 (0)