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
60 changes: 15 additions & 45 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -246,60 +246,29 @@ ignore = ["W002"] # Triggers on __init__.py's
exclude = ["src/scikit_build_core/_vendor/*"]

[tool.ruff.lint]
extend-select = [
"ANN", # flake8-annotations
"ARG", # flake8-unused-arguments
"B", # flake8-bugbear
"BLE", # flake8-blind-except
"C4", # flake8-comprehensions
"DTZ", # flake8-datetimez
"EM", # flake8-errmsg
"EXE", # flake8-executable
"FA", # flake8-future-annotations
"FBT", # flake8-boolean-trap
"FLY", # flynt
"FURB", # refurb
"G", # flake8-logging-format
"I", # isort
"ICN", # flake8-import-conventions
"ISC", # flake8-implicit-str-concat
"LOG", # flake8-logging
"N", # flake8-naming
"PERF", # perflint
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PL", # pylint
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
"PYI", # flake8-pyi
"Q", # flake8-quotes
"RET", # flake8-return
"RSE", # flake8-raise
"RUF", # Ruff-specific
"S", # eval -> literal_eval
"SIM", # flake8-simplify
"SLOT", # flake8-slots
"T10", # flake8-debugger
"T20", # flake8-print
"TC", # flake8-type-checking
"TID251", # flake8-tidy-imports.banned-api
"TRY", # tryceratops
"UP", # pyupgrade
"YTT", # flake8-2020
]
select = ["ALL"]
ignore = [
"ANN401", # Disallow dynamically typed expressions
"A", # Okay to shadow builtins
"ANN401", # Disallow Any
"C90", # Complexity
"COM", # Trailing commas teach the formatter
"D", # Too many doc requests
"E501", # Line too long
"ERA", # Commented out code
"FIX", # Hacks and todos
"PLC0415", # Import should be at top of file
"PLE1205", # Format check doesn't work with our custom logger
"PLR09", # Too many ...
"PLR2004", # Magic value used in comparison
"PT013", # It's correct to import classes for typing!
"PYI025", # Wants Set to be renamed AbstractSet
"RUF009", # Too easy to get a false positive
"RUF009", # Too easy to get a false positive (function call in dataclass defaults)
"S101", # Use of assert detected
"S404", # subprocess module is possibly insecure
"S603", # subprocess untrusted input
"S607", # subprocess call
"SLF001", # Private members are okay to access
"TD", # Todo format
"TID252", # Relative imports are fine
]
typing-modules = ["scikit_build_core._compat.typing"]

Expand Down Expand Up @@ -328,7 +297,7 @@ known-local-folder = ["pathutils"]


[tool.ruff.lint.per-file-ignores]
"tests/**" = ["T20", "ANN", "FBT001"]
"tests/**" = ["T20", "ANN", "FBT001", "INP"]
"noxfile.py" = ["T20", "TID251"]
"src/scikit_build_core/resources/*.py" = ["PTH", "ARG002", "FBT", "TID251"]
"src/scikit_build_core/_compat/**.py" = ["TID251"]
Expand All @@ -337,6 +306,7 @@ known-local-folder = ["pathutils"]
"tests/conftest.py" = ["TID251"]
"tests/packages/**.py" = ["TID251"]
"tests/test_settings.py" = ["FA"]
"docs/**" = ["INP"]
"docs/conf.py" = ["TID251"]
"docs/examples/**" = ["ANN"]
"src/scikit_build_core/file_api/model/*.py" = ["N"]
Expand Down
7 changes: 4 additions & 3 deletions src/scikit_build_core/build/_wheelfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
from .. import __version__

if TYPE_CHECKING:
from collections.abc import Mapping, Sequence, Set
from collections.abc import Mapping, Sequence
from collections.abc import Set as AbstractSet

from packaging.tags import Tag

Expand Down Expand Up @@ -48,7 +49,7 @@ class WheelMetadata:
root_is_purelib: bool = False
metadata_version: str = "1.0"
generator: str = f"scikit-build-core {__version__}"
tags: Set[Tag] = dataclasses.field(default_factory=frozenset)
tags: AbstractSet[Tag] = dataclasses.field(default_factory=frozenset)
build_tag: str = ""

def as_bytes(self) -> bytes:
Expand All @@ -72,7 +73,7 @@ class WheelWriter:

metadata: StandardMetadata
folder: Path
tags: Set[Tag]
tags: AbstractSet[Tag]
wheel_metadata: WheelMetadata
metadata_dir: Path | None
_zipfile: zipfile.ZipFile | None = None
Expand Down
8 changes: 4 additions & 4 deletions tests/test_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,18 @@ def test_auto_cmake_version(expr: str, answer: str):
def test_auto_cmake_version_block(block: str):
txt = textwrap.dedent(f"""\
# cmake_minimum_version(VERSION 3.1)

#[[
cmake_minimum_required(VERSION 3.2)
]]

{block}()
cmake_minimum_required(VERSION 3.3)
cmake_minimum_required(VERSION 3.3)
end{block}()

cmake_MINimum_required(VERSION 3.4)

cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.5)
""")
res = find_min_cmake_version(txt)
assert res == "3.4"
4 changes: 2 additions & 2 deletions tests/test_cmake_ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def test_cmake_ast_parse_long():
)

# Add executable
add_executable(TokenizationExample
src/main.cpp
add_executable(TokenizationExample
src/main.cpp
src/utils.cpp
)

Expand Down
6 changes: 3 additions & 3 deletions tests/test_editable.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,13 @@ def test_importlib_resources(monkeypatch, tmp_path, editable, editable_mode, iso
from importlib import import_module
from importlib.resources import files
from pathlib import Path

def is_extension(path):
for ext in (".so", ".pyd"):
if ext in path.suffixes:
return True
return False

def check_pkg(pkg_name):
try:
pkg = import_module(pkg_name)
Expand All @@ -281,7 +281,7 @@ def check_pkg(pkg_name):
except Exception as err:
msg = f"Failed in {str(pkg)}"
raise RuntimeError(msg) from err

check_pkg("pkg")
check_pkg("pkg.sub_a")
check_pkg("pkg.sub_b")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_get_requires.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def test_get_requires_parts_pyproject_old(
monkeypatch.chdir(tmp_path)
tmp_path.joinpath("pyproject.toml").write_text(
"""

[tool.scikit-build]
minimum-version = "0.0"
cmake.minimum-version = "3.21"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_settings_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_skbuild_docs_sphinx() -> None:
textwrap.dedent("""\
.. confval:: cmake.define
:type: ``EnvVar``

A table of defines to pass to CMake when configuring the project. Additive.
""")
in docs
Expand Down