Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update to Ruff 0.9 #967

Merged
merged 1 commit into from
Jan 10, 2025
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
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ repos:
exclude: "^tests"

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.6
rev: v0.9.1
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand Down Expand Up @@ -130,12 +130,12 @@ repos:
additional_dependencies: [cogapp]

- repo: https://github.com/henryiii/validate-pyproject-schema-store
rev: 2024.11.25
rev: 2025.01.10
hooks:
- id: validate-pyproject

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.30.0
rev: 0.31.0
hooks:
- id: check-dependabot
- id: check-github-workflows
Expand All @@ -144,7 +144,7 @@ repos:
files: \.schema\.json

- repo: https://github.com/citation-file-format/cffconvert
rev: 054bda51dbe278b3e86f27c890e3f3ac877d616c
rev: b6045d78aac9e02b039703b030588d54d53262ac
hooks:
- id: validate-cff

Expand Down
12 changes: 6 additions & 6 deletions src/scikit_build_core/build/_wheelfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ def writestr(self, zinfo_or_arcname: str | ZipInfo, data: bytes) -> None:
)
zinfo.compress_type = zipfile.ZIP_DEFLATED
zinfo.external_attr = (0o664 | stat.S_IFREG) << 16
assert (
"\\" not in zinfo.filename
), f"\\ not supported in zip; got {zinfo.filename!r}"
assert "\\" not in zinfo.filename, (
f"\\ not supported in zip; got {zinfo.filename!r}"
)
self._zipfile.writestr(zinfo, data)

def __enter__(self) -> Self:
Expand All @@ -236,9 +236,9 @@ def __exit__(self, *args: object) -> None:
data = io.StringIO()
writer = csv.writer(data, delimiter=",", quotechar='"', lineterminator="\n")
for member in self._zipfile.infolist():
assert (
"\\" not in member.filename
), f"Invalid zip contents: {member.filename}"
assert "\\" not in member.filename, (
f"Invalid zip contents: {member.filename}"
)
with self._zipfile.open(member) as f:
member_data = f.read()
sha = _b64encode(hashlib.sha256(member_data).digest()).decode("ascii")
Expand Down
6 changes: 3 additions & 3 deletions src/scikit_build_core/build/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
metadata. Metadata is available inside the template.
"""

assert (
gen.template_path or gen.template
), f"One of template or template-path must be set for {gen.path}"
assert gen.template_path or gen.template, (

Check warning on line 24 in src/scikit_build_core/build/generate.py

View check run for this annotation

Codecov / codecov/patch

src/scikit_build_core/build/generate.py#L24

Added line #L24 was not covered by tests
f"One of template or template-path must be set for {gen.path}"
)

if gen.template_path:
template = gen.template_path.read_text(encoding="utf-8")
Expand Down
16 changes: 9 additions & 7 deletions src/scikit_build_core/setuptools/build_cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ def __dir__() -> list[str]:


def _validate_settings(settings: ScikitBuildSettings) -> None:
assert (
not settings.wheel.expand_macos_universal_tags
), "wheel.expand_macos_universal_tags is not supported in setuptools mode"
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.expand_macos_universal_tags, (
"wheel.expand_macos_universal_tags is not supported in setuptools mode"
)
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"
)


class BuildCMake(setuptools.Command):
Expand Down
6 changes: 3 additions & 3 deletions src/scikit_build_core/setuptools/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
) -> setuptools.Distribution:
assert not cmake_install_dir, "cmake_install_dir not supported yet"
assert not cmake_with_sdist, "cmake_with_sdist not supported yet"
assert (
cmake_process_manifest_hook is None
), "cmake_process_manifest_hook not supported yet"
assert cmake_process_manifest_hook is None, (

Check warning on line 32 in src/scikit_build_core/setuptools/wrapper.py

View check run for this annotation

Codecov / codecov/patch

src/scikit_build_core/setuptools/wrapper.py#L32

Added line #L32 was not covered by tests
"cmake_process_manifest_hook not supported yet"
)
assert cmake_install_target == "install", "cmake_install_target not supported yet"

if cmake_languages is not None:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def test_wheel_tag(monkeypatch, minver, archs, answer):
assert plat == answer


@pytest.mark.parametrize("archs", ["x86_64" "arm64" "universal2"])
@pytest.mark.parametrize("archs", ["x86_64", "arm64", "universal2"])
def test_wheel_build_tag(monkeypatch, archs):
get_config_var = sysconfig.get_config_var
monkeypatch.setattr(
Expand Down
Loading