Skip to content

Commit

Permalink
chore: cleanup and bump pre-commit
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed Jun 24, 2023
1 parent 8088209 commit 9ed3539
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
16 changes: 7 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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'",
Expand All @@ -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",
Expand Down Expand Up @@ -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"
Expand All @@ -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"]
Expand Down
3 changes: 1 addition & 2 deletions src/scikit_build_core/builder/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
6 changes: 2 additions & 4 deletions src/scikit_build_core/settings/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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}"
Expand Down
3 changes: 2 additions & 1 deletion src/scikit_build_core/setuptools/build_cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import shutil
import sys
from pathlib import Path
from typing import ClassVar

import setuptools
import setuptools.errors
Expand Down Expand Up @@ -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 "),
Expand Down
2 changes: 1 addition & 1 deletion tests/test_fileapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9ed3539

Please sign in to comment.