From 1a8603e4792315d1eabcbaaa4b286a3a98963b0d Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Sun, 24 Apr 2022 13:50:29 -0400 Subject: [PATCH 1/8] ci: dependabot major versions for official actions (#3888) * ci: dependabot major versions for official actions * style: use extend-select for flake8 --- .github/dependabot.yml | 9 ++------- setup.cfg | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 73273365c..d8d1eed8c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,10 +7,5 @@ updates: interval: "daily" ignore: # Official actions have moving tags like v1 - # that are used, so they don't need updates here - - dependency-name: "actions/checkout" - - dependency-name: "actions/setup-python" - - dependency-name: "actions/cache" - - dependency-name: "actions/upload-artifact" - - dependency-name: "actions/download-artifact" - - dependency-name: "actions/labeler" + - dependency-name: "actions/*" + update-types: ["version-update:semver-minor", "version-update:semver-patch"] diff --git a/setup.cfg b/setup.cfg index 11b4fde8f..4fd1e7a6f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -46,4 +46,4 @@ max-line-length = 120 show_source = True exclude = .git, __pycache__, build, dist, docs, tools, venv extend-ignore = E203, E722, B950 -select = C,E,F,N,W,B,B9 +extend-select = B9 From b58b772b4632dca24014fee0dc193c41a448ae5d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 24 Apr 2022 14:40:58 -0400 Subject: [PATCH 2/8] chore(deps): bump actions/setup-python from 2 to 3 (#3895) Bumps [actions/setup-python](https://github.com/actions/setup-python) from 2 to 3. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 10 +++++----- .github/workflows/configure.yml | 2 +- .github/workflows/format.yml | 2 +- .github/workflows/pip.yml | 6 +++--- .github/workflows/upstream.yml | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e018fb7f..14e8adea7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,7 +65,7 @@ jobs: - uses: actions/checkout@v2 - name: Setup Python ${{ matrix.python }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: ${{ matrix.python }} @@ -680,7 +680,7 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v3 - name: Install Doxygen run: sudo apt-get install -y doxygen librsvg2-bin # Changed to rsvg-convert in 20.04 @@ -728,7 +728,7 @@ jobs: - uses: actions/checkout@v2 - name: Setup Python ${{ matrix.python }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: ${{ matrix.python }} architecture: x86 @@ -781,7 +781,7 @@ jobs: - uses: actions/checkout@v2 - name: Setup Python ${{ matrix.python }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: ${{ matrix.python }} architecture: x86 @@ -829,7 +829,7 @@ jobs: - uses: actions/checkout@v2 - name: Setup Python ${{ matrix.python }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: ${{ matrix.python }} diff --git a/.github/workflows/configure.yml b/.github/workflows/configure.yml index 55be5bd34..23cc28376 100644 --- a/.github/workflows/configure.yml +++ b/.github/workflows/configure.yml @@ -40,7 +40,7 @@ jobs: - uses: actions/checkout@v2 - name: Setup Python 3.7 - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: 3.7 architecture: ${{ matrix.arch }} diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 46140fe0c..d46f81442 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v3 - name: Add matchers run: echo "::add-matcher::$GITHUB_WORKSPACE/.github/matchers/pylint.json" - uses: pre-commit/action@v2.0.3 diff --git a/.github/workflows/pip.yml b/.github/workflows/pip.yml index 7a5443d14..b76d0c8bd 100644 --- a/.github/workflows/pip.yml +++ b/.github/workflows/pip.yml @@ -27,7 +27,7 @@ jobs: - uses: actions/checkout@v2 - name: Setup 🐍 3.6 - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: 3.6 @@ -49,7 +49,7 @@ jobs: - uses: actions/checkout@v2 - name: Setup 🐍 3.8 - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: 3.8 @@ -90,7 +90,7 @@ jobs: needs: [packaging] steps: - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v3 # Downloads all to directories matching the artifact names - uses: actions/download-artifact@v2 diff --git a/.github/workflows/upstream.yml b/.github/workflows/upstream.yml index 138c9ad29..8dc860f2b 100644 --- a/.github/workflows/upstream.yml +++ b/.github/workflows/upstream.yml @@ -22,7 +22,7 @@ jobs: - uses: actions/checkout@v2 - name: Setup Python 3.11 - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: "3.11-dev" From e79293cf2fd68578ce63c08a8663397b3af9d807 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 24 Apr 2022 14:41:09 -0400 Subject: [PATCH 3/8] chore(deps): bump actions/cache from 2 to 3 (#3898) Bumps [actions/cache](https://github.com/actions/cache) from 2 to 3. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 14e8adea7..9a99be3bb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,7 +83,7 @@ jobs: - name: Cache wheels if: runner.os == 'macOS' - uses: actions/cache@v2 + uses: actions/cache@v3 with: # This path is specific to macOS - we really only need it for PyPy NumPy wheels # See https://github.com/actions/cache/blob/master/examples.md#python---pip @@ -205,7 +205,7 @@ jobs: - name: Valgrind cache if: matrix.valgrind - uses: actions/cache@v2 + uses: actions/cache@v3 id: cache-valgrind with: path: valgrind From 2a7cb008acbf7a1942a6270b014bdf86886ed6f1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 24 Apr 2022 14:41:23 -0400 Subject: [PATCH 4/8] chore(deps): bump actions/download-artifact from 2 to 3 (#3897) Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 2 to 3. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/pip.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pip.yml b/.github/workflows/pip.yml index b76d0c8bd..7b0a73a63 100644 --- a/.github/workflows/pip.yml +++ b/.github/workflows/pip.yml @@ -93,7 +93,7 @@ jobs: - uses: actions/setup-python@v3 # Downloads all to directories matching the artifact names - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 - name: Publish standard package uses: pypa/gh-action-pypi-publish@v1.5.0 From 82455a41fdc9cabf6a0eeba2071dc8a0c8cac4c1 Mon Sep 17 00:00:00 2001 From: Aaron Gokaslan Date: Sun, 24 Apr 2022 14:46:39 -0400 Subject: [PATCH 5/8] Minor opt to cache tuple casting (#3894) --- include/pybind11/numpy.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/pybind11/numpy.h b/include/pybind11/numpy.h index 2713e13a8..b8ba2259f 100644 --- a/include/pybind11/numpy.h +++ b/include/pybind11/numpy.h @@ -647,8 +647,9 @@ private: for (auto field : attr("fields").attr("items")()) { auto spec = field.cast(); auto name = spec[0].cast(); - auto format = spec[1].cast()[0].cast(); - auto offset = spec[1].cast()[1].cast(); + auto spec_fo = spec[1].cast(); + auto format = spec_fo[0].cast(); + auto offset = spec_fo[1].cast(); if ((len(name) == 0u) && format.kind() == 'V') { continue; } From be4a634c675fc55db6da595c322f2ca947096862 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 24 Apr 2022 16:49:13 -0400 Subject: [PATCH 6/8] chore(deps): bump actions/checkout from 2 to 3 (#3896) Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 30 +++++++++++++++--------------- .github/workflows/configure.yml | 2 +- .github/workflows/format.yml | 4 ++-- .github/workflows/pip.yml | 4 ++-- .github/workflows/upstream.yml | 2 +- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a99be3bb..aeceaee2c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,7 +62,7 @@ jobs: runs-on: ${{ matrix.runs-on }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup Python ${{ matrix.python }} uses: actions/setup-python@v3 @@ -192,7 +192,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup Python ${{ matrix.python-version }} (deadsnakes) uses: deadsnakes/action@v2.1.1 @@ -285,7 +285,7 @@ jobs: container: "silkeh/clang:${{ matrix.clang }}" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Add wget and python3 run: apt-get update && apt-get install -y python3-dev python3-numpy python3-pytest libeigen3-dev @@ -319,7 +319,7 @@ jobs: container: nvidia/cuda:11.0-devel-ubuntu20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 # tzdata will try to ask for the timezone, so set the DEBIAN_FRONTEND - name: Install 🐍 3 @@ -343,7 +343,7 @@ jobs: # container: centos:8 # # steps: -# - uses: actions/checkout@v2 +# - uses: actions/checkout@v3 # # - name: Add Python 3 and a few requirements # run: yum update -y && yum install -y git python3-devel python3-numpy python3-pytest make environment-modules @@ -386,7 +386,7 @@ jobs: container: centos:7 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Add Python 3 and a few requirements run: yum update -y && yum install -y epel-release && yum install -y git python3-devel make environment-modules cmake3 @@ -447,7 +447,7 @@ jobs: container: "gcc:${{ matrix.gcc }}" steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: Add Python 3 run: apt-get update; apt-get install -y python3-dev python3-numpy python3-pytest python3-pip libeigen3-dev @@ -489,7 +489,7 @@ jobs: name: "🐍 3 • ICC latest • x64" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Add apt repo run: | @@ -592,7 +592,7 @@ jobs: container: "quay.io/centos/centos:${{ matrix.centos }}" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Add Python 3 run: yum update -y && yum install -y python3-devel gcc-c++ make git @@ -635,7 +635,7 @@ jobs: container: i386/debian:buster steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: Install requirements run: | @@ -678,7 +678,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: actions/setup-python@v3 @@ -725,7 +725,7 @@ jobs: runs-on: windows-2019 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup Python ${{ matrix.python }} uses: actions/setup-python@v3 @@ -778,7 +778,7 @@ jobs: runs-on: windows-2019 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup Python ${{ matrix.python }} uses: actions/setup-python@v3 @@ -826,7 +826,7 @@ jobs: runs-on: windows-2022 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup Python ${{ matrix.python }} uses: actions/setup-python@v3 @@ -889,7 +889,7 @@ jobs: mingw-w64-${{matrix.env}}-boost mingw-w64-${{matrix.env}}-catch - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Configure C++11 # LTO leads to many undefined reference like diff --git a/.github/workflows/configure.yml b/.github/workflows/configure.yml index 23cc28376..aa2485ac0 100644 --- a/.github/workflows/configure.yml +++ b/.github/workflows/configure.yml @@ -37,7 +37,7 @@ jobs: runs-on: ${{ matrix.runs-on }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup Python 3.7 uses: actions/setup-python@v3 diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index d46f81442..5eb228a70 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -20,7 +20,7 @@ jobs: name: Format runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: actions/setup-python@v3 - name: Add matchers run: echo "::add-matcher::$GITHUB_WORKSPACE/.github/matchers/pylint.json" @@ -36,7 +36,7 @@ jobs: runs-on: ubuntu-latest container: silkeh/clang:12 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install requirements run: apt-get update && apt-get install -y python3-dev python3-pytest diff --git a/.github/workflows/pip.yml b/.github/workflows/pip.yml index 7b0a73a63..6e7afa385 100644 --- a/.github/workflows/pip.yml +++ b/.github/workflows/pip.yml @@ -24,7 +24,7 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup 🐍 3.6 uses: actions/setup-python@v3 @@ -46,7 +46,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup 🐍 3.8 uses: actions/setup-python@v3 diff --git a/.github/workflows/upstream.yml b/.github/workflows/upstream.yml index 8dc860f2b..174dc2496 100644 --- a/.github/workflows/upstream.yml +++ b/.github/workflows/upstream.yml @@ -19,7 +19,7 @@ jobs: if: "contains(github.event.pull_request.labels.*.name, 'python dev')" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup Python 3.11 uses: actions/setup-python@v3 From 03252067db057777db75c2e5bcf0e69013b919ec Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 24 Apr 2022 16:49:41 -0400 Subject: [PATCH 7/8] chore(deps): bump actions/upload-artifact from 2 to 3 (#3899) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2 to 3. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/pip.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pip.yml b/.github/workflows/pip.yml index 6e7afa385..1d9a35604 100644 --- a/.github/workflows/pip.yml +++ b/.github/workflows/pip.yml @@ -69,13 +69,13 @@ jobs: run: twine check dist/* - name: Save standard package - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: standard path: dist/pybind11-* - name: Save global package - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: global path: dist/pybind11_global-* From 9bc270443068c90298c0220cd866fbf9ea1bb589 Mon Sep 17 00:00:00 2001 From: Ed Catmur Date: Sun, 24 Apr 2022 22:39:47 +0100 Subject: [PATCH 8/8] Add tests for cast from tuple to sequence containers (#3900) We already test that tuple can cast to std::vector and std::deque; add tests for std::vector, std::list and std::valarray. Extracted from #3886. --- tests/test_stl.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_stl.py b/tests/test_stl.py index 3dc55230a..975860b85 100644 --- a/tests/test_stl.py +++ b/tests/test_stl.py @@ -14,6 +14,7 @@ def test_vector(doc): assert m.cast_bool_vector() == [True, False] assert m.load_bool_vector([True, False]) + assert m.load_bool_vector(tuple([True, False])) assert doc(m.cast_vector) == "cast_vector() -> List[int]" assert doc(m.load_vector) == "load_vector(arg0: List[int]) -> bool" @@ -36,6 +37,7 @@ def test_array(doc): lst = m.cast_array() assert lst == [1, 2] assert m.load_array(lst) + assert m.load_array(tuple(lst)) assert doc(m.cast_array) == "cast_array() -> List[int[2]]" assert doc(m.load_array) == "load_array(arg0: List[int[2]]) -> bool" @@ -46,6 +48,7 @@ def test_valarray(doc): lst = m.cast_valarray() assert lst == [1, 4, 9] assert m.load_valarray(lst) + assert m.load_valarray(tuple(lst)) assert doc(m.cast_valarray) == "cast_valarray() -> List[int]" assert doc(m.load_valarray) == "load_valarray(arg0: List[int]) -> bool"