diff --git a/pyproject.toml b/pyproject.toml index c3640708..ccb22b4c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"] @@ -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"] @@ -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"] diff --git a/src/scikit_build_core/build/_wheelfile.py b/src/scikit_build_core/build/_wheelfile.py index 84fd46af..b7a45316 100644 --- a/src/scikit_build_core/build/_wheelfile.py +++ b/src/scikit_build_core/build/_wheelfile.py @@ -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 @@ -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: @@ -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 diff --git a/tests/test_auto.py b/tests/test_auto.py index f9ab81a0..2c4b96b7 100644 --- a/tests/test_auto.py +++ b/tests/test_auto.py @@ -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" diff --git a/tests/test_cmake_ast.py b/tests/test_cmake_ast.py index a85c3d4e..cc6cdec7 100644 --- a/tests/test_cmake_ast.py +++ b/tests/test_cmake_ast.py @@ -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 ) diff --git a/tests/test_editable.py b/tests/test_editable.py index 9ff5b52d..6d4a1c18 100644 --- a/tests/test_editable.py +++ b/tests/test_editable.py @@ -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) @@ -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") diff --git a/tests/test_get_requires.py b/tests/test_get_requires.py index 58d4a36b..68156028 100644 --- a/tests/test_get_requires.py +++ b/tests/test_get_requires.py @@ -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" diff --git a/tests/test_settings_docs.py b/tests/test_settings_docs.py index 8c8da961..b61509bb 100644 --- a/tests/test_settings_docs.py +++ b/tests/test_settings_docs.py @@ -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