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
11 changes: 7 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,12 @@ ignore = ["W002"] # Triggers on __init__.py's


[tool.ruff]
show-fixes = true
exclude = ["src/scikit_build_core/_vendor/*"]

[tool.ruff.lint]
select = ["ALL"]
ignore = [
"A", # Okay to shadow builtins
"ANN401", # Disallow Any
"C90", # Complexity
"COM", # Trailing commas teach the formatter
Expand All @@ -274,7 +274,6 @@ ignore = [
"PLR09", # Too many ...
"PLR2004", # Magic value used in comparison
"PT013", # It's correct to import classes for typing!
"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
Expand All @@ -284,12 +283,16 @@ ignore = [
"TID252", # Relative imports are fine
]
typing-modules = ["scikit_build_core._compat.typing"]
isort.known-local-folder = ["pathutils"]
flake8-bugbear.extend-immutable-calls = [
"packaging.version.Version",
"packaging.specifiers.SpecifierSet",
]
flake8-builtins.ignorelist = ["copyright", "license", "__doc__"]

[tool.ruff.format]
docstring-code-format = true

[tool.ruff.lint.isort]
known-local-folder = ["pathutils"]

[tool.ruff.lint.flake8-tidy-imports.banned-api]
"typing.Callable".msg = "Use collections.abc.Callable instead."
Expand Down
2 changes: 1 addition & 1 deletion src/scikit_build_core/file_api/model/toolchains.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ class Toolchain:
@dataclasses.dataclass(frozen=True)
class Toolchains:
kind: str = "toolchains"
version: APIVersion = APIVersion(1, 0)
version: APIVersion = APIVersion(1, 0) # noqa: RUF009
toolchains: List[Toolchain] = dataclasses.field(default_factory=list)
2 changes: 1 addition & 1 deletion src/scikit_build_core/resources/_editable_redirect.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def __init__(
verbose: bool,
build_options: list[str],
install_options: list[str],
dir: str,
dir: str, # noqa: A002
install_dir: str,
) -> None:
self.known_source_files = known_source_files
Expand Down
6 changes: 3 additions & 3 deletions tests/test_dynamic_metadata_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def test_regex() -> None:


@pytest.mark.parametrize(
("field", "input", "output"),
("field", "input_", "output"),
[
pytest.param("version", "{sub}", "42", id="str"),
pytest.param("classifiers", ["a", "{sub}"], ["a", "42"], id="list-str"),
Expand Down Expand Up @@ -100,6 +100,6 @@ def test_regex() -> None:
),
],
)
def test_actions(field: str, input: Any, output: Any) -> None:
result = _process_dynamic_metadata(field, lambda x: x.format(sub=42), input)
def test_actions(field: str, input_: Any, output: Any) -> None:
result = _process_dynamic_metadata(field, lambda x: x.format(sub=42), input_)
assert output == result
10 changes: 5 additions & 5 deletions tests/test_file_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,17 @@ def test_on_each_with_symlink(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -
gitignore = Path(".gitignore")
gitignore.write_text("/hidden_dir")
# Create a directory with a symlink to a file in the same directory
dir = Path("dir")
dir.mkdir()
file1 = dir / "file"
pkg_dir = Path("pkg")
pkg_dir.mkdir()
file1 = pkg_dir / "file"
file1.write_text("content")
file2 = dir / "link"
file2 = pkg_dir / "link"
file2.symlink_to("file")
hidden_dir = Path("hidden_dir")
hidden_dir.mkdir()
hidden_file = hidden_dir / "file2"
hidden_file.write_text("content2")
exposed_symlink = dir / "exposed_symlink"
exposed_symlink = pkg_dir / "exposed_symlink"
exposed_symlink.symlink_to("../hidden_dir")

local_ignored_file = Path("local_ignored_file.txt")
Expand Down
8 changes: 4 additions & 4 deletions tests/test_pyproject_pep517.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ def test_pep517_sdist_hash(monkeypatch, package_simple_pyproject_ext, tmp_path:
dist = tmp_path / "dist"
out = build_sdist(str(dist))
sdist = dist / out
hash = compute_uncompressed_hash(sdist)
assert hash == package_simple_pyproject_ext.sdist_hash
sdist_hash = compute_uncompressed_hash(sdist)
assert sdist_hash == package_simple_pyproject_ext.sdist_hash
mode = sdist.stat().st_mode
assert mode == 33188
with gzip.open(sdist, "rb") as f:
Expand Down Expand Up @@ -160,8 +160,8 @@ def each_unignored_file_ordered(*args, **kwargs):

out = build_sdist(str(dist), {"sdist.reproducible": "true"})
sdist = dist / out
hash = compute_uncompressed_hash(sdist)
assert hash == package_simple_pyproject_ext.sdist_dated_hash
sdist_hash = compute_uncompressed_hash(sdist)
assert sdist_hash == package_simple_pyproject_ext.sdist_dated_hash


@pytest.mark.compile
Expand Down
4 changes: 2 additions & 2 deletions tests/test_pyproject_pep518.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def test_pep518_sdist(isolated, package_simple_pyproject_ext, tmp_path: Path):
assert sdist.name == "cmake_example-0.0.1.tar.gz"

if not sys.platform.startswith(("win", "cygwin")):
hash = compute_uncompressed_hash(sdist)
assert hash == package_simple_pyproject_ext.sdist_hash
sdist_hash = compute_uncompressed_hash(sdist)
assert sdist_hash == package_simple_pyproject_ext.sdist_hash

with tarfile.open(sdist) as f:
file_names = set(f.getnames())
Expand Down
10 changes: 6 additions & 4 deletions tests/test_settings_overrides.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,14 +446,14 @@ def test_skbuild_env_negative_bool(

@pytest.mark.parametrize("foo", ["true", "false"])
@pytest.mark.parametrize("bar", ["true", "false"])
@pytest.mark.parametrize("any", [True, False])
@pytest.mark.parametrize("use_any", [True, False])
def test_skbuild_env_bool_all_any(
foo: str, bar: str, any: bool, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
foo: str, bar: str, use_any: bool, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
):
monkeypatch.setenv("FOO", foo)
monkeypatch.setenv("BAR", bar)

any_str = ".any" if any else ""
any_str = ".any" if use_any else ""
pyproject_toml = tmp_path / "pyproject.toml"
pyproject_toml.write_text(
dedent(
Expand All @@ -470,7 +470,9 @@ def test_skbuild_env_bool_all_any(
settings_reader = SettingsReader.from_file(pyproject_toml)
settings = settings_reader.settings

if (foo == "true" and bar == "true") or (any and (foo == "true" or bar == "true")):
if (foo == "true" and bar == "true") or (
use_any and (foo == "true" or bar == "true")
):
assert settings.sdist.cmake
else:
assert not settings.sdist.cmake
Expand Down
Loading