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
18 changes: 7 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,20 @@ repos:
- id: trailing-whitespace
exclude: "^tests"

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.2
hooks:
- id: ruff-format
- id: ruff
args: ["--fix", "--show-fixes"]

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.10.0
hooks:
- id: black-jupyter

- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
hooks:
Expand All @@ -53,12 +55,6 @@ repos:
args: [--prose-wrap=always]
exclude: "^tests|src/scikit_build_core/resources/scikit-build.schema.json"

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.1
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.6.1
hooks:
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,6 @@ Support for this work was provided by NSF cooperative agreement [OAC-2209877][].
<!-- prettier-ignore-start -->
[actions-badge]: https://github.com/scikit-build/scikit-build-core/workflows/CI/badge.svg
[actions-link]: https://github.com/scikit-build/scikit-build-core/actions
[black-badge]: https://img.shields.io/badge/code%20style-black-000000.svg
[black-link]: https://github.com/psf/black
[conda-badge]: https://img.shields.io/conda/vn/conda-forge/scikit-build-core
[conda-link]: https://github.com/conda-forge/scikit-build-core-feedstock
[github-discussions-badge]: https://img.shields.io/static/v1?label=Discussions&message=Ask&color=blue&logo=github
Expand Down
6 changes: 4 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,12 @@ def generate_schema(session: nox.Session) -> None:
(Re)generate src/scikit_build_core/resources/scikit-build.schema.json from model.
"""
session.install("-e.")
schema = session.run(
schema_txt = session.run(
"python", "-m", "scikit_build_core.settings.skbuild_schema", silent=True
)
DIR.joinpath("src/scikit_build_core/resources/scikit-build.schema.json").write_text(schema) # type: ignore[arg-type]
assert isinstance(schema_txt, str)
schema_file = DIR / "src/scikit_build_core/resources/scikit-build.schema.json"
schema_file.write_text(schema_txt)


@nox.session
Expand Down
15 changes: 9 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,12 @@ report.exclude_lines = [
[tool.check-wheel-contents]
ignore = ["W002"] # Triggers on __init__.py's


[tool.ruff]
typing-modules = ["scikit_build_core._compat.typing"]
src = ["src"]
exclude = []

[tool.ruff.lint]
select = [
"E", "F", "W", # flake8
"B", # flake8-bugbear
Expand Down Expand Up @@ -231,20 +235,19 @@ select = [
"FLY", # flynt
"TRY", # tryceratops
"FBT", # flake8-boolean-trap
"PYI", # flake8-pyi
]
extend-ignore = [
"PLR", # Design rules for pylint
"PLE1205", # Format check doesn't work with our custom logger
"E501", # Line too long
"PT004", # Incorrect, just usefixtures instead.
"RUF009", # Too easy to get a false positive
"PYI025", # Wants Set to be renamed AbstractSet
]
typing-modules = ["scikit_build_core._compat.typing"]
src = ["src"]
unfixable = ["T20", "F841"]
exclude = []

[tool.ruff.flake8-tidy-imports.banned-api]
[tool.ruff.lint.flake8-tidy-imports.banned-api]
"typing.Callable".msg = "Use collections.abc.Callable instead."
"typing.Iterator".msg = "Use collections.abc.Iterator instead."
"typing.Mapping".msg = "Use collections.abc.Mapping instead."
Expand All @@ -268,7 +271,7 @@ exclude = []
"importlib_resources".msg = "Use scikit_build_core._compat.importlib.resources instead."


[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"tests/**" = ["T20"]
"noxfile.py" = ["T20", "TID251"]
"src/scikit_build_core/resources/*.py" = ["PTH", "ARG002", "FBT", "TID251"]
Expand Down
2 changes: 0 additions & 2 deletions src/scikit_build_core/_version.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

version: str
version_tuple: tuple[int, int, int, str, str] | tuple[int, int, int]

Expand Down
4 changes: 3 additions & 1 deletion src/scikit_build_core/settings/documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ def pull_docs(dc: type[object]) -> dict[str, str]:
assert isinstance(obody, ast.ClassDef)
body = obody.body
return {
assign.target.id: textwrap.dedent(_get_value(expr.value)).strip().replace("\n", " ") # type: ignore[union-attr]
assign.target.id: textwrap.dedent(_get_value(expr.value)) # type: ignore[union-attr]
.strip()
.replace("\n", " ")
for assign, expr in zip(body[:-1], body[1:])
if isinstance(assign, ast.AnnAssign) and isinstance(expr, ast.Expr)
}
Expand Down
7 changes: 5 additions & 2 deletions src/scikit_build_core/settings/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ def has_item(self, *fields: str, is_dict: bool) -> bool: # noqa: ARG002
return bool(self.env.get(name, ""))

def get_item(
self, *fields: str, is_dict: bool # noqa: ARG002
self,
*fields: str,
is_dict: bool, # noqa: ARG002
) -> str | dict[str, str]:
name = self._get_name(*fields)
if name in self.env:
Expand Down Expand Up @@ -243,7 +245,8 @@ def convert(cls, item: str, target: type[Any]) -> object:
raise TypeError(msg)

def unrecognized_options(
self, options: object # noqa: ARG002
self,
options: object, # noqa: ARG002
) -> Generator[str, None, None]:
yield from ()

Expand Down
4 changes: 1 addition & 3 deletions src/scikit_build_core/setuptools/build_cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ def _validate_settings() -> None:
assert (
settings.logging.level == "WARNING"
), "Logging is not adjustable in setuptools mode yet"
assert (
not settings.wheel.py_api
), "wheel.py_api is not supported in setuptools mode, use bdist_wheel options instead"
assert not settings.wheel.py_api, "wheel.py_api is not supported in setuptools mode, use bdist_wheel options instead"


class BuildCMake(setuptools.Command):
Expand Down