Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git merge smart_holder (pybind/pybind11#5026, pybind/pybind11#5033) #30102

Merged
merged 9 commits into from
Feb 20, 2024
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ updates:
actions:
patterns:
- "*"
ignore:
- dependency-name: actions/checkout
versions:
- "<5"
22 changes: 10 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ jobs:
run: brew install boost

- name: Update CMake
uses: jwlawson/actions-setup-cmake@v1.14
uses: jwlawson/actions-setup-cmake@v2.0

- name: Cache wheels
if: runner.os == 'macOS'
uses: actions/cache@v3
uses: actions/cache@v4
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
Expand Down Expand Up @@ -215,11 +215,11 @@ jobs:
debug: ${{ matrix.python-debug }}

- name: Update CMake
uses: jwlawson/actions-setup-cmake@v1.14
uses: jwlawson/actions-setup-cmake@v2.0

- name: Valgrind cache
if: matrix.valgrind
uses: actions/cache@v3
uses: actions/cache@v4
id: cache-valgrind
with:
path: valgrind
Expand Down Expand Up @@ -485,7 +485,7 @@ jobs:
run: python3 -m pip install --upgrade pip

- name: Update CMake
uses: jwlawson/actions-setup-cmake@v1.14
uses: jwlawson/actions-setup-cmake@v2.0

- name: Configure
shell: bash
Expand Down Expand Up @@ -530,8 +530,6 @@ jobs:
# Testing on ICC using the oneAPI apt repo
icc:
runs-on: ubuntu-20.04
strategy:
fail-fast: false

name: "🐍 3 • ICC latest • x64"

Expand Down Expand Up @@ -798,7 +796,7 @@ jobs:
architecture: x86

- name: Update CMake
uses: jwlawson/actions-setup-cmake@v1.14
uses: jwlawson/actions-setup-cmake@v2.0

- name: Prepare MSVC
uses: ilammy/[email protected]
Expand Down Expand Up @@ -851,7 +849,7 @@ jobs:
architecture: x86

- name: Update CMake
uses: jwlawson/actions-setup-cmake@v1.14
uses: jwlawson/actions-setup-cmake@v2.0

- name: Prepare MSVC
uses: ilammy/[email protected]
Expand Down Expand Up @@ -902,7 +900,7 @@ jobs:
python3 -m pip install -r tests/requirements.txt

- name: Update CMake
uses: jwlawson/actions-setup-cmake@v1.14
uses: jwlawson/actions-setup-cmake@v2.0

- name: Configure C++20
run: >
Expand Down Expand Up @@ -1066,7 +1064,7 @@ jobs:
python-version: ${{ matrix.python }}

- name: Update CMake
uses: jwlawson/actions-setup-cmake@v1.14
uses: jwlawson/actions-setup-cmake@v2.0

- name: Install ninja-build tool
uses: seanmiddleditch/gha-setup-ninja@v4
Expand Down Expand Up @@ -1136,7 +1134,7 @@ jobs:
run: clang++ --version

- name: Update CMake
uses: jwlawson/actions-setup-cmake@v1.14
uses: jwlawson/actions-setup-cmake@v2.0

- name: Run pip installs
run: |
Expand Down
22 changes: 10 additions & 12 deletions .github/workflows/ci_sh_def.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ jobs:
run: brew install boost

- name: Update CMake
uses: jwlawson/actions-setup-cmake@v1.14
uses: jwlawson/actions-setup-cmake@v2.0

- name: Cache wheels
if: runner.os == 'macOS'
uses: actions/cache@v3
uses: actions/cache@v4
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
Expand Down Expand Up @@ -230,11 +230,11 @@ jobs:
debug: ${{ matrix.python-debug }}

- name: Update CMake
uses: jwlawson/actions-setup-cmake@v1.14
uses: jwlawson/actions-setup-cmake@v2.0

- name: Valgrind cache
if: matrix.valgrind
uses: actions/cache@v3
uses: actions/cache@v4
id: cache-valgrind
with:
path: valgrind
Expand Down Expand Up @@ -502,7 +502,7 @@ jobs:
run: python3 -m pip install --upgrade pip

- name: Update CMake
uses: jwlawson/actions-setup-cmake@v1.14
uses: jwlawson/actions-setup-cmake@v2.0

- name: Configure
shell: bash
Expand Down Expand Up @@ -549,8 +549,6 @@ jobs:
# Testing on ICC using the oneAPI apt repo
icc:
runs-on: ubuntu-20.04
strategy:
fail-fast: false

name: "🐍 3 • ICC latest • x64"

Expand Down Expand Up @@ -821,7 +819,7 @@ jobs:
architecture: x86

- name: Update CMake
uses: jwlawson/actions-setup-cmake@v1.14
uses: jwlawson/actions-setup-cmake@v2.0

- name: Prepare MSVC
uses: ilammy/[email protected]
Expand Down Expand Up @@ -875,7 +873,7 @@ jobs:
architecture: x86

- name: Update CMake
uses: jwlawson/actions-setup-cmake@v1.14
uses: jwlawson/actions-setup-cmake@v2.0

- name: Prepare MSVC
uses: ilammy/[email protected]
Expand Down Expand Up @@ -927,7 +925,7 @@ jobs:
python3 -m pip install -r tests/requirements.txt

- name: Update CMake
uses: jwlawson/actions-setup-cmake@v1.14
uses: jwlawson/actions-setup-cmake@v2.0

- name: Configure C++20
run: >
Expand Down Expand Up @@ -1096,7 +1094,7 @@ jobs:
python-version: ${{ matrix.python }}

- name: Update CMake
uses: jwlawson/actions-setup-cmake@v1.14
uses: jwlawson/actions-setup-cmake@v2.0

- name: Install ninja-build tool
uses: seanmiddleditch/gha-setup-ninja@v4
Expand Down Expand Up @@ -1167,7 +1165,7 @@ jobs:
run: clang++ --version

- name: Update CMake
uses: jwlawson/actions-setup-cmake@v1.14
uses: jwlawson/actions-setup-cmake@v2.0

- name: Run pip installs
run: |
Expand Down
32 changes: 16 additions & 16 deletions .github/workflows/ci_sh_def.yml.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- ci.yml 2024-01-16 21:10:28.100295655 -0800
+++ ci_sh_def.yml 2024-01-16 21:10:56.792251785 -0800
--- ci.yml 2024-02-20 12:29:08.800226093 -0800
+++ ci_sh_def.yml 2024-02-20 12:29:39.408187912 -0800
@@ -1,4 +1,16 @@
-name: CI
+# PLEASE KEEP THIS GROUP OF FILES IN SYNC AT ALL TIMES:
Expand Down Expand Up @@ -101,111 +101,111 @@
-DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")
"-DPYBIND11_TEST_OVERRIDE=test_call_policies.cpp;test_gil_scoped.cpp;test_thread.cpp"

@@ -567,6 +586,7 @@
@@ -565,6 +584,7 @@
-DDOWNLOAD_CATCH=ON \
-DDOWNLOAD_EIGEN=OFF \
-DCMAKE_CXX_STANDARD=11 \
+ -DCMAKE_CXX_FLAGS="-DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT" \
-DCMAKE_CXX_COMPILER=$(which icpc) \
-DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")

@@ -599,6 +619,7 @@
@@ -597,6 +617,7 @@
-DDOWNLOAD_CATCH=ON \
-DDOWNLOAD_EIGEN=OFF \
-DCMAKE_CXX_STANDARD=17 \
+ -DCMAKE_CXX_FLAGS="-DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT" \
-DCMAKE_CXX_COMPILER=$(which icpc) \
-DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")

@@ -672,6 +693,7 @@
@@ -670,6 +691,7 @@
-DDOWNLOAD_CATCH=ON
-DDOWNLOAD_EIGEN=ON
-DCMAKE_CXX_STANDARD=11
+ -DCMAKE_CXX_FLAGS="-DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT"
-DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")

- name: Build
@@ -722,6 +744,7 @@
@@ -720,6 +742,7 @@
cmake ../pybind11-tests
-DDOWNLOAD_CATCH=ON
-DPYBIND11_WERROR=ON
+ -DCMAKE_CXX_FLAGS="-DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT"
-DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")
working-directory: /build-tests

@@ -817,6 +840,7 @@
@@ -815,6 +838,7 @@
-DPYBIND11_WERROR=ON
-DDOWNLOAD_CATCH=ON
-DDOWNLOAD_EIGEN=ON
+ -DCMAKE_CXX_FLAGS="/GR /EHsc /DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT"
${{ matrix.args }}
- name: Build C++11
run: cmake --build build -j 2
@@ -871,6 +895,7 @@
@@ -869,6 +893,7 @@
-DPYBIND11_WERROR=ON
-DDOWNLOAD_CATCH=ON
-DDOWNLOAD_EIGEN=ON
+ -DCMAKE_CXX_FLAGS="/GR /EHsc /DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT"
${{ matrix.args }}
- name: Build C++11
run: cmake --build build --config Debug -j 2
@@ -911,6 +936,7 @@
@@ -909,6 +934,7 @@
-DDOWNLOAD_CATCH=ON
-DDOWNLOAD_EIGEN=ON
-DCMAKE_CXX_STANDARD=20
+ -DCMAKE_CXX_FLAGS="/GR /EHsc /DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT"

- name: Build C++20
run: cmake --build build -j 2
@@ -931,6 +957,7 @@
@@ -929,6 +955,7 @@
-DDOWNLOAD_CATCH=ON
-DDOWNLOAD_EIGEN=ON
-DCMAKE_CXX_STANDARD=20
+ -DCMAKE_CXX_FLAGS="/GR /EHsc /DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT"
"-DPYBIND11_TEST_OVERRIDE=test_call_policies.cpp;test_gil_scoped.cpp;test_thread.cpp"

- name: Build C++20 - Exercise cmake -DPYBIND11_TEST_OVERRIDE
@@ -983,6 +1010,7 @@
@@ -981,6 +1008,7 @@
run: >-
cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=11 -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON
-DPYTHON_EXECUTABLE=$(python -c "import sys; print(sys.executable)")
+ -DCMAKE_CXX_FLAGS="-DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT"
-S . -B build

- name: Build C++11
@@ -1004,6 +1032,7 @@
@@ -1002,6 +1030,7 @@
run: >-
cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=14 -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON
-DPYTHON_EXECUTABLE=$(python -c "import sys; print(sys.executable)")
+ -DCMAKE_CXX_FLAGS="-DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT"
-S . -B build2

- name: Build C++14
@@ -1025,6 +1054,7 @@
@@ -1023,6 +1052,7 @@
run: >-
cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=17 -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON
-DPYTHON_EXECUTABLE=$(python -c "import sys; print(sys.executable)")
+ -DCMAKE_CXX_FLAGS="-DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT"
-S . -B build3

- name: Build C++17
@@ -1092,6 +1122,7 @@
@@ -1090,6 +1120,7 @@
-DDOWNLOAD_EIGEN=ON
-DCMAKE_CXX_COMPILER=clang++
-DCMAKE_CXX_STANDARD=17
+ -DCMAKE_CXX_FLAGS="-DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT"

- name: Build
run: cmake --build . -j 2
@@ -1157,6 +1188,7 @@
@@ -1155,6 +1186,7 @@
-DDOWNLOAD_EIGEN=ON
-DCMAKE_CXX_COMPILER=clang++
-DCMAKE_CXX_STANDARD=17
+ -DCMAKE_CXX_FLAGS="-DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT"
-DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")

- name: Build
@@ -1180,6 +1212,7 @@
@@ -1178,6 +1210,7 @@
-DDOWNLOAD_EIGEN=ON
-DCMAKE_CXX_COMPILER=clang++
-DCMAKE_CXX_STANDARD=17
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
# An action for adding a specific version of CMake:
# https://github.com/jwlawson/actions-setup-cmake
- name: Setup CMake ${{ matrix.cmake }}
uses: jwlawson/actions-setup-cmake@v1.14
uses: jwlawson/actions-setup-cmake@v2.0
with:
cmake-version: ${{ matrix.cmake }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
python-version: "3.x"
- name: Add matchers
run: echo "::add-matcher::$GITHUB_WORKSPACE/.github/matchers/pylint.json"
- uses: pre-commit/[email protected].0
- uses: pre-commit/[email protected].1
with:
# Slow hooks are marked with manual - slow is okay here, run them too
extra_args: --hook-stage manual --all-files
Expand Down
11 changes: 9 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ repos:

# Ruff, the Python auto-correcting linter/formatter written in Rust
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
rev: v0.2.0
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand Down Expand Up @@ -95,7 +95,7 @@ repos:

# Avoid directional quotes
- repo: https://github.com/sirosen/texthooks
rev: "0.6.3"
rev: "0.6.4"
hooks:
- id: fix-ligatures
- id: fix-smartquotes
Expand Down Expand Up @@ -148,3 +148,10 @@ repos:
hooks:
- id: pylint
files: ^pybind11

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.28.0
hooks:
- id: check-readthedocs
- id: check-github-workflows
- id: check-dependabot
8 changes: 8 additions & 0 deletions docs/compiling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -639,3 +639,11 @@ cross-project dependency management. Additionally, it is able to autogenerate
customizable pybind11-based wrappers by parsing C++ header files.

.. [robotpy-build] https://robotpy-build.readthedocs.io

[litgen]_ is an automatic python bindings generator with a focus on generating
documented and discoverable bindings: bindings will nicely reproduce the documentation
found in headers. It is is based on srcML (srcml.org), a highly scalable, multi-language
parsing tool with a developer centric approach. The API that you want to expose to python
must be C++14 compatible (but your implementation can use more modern constructs).

.. [litgen] https://pthom.github.io/litgen
Loading