From 9afec537acc519147a5b33a4cd9c3d64d2b73a64 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 30 Oct 2023 20:56:23 +0000 Subject: [PATCH 1/3] chore: update pre-commit hooks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black-pre-commit-mirror: 23.9.1 → 23.10.1](https://github.com/psf/black-pre-commit-mirror/compare/23.9.1...23.10.1) - [github.com/astral-sh/ruff-pre-commit: v0.0.292 → v0.1.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.292...v0.1.3) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6503e1e..ef080fe 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -35,14 +35,14 @@ repos: # Black, the code formatter, natively supports pre-commit - repo: https://github.com/psf/black-pre-commit-mirror - rev: 23.9.1 + rev: 23.10.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"] From 72eede12fe9ea2d6be325f0a24bec17890982165 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Mon, 30 Oct 2023 18:06:24 -0400 Subject: [PATCH 2/3] chore: move to ruff-format Signed-off-by: Henry Schreiner --- .pre-commit-config.yaml | 9 ++------- pyproject.toml | 9 +++++---- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ef080fe..53b7a6d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -33,19 +33,14 @@ 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.10.1 - hooks: - - id: black - files: ^(docs) - # Lints code - repo: https://github.com/astral-sh/ruff-pre-commit rev: "v0.1.3" hooks: - id: ruff args: ["--fix", "--show-fixes"] + - id: ruff-format + files: ^(docs) # 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" From 182827e0cbea7b1c5b79a28592fa20c1d055c243 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Mon, 30 Oct 2023 18:25:30 -0400 Subject: [PATCH 3/3] chore: fix exclusion of main files from formatter Signed-off-by: Henry Schreiner --- .pre-commit-config.yaml | 1 - setup.py | 7 ++++--- tests/test.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 53b7a6d..c3f5504 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -40,7 +40,6 @@ repos: - id: ruff args: ["--fix", "--show-fixes"] - id: ruff-format - files: ^(docs) # Changes tabs to spaces - repo: https://github.com/Lucas-C/pre-commit-hooks 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