From 9ed353902d2ee3af33f70025c8e46ec075e0b834 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Sat, 24 Jun 2023 00:06:11 -0400 Subject: [PATCH] chore: cleanup and bump pre-commit Signed-off-by: Henry Schreiner --- .pre-commit-config.yaml | 4 ++-- pyproject.toml | 16 +++++++--------- src/scikit_build_core/builder/builder.py | 3 +-- src/scikit_build_core/settings/sources.py | 6 ++---- src/scikit_build_core/setuptools/build_cmake.py | 3 ++- tests/test_fileapi.py | 2 +- 6 files changed, 15 insertions(+), 19 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index afbfeb52..099eab71 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -54,13 +54,13 @@ repos: exclude: "^tests" - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.272 + rev: v0.0.275 hooks: - id: ruff args: ["--fix", "--show-fixes"] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.3.0 + rev: v1.4.0 hooks: - id: mypy exclude: | diff --git a/pyproject.toml b/pyproject.toml index 6193fb3e..97db23c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,8 +34,8 @@ dynamic = ["version"] dependencies = [ "exceptiongroup; python_version<'3.11'", - "importlib-resources >=1.3; python_version<'3.9'", "importlib-metadata; python_version<'3.8'", + "importlib-resources >=1.3; python_version<'3.9'", "packaging >=20.9", "tomli >=1.1; python_version<'3.11'", "typing-extensions >=3.10.0; python_version<'3.8'", @@ -46,13 +46,12 @@ dependencies = [ [project.optional-dependencies] pyproject = [ - "pyproject-metadata >=0.5", "pathspec >=0.10.1", + "pyproject-metadata >=0.5", ] test = [ "build[virtualenv]", "cattrs >=22.2.0", - "importlib-metadata; python_version<'3.8'", "pathspec >=0.10.1", "pybind11", "pyproject-metadata >=0.5", @@ -92,11 +91,11 @@ docs = [ ] [project.urls] -Homepage = "https://github.com/scikit-build/scikit-build-core" -Documentation = "https://scikit-build-core.readthedocs.io" +Changelog = "https://scikit-build-core.readthedocs.io/en/latest/changelog.html" Discussions = "https://github.com/orgs/scikit-build/discussions" +Documentation = "https://scikit-build-core.readthedocs.io" +Homepage = "https://github.com/scikit-build/scikit-build-core" Issues = "https://github.com/scikit-build/scikit-build-core/issues" -Changelog = "https://scikit-build-core.readthedocs.io/en/latest/changelog.html" [project.entry-points] "distutils.commands".build_cmake = "scikit_build_core.setuptools.build_cmake:BuildCMake" @@ -115,10 +114,9 @@ addopts = ["-ra", "--strict-markers", "--strict-config"] xfail_strict = true filterwarnings = [ "error", - "ignore:pkg_resources is deprecated as an API:DeprecationWarning", # Caused by wheel in tests + "ignore:pkg_resources is deprecated as an API:DeprecationWarning:wheel", # Caused by wheel in tests "ignore:Config variable '.*' is unset, Python ABI tag may be incorrect:RuntimeWarning", - "ignore:onerror argument is deprecated, use onexc instead:DeprecationWarning", # Caused by wheel and Python 3.12 - "ignore:(ast.Str|Attribute s|ast.NameConstant|ast.Num) is deprecated:DeprecationWarning:_pytest", # Python 3.12 + "ignore:onerror argument is deprecated, use onexc instead:DeprecationWarning:wheel", # Caused by wheel and Python 3.12 ] log_cli_level = "info" testpaths = ["tests"] diff --git a/src/scikit_build_core/builder/builder.py b/src/scikit_build_core/builder/builder.py index 395466a7..73f4fc63 100644 --- a/src/scikit_build_core/builder/builder.py +++ b/src/scikit_build_core/builder/builder.py @@ -48,8 +48,7 @@ def get_archs(env: Mapping[str, str], cmake_args: Sequence[str] = ()) -> list[st for cmake_arg in cmake_args: if "CMAKE_SYSTEM_PROCESSOR" in cmake_arg: return [cmake_arg.split("=")[1]] - archs = re.findall(r"-arch (\S+)", env.get("ARCHFLAGS", "")) - return archs + return re.findall(r"-arch (\S+)", env.get("ARCHFLAGS", "")) if sys.platform.startswith("win") and get_platform(env) == "win-arm64": return ["win_arm64"] diff --git a/src/scikit_build_core/settings/sources.py b/src/scikit_build_core/settings/sources.py index e508fb9a..bd393e1e 100644 --- a/src/scikit_build_core/settings/sources.py +++ b/src/scikit_build_core/settings/sources.py @@ -229,8 +229,7 @@ def convert(cls, item: str, target: type[Any]) -> object: return {k: cls.convert(v, _get_inner_type(target)) for k, v in items} if raw_target is bool: - result = item.strip().lower() not in {"0", "false", "off", "no", ""} - return result + return item.strip().lower() not in {"0", "false", "off", "no", ""} if callable(raw_target): return raw_target(item) @@ -339,8 +338,7 @@ def convert( msg = f"Expected {target}, got {type(item).__name__}" raise TypeError(msg) if raw_target is bool: - result = item.strip().lower() not in {"0", "false", "off", "no", ""} - return result + return item.strip().lower() not in {"0", "false", "off", "no", ""} if callable(raw_target): return raw_target(item) msg = f"Can't convert target {target}" diff --git a/src/scikit_build_core/setuptools/build_cmake.py b/src/scikit_build_core/setuptools/build_cmake.py index dc1f7040..5ba2a209 100644 --- a/src/scikit_build_core/setuptools/build_cmake.py +++ b/src/scikit_build_core/setuptools/build_cmake.py @@ -4,6 +4,7 @@ import shutil import sys from pathlib import Path +from typing import ClassVar import setuptools import setuptools.errors @@ -48,7 +49,7 @@ class BuildCMake(setuptools.Command): parallel: int | None plat_name: str | None - user_options = [ + user_options: ClassVar[list[tuple[str, str, str]]] = [ ("build-lib=", "b", "directory for compiled extension modules"), ("build-temp=", "t", "directory for temporary files (build by-products)"), ("plat-name=", "p", "platform name to cross-compile for, if supported "), diff --git a/tests/test_fileapi.py b/tests/test_fileapi.py index 277f4a4f..fbd307ee 100644 --- a/tests/test_fileapi.py +++ b/tests/test_fileapi.py @@ -106,7 +106,7 @@ def test_included_dir(): assert codemodel.kind == "codemodel" assert codemodel.version.major == 2 assert codemodel.version.minor == 4 - assert codemodel.configurations[0].name == "" # noqa: PLC1901 + assert codemodel.configurations[0].name == "" cache = index.reply.cache_v2 assert cache is not None