diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6503e1e..c3f5504 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -33,19 +33,13 @@ repos: - id: requirements-txt-fixer - id: trailing-whitespace -# Black, the code formatter, natively supports pre-commit -- repo: https://github.com/psf/black-pre-commit-mirror - rev: 23.9.1 - hooks: - - id: black - files: ^(docs) - # Lints code - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.0.292" + rev: "v0.1.3" hooks: - id: ruff args: ["--fix", "--show-fixes"] + - id: ruff-format # Changes tabs to spaces - repo: https://github.com/Lucas-C/pre-commit-hooks diff --git a/pyproject.toml b/pyproject.toml index 013e25d..2b3ce52 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,11 +5,16 @@ requires = [ ] build-backend = "setuptools.build_meta" + [tool.cibuildwheel] test-command = "python {project}/tests/test.py" test-skip = "*universal2:arm64" + [tool.ruff] +target-version = "py37" + +[tool.ruff.lint] extend-select = [ "B", # flake8-bugbear "I", # isort @@ -17,7 +22,3 @@ extend-select = [ "RUF", # Ruff-specific "UP", # pyupgrade ] -extend-ignore = [ - "E501", # Line too long -] -target-version = "py37" diff --git a/setup.py b/setup.py index d45a7ec..205144f 100644 --- a/setup.py +++ b/setup.py @@ -14,11 +14,12 @@ # reproducible builds (https://github.com/pybind/python_example/pull/53) ext_modules = [ - Pybind11Extension("python_example", + Pybind11Extension( + "python_example", ["src/main.cpp"], # Example: passing in the version to the compiled code - define_macros = [('VERSION_INFO', __version__)], - ), + define_macros=[("VERSION_INFO", __version__)], + ), ] setup( diff --git a/tests/test.py b/tests/test.py index f877b62..5a72e5f 100644 --- a/tests/test.py +++ b/tests/test.py @@ -1,5 +1,5 @@ import python_example as m -assert m.__version__ == '0.0.1' +assert m.__version__ == "0.0.1" assert m.add(1, 2) == 3 assert m.subtract(1, 2) == -1