From 86f60a0c072e5bd5cab79233f712c321fe8deca7 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Fri, 16 Jun 2023 14:09:40 -0700 Subject: [PATCH 1/2] pre-commit markdown-it-py<3 (for Python 3.7 compatibility) (#4704) * markdown-it-py dropped Python 3.7 support, but we are type checking for Python 3.7 from a newer version of Python. Keep using markdown-it-py<3 as long as we support Python 3.7. * Shuffle order of pre-commit checks for better agility. --- .pre-commit-config.yaml | 91 +++++++++++++++++++++-------------------- 1 file changed, 47 insertions(+), 44 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bcc3f2723..2d508276e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,6 +22,48 @@ ci: exclude: ^tools/JoinPaths.cmake$ repos: + +# Clang format the codebase automatically +- repo: https://github.com/pre-commit/mirrors-clang-format + rev: "v16.0.4" + hooks: + - id: clang-format + types_or: [c++, c, cuda] + +# Black, the code formatter, natively supports pre-commit +- repo: https://github.com/psf/black + rev: "23.3.0" # Keep in sync with blacken-docs + hooks: + - id: black + +# Ruff, the Python auto-correcting linter written in Rust +- repo: https://github.com/charliermarsh/ruff-pre-commit + rev: v0.0.270 + hooks: + - id: ruff + args: ["--fix", "--show-fixes"] + +# Check static types with mypy +- repo: https://github.com/pre-commit/mirrors-mypy + rev: "v1.3.0" + hooks: + - id: mypy + args: [] + exclude: ^(tests|docs)/ + additional_dependencies: + - markdown-it-py<3 # Drop this together with dropping Python 3.7 support. + - nox + - rich + +# CMake formatting +- repo: https://github.com/cheshirekow/cmake-format-precommit + rev: "v0.6.13" + hooks: + - id: cmake-format + additional_dependencies: [pyyaml] + types: [file] + files: (\.cmake|CMakeLists.txt)(.in)?$ + # Standard hooks - repo: https://github.com/pre-commit/pre-commit-hooks rev: "v4.4.0" @@ -39,12 +81,6 @@ repos: - id: requirements-txt-fixer - id: trailing-whitespace -# Black, the code formatter, natively supports pre-commit -- repo: https://github.com/psf/black - rev: "23.3.0" # Keep in sync with blacken-docs - hooks: - - id: black - # Also code format the docs - repo: https://github.com/asottile/blacken-docs rev: "1.13.0" @@ -66,13 +102,6 @@ repos: - id: fix-ligatures - id: fix-smartquotes -# Ruff, the Python auto-correcting linter written in Rust -- repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.270 - hooks: - - id: ruff - args: ["--fix", "--show-fixes"] - # Checking for common mistakes - repo: https://github.com/pre-commit/pygrep-hooks rev: "v1.10.0" @@ -81,32 +110,6 @@ repos: - id: rst-directive-colons - id: rst-inline-touching-normal - -# PyLint has native support - not always usable, but works for us -- repo: https://github.com/PyCQA/pylint - rev: "v3.0.0a6" - hooks: - - id: pylint - files: ^pybind11 - -# CMake formatting -- repo: https://github.com/cheshirekow/cmake-format-precommit - rev: "v0.6.13" - hooks: - - id: cmake-format - additional_dependencies: [pyyaml] - types: [file] - files: (\.cmake|CMakeLists.txt)(.in)?$ - -# Check static types with mypy -- repo: https://github.com/pre-commit/mirrors-mypy - rev: "v1.3.0" - hooks: - - id: mypy - args: [] - exclude: ^(tests|docs)/ - additional_dependencies: [nox, rich] - # Checks the manifest for missing files (native support) - repo: https://github.com/mgedmin/check-manifest rev: "0.49" @@ -141,9 +144,9 @@ repos: entry: PyBind|Numpy|Cmake|CCache|PyTest exclude: ^\.pre-commit-config.yaml$ -# Clang format the codebase automatically -- repo: https://github.com/pre-commit/mirrors-clang-format - rev: "v16.0.4" +# PyLint has native support - not always usable, but works for us +- repo: https://github.com/PyCQA/pylint + rev: "v3.0.0a6" hooks: - - id: clang-format - types_or: [c++, c, cuda] + - id: pylint + files: ^pybind11 From 849322806cd4b3697ad1d35eedd6d0352c5f267a Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Sat, 17 Jun 2023 07:02:23 -0700 Subject: [PATCH 2/2] Systematically add `PIP_BREAK_SYSTEM_PACKAGES` to all .yml files from which pip is called. (#4705) * Systematically add PIP_BREAK_SYSTEM_PACKAGES to all .yml files from which pip is called. * Try gcc:10-bullseye (because gcc:10 is broken: https://github.com/docker-library/gcc/issues/95) * bug fix (matrix did not work as hoped) --- .github/workflows/ci.yml | 17 +++++++++-------- .github/workflows/configure.yml | 1 + .github/workflows/pip.yml | 1 + .github/workflows/upstream.yml | 1 + 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 45a6738f7..1d5d502b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,7 @@ concurrency: cancel-in-progress: true env: + PIP_BREAK_SYSTEM_PACKAGES: 1 PIP_ONLY_BINARY: numpy FORCE_COLOR: 3 PYTEST_TIMEOUT: 300 @@ -455,16 +456,16 @@ jobs: fail-fast: false matrix: include: - - { gcc: 7, std: 11 } - - { gcc: 7, std: 17 } - - { gcc: 8, std: 14 } - - { gcc: 8, std: 17 } - - { gcc: 10, std: 17 } - - { gcc: 11, std: 20 } - - { gcc: 12, std: 20 } + - { gcc: 7, std: 11, container_suffix: "" } + - { gcc: 7, std: 17, container_suffix: "" } + - { gcc: 8, std: 14, container_suffix: "" } + - { gcc: 8, std: 17, container_suffix: "" } + - { gcc: 10, std: 17, container_suffix: "-bullseye" } + - { gcc: 11, std: 20, container_suffix: "" } + - { gcc: 12, std: 20, container_suffix: "" } name: "🐍 3 • GCC ${{ matrix.gcc }} • C++${{ matrix.std }}• x64" - container: "gcc:${{ matrix.gcc }}" + container: "gcc:${{ matrix.gcc }}${{ matrix.container_suffix }}" steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/configure.yml b/.github/workflows/configure.yml index 4ae22281c..82a493900 100644 --- a/.github/workflows/configure.yml +++ b/.github/workflows/configure.yml @@ -13,6 +13,7 @@ permissions: contents: read env: + PIP_BREAK_SYSTEM_PACKAGES: 1 # For cmake: VERBOSE: 1 diff --git a/.github/workflows/pip.yml b/.github/workflows/pip.yml index c1feb6fe1..04d95a28c 100644 --- a/.github/workflows/pip.yml +++ b/.github/workflows/pip.yml @@ -16,6 +16,7 @@ permissions: contents: read env: + PIP_BREAK_SYSTEM_PACKAGES: 1 PIP_ONLY_BINARY: numpy jobs: diff --git a/.github/workflows/upstream.yml b/.github/workflows/upstream.yml index d4220be22..dd8a1c960 100644 --- a/.github/workflows/upstream.yml +++ b/.github/workflows/upstream.yml @@ -12,6 +12,7 @@ concurrency: cancel-in-progress: true env: + PIP_BREAK_SYSTEM_PACKAGES: 1 PIP_ONLY_BINARY: ":all:" # For cmake: VERBOSE: 1