From c2de5261302fa307ebe06b24c0fc30653bed5e17 Mon Sep 17 00:00:00 2001 From: Nicholas Junge Date: Wed, 13 Dec 2023 15:26:15 +0100 Subject: [PATCH] Run `pre-commit autoupdate`, fix stale pyproject.toml comments (#1712) * Run `pre-commit autoupdate`, fix stale pyproject.toml comments * Set `--enable_bzlmod=false` for the moment Until the newer nanobind tags are pushed to the BCR, it's best to disable bzlmod for the bindings, because the Python CI breaks due to Bazel 7 enabling bzlmod by default. * Remove E203 ignore, add linebreaks to semantically group ruff options --- .pre-commit-config.yaml | 6 +++--- pyproject.toml | 7 +++---- setup.py | 1 + 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a1f08341..a58a5cff 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,17 +1,17 @@ repos: - repo: https://github.com/keith/pre-commit-buildifier - rev: 6.3.3.1 + rev: 6.4.0 hooks: - id: buildifier - id: buildifier-lint - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.6.1 + rev: v1.7.1 hooks: - id: mypy types_or: [ python, pyi ] args: [ "--ignore-missing-imports", "--scripts-are-modules" ] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.5 + rev: v0.1.7 hooks: - id: ruff args: [ --fix, --exit-non-zero-on-fix ] diff --git a/pyproject.toml b/pyproject.toml index 5e70b313..92c35066 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -71,15 +71,14 @@ ignore_missing_imports = true [tool.ruff] # explicitly tell ruff the source directory to correctly identify first-party package. src = ["bindings/python"] + line-length = 80 target-version = "py311" + # Enable pycodestyle (`E`, `W`), Pyflakes (`F`), and isort (`I`) codes by default. select = ["E", "F", "I", "W"] ignore = [ - # whitespace before colon (:), rely on black for formatting. - "E203", - # line too long, rely on black for formatting. - "E501", + "E501", # line too long ] [tool.ruff.isort] diff --git a/setup.py b/setup.py index 4d841418..cb20042d 100644 --- a/setup.py +++ b/setup.py @@ -74,6 +74,7 @@ class BuildBazelExtension(build_ext.build_ext): "bazel", "build", ext.bazel_target, + "--enable_bzlmod=false", f"--symlink_prefix={temp_path / 'bazel-'}", f"--compilation_mode={'dbg' if self.debug else 'opt'}", # C++17 is required by nanobind