Skip to content

Commit 23377c0

Browse files
committed
Merge branch 'master' into master_with_dummy_change
2 parents 7a98bcc + f33f6af commit 23377c0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+803
-251
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,15 @@ jobs:
108108
run: python -m pip install pytest-github-actions-annotate-failures
109109

110110
# First build - C++11 mode and inplace
111-
# More-or-less randomly adding -DPYBIND11_SIMPLE_GIL_MANAGEMENT=ON here.
111+
# More-or-less randomly adding -DPYBIND11_SIMPLE_GIL_MANAGEMENT=ON here
112+
# (same for PYBIND11_NUMPY_1_ONLY, but requires a NumPy 1.x at runtime).
112113
- name: Configure C++11 ${{ matrix.args }}
113114
run: >
114115
cmake -S . -B .
115116
-DPYBIND11_WERROR=ON
117+
-DPYBIND11_DISABLE_HANDLE_TYPE_NAME_DEFAULT_IMPLEMENTATION=ON
116118
-DPYBIND11_SIMPLE_GIL_MANAGEMENT=ON
119+
-DPYBIND11_NUMPY_1_ONLY=ON
117120
-DDOWNLOAD_CATCH=ON
118121
-DDOWNLOAD_EIGEN=ON
119122
-DCMAKE_CXX_STANDARD=11
@@ -138,11 +141,13 @@ jobs:
138141

139142
# Second build - C++17 mode and in a build directory
140143
# More-or-less randomly adding -DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF here.
144+
# (same for PYBIND11_NUMPY_1_ONLY, but requires a NumPy 1.x at runtime).
141145
- name: Configure C++17
142146
run: >
143147
cmake -S . -B build2
144148
-DPYBIND11_WERROR=ON
145149
-DPYBIND11_SIMPLE_GIL_MANAGEMENT=OFF
150+
-DPYBIND11_NUMPY_1_ONLY=ON
146151
-DDOWNLOAD_CATCH=ON
147152
-DDOWNLOAD_EIGEN=ON
148153
-DCMAKE_CXX_STANDARD=17
@@ -660,6 +665,11 @@ jobs:
660665
run: |
661666
python3 -m pip install cmake -r tests/requirements.txt
662667
668+
- name: Ensure NumPy 2 is used (required Python >= 3.9)
669+
if: matrix.container == 'almalinux:9'
670+
run: |
671+
python3 -m pip install 'numpy>=2.0.0b1' 'scipy>=1.13.0rc1'
672+
663673
- name: Configure
664674
shell: bash
665675
run: >
@@ -895,8 +905,10 @@ jobs:
895905
python-version: ${{ matrix.python }}
896906

897907
- name: Prepare env
908+
# Ensure use of NumPy 2 (via NumPy nightlies but can be changed soon)
898909
run: |
899910
python3 -m pip install -r tests/requirements.txt
911+
python3 -m pip install 'numpy>=2.0.0b1' 'scipy>=1.13.0rc1'
900912
901913
- name: Update CMake
902914
uses: jwlawson/actions-setup-cmake@v2.0

.github/workflows/configure.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535

3636
- runs-on: ubuntu-20.04
3737
arch: x64
38-
cmake: "3.27"
38+
cmake: "3.29"
3939

4040
- runs-on: macos-latest
4141
arch: x64

.github/workflows/labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
pull-requests: write
1515
steps:
1616

17-
- uses: actions/labeler@main
17+
- uses: actions/labeler@v4
1818
if: >
1919
github.event.pull_request.merged == true &&
2020
!startsWith(github.event.pull_request.title, 'chore(deps):') &&

.pre-commit-config.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,28 @@ repos:
2525

2626
# Clang format the codebase automatically
2727
- repo: https://github.com/pre-commit/mirrors-clang-format
28-
rev: "v17.0.6"
28+
rev: "v18.1.2"
2929
hooks:
3030
- id: clang-format
3131
types_or: [c++, c, cuda]
3232

3333
# Ruff, the Python auto-correcting linter/formatter written in Rust
3434
- repo: https://github.com/astral-sh/ruff-pre-commit
35-
rev: v0.2.0
35+
rev: v0.3.5
3636
hooks:
3737
- id: ruff
3838
args: ["--fix", "--show-fixes"]
3939
- id: ruff-format
4040

4141
# Check static types with mypy
4242
- repo: https://github.com/pre-commit/mirrors-mypy
43-
rev: "v1.8.0"
43+
rev: "v1.9.0"
4444
hooks:
4545
- id: mypy
4646
args: []
4747
exclude: ^(tests|docs)/
4848
additional_dependencies:
49-
- markdown-it-py<3 # Drop this together with dropping Python 3.7 support.
49+
- markdown-it-py
5050
- nox
5151
- rich
5252
- types-setuptools
@@ -87,13 +87,13 @@ repos:
8787

8888
# Changes tabs to spaces
8989
- repo: https://github.com/Lucas-C/pre-commit-hooks
90-
rev: "v1.5.4"
90+
rev: "v1.5.5"
9191
hooks:
9292
- id: remove-tabs
9393

9494
# Avoid directional quotes
9595
- repo: https://github.com/sirosen/texthooks
96-
rev: "0.6.4"
96+
rev: "0.6.6"
9797
hooks:
9898
- id: fix-ligatures
9999
- id: fix-smartquotes
@@ -127,7 +127,7 @@ repos:
127127

128128
# Check for common shell mistakes
129129
- repo: https://github.com/shellcheck-py/shellcheck-py
130-
rev: "v0.9.0.6"
130+
rev: "v0.10.0.1"
131131
hooks:
132132
- id: shellcheck
133133

@@ -142,13 +142,13 @@ repos:
142142

143143
# PyLint has native support - not always usable, but works for us
144144
- repo: https://github.com/PyCQA/pylint
145-
rev: "v3.0.3"
145+
rev: "v3.1.0"
146146
hooks:
147147
- id: pylint
148148
files: ^pybind11
149149

150150
- repo: https://github.com/python-jsonschema/check-jsonschema
151-
rev: 0.28.0
151+
rev: 0.28.1
152152
hooks:
153153
- id: check-readthedocs
154154
- id: check-github-workflows

CMakeLists.txt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ endif()
1212

1313
cmake_minimum_required(VERSION 3.5)
1414

15-
# The `cmake_minimum_required(VERSION 3.5...3.27)` syntax does not work with
15+
# The `cmake_minimum_required(VERSION 3.5...3.29)` syntax does not work with
1616
# some versions of VS that have a patched CMake 3.11. This forces us to emulate
1717
# the behavior using the following workaround:
18-
if(${CMAKE_VERSION} VERSION_LESS 3.27)
18+
if(${CMAKE_VERSION} VERSION_LESS 3.29)
1919
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
2020
else()
21-
cmake_policy(VERSION 3.27)
21+
cmake_policy(VERSION 3.29)
2222
endif()
2323

2424
if(_pybind11_cmp0148)
@@ -107,15 +107,25 @@ endif()
107107
option(PYBIND11_INSTALL "Install pybind11 header files?" ${PYBIND11_MASTER_PROJECT})
108108
option(PYBIND11_TEST "Build pybind11 test suite?" ${PYBIND11_MASTER_PROJECT})
109109
option(PYBIND11_NOPYTHON "Disable search for Python" OFF)
110+
option(PYBIND11_DISABLE_HANDLE_TYPE_NAME_DEFAULT_IMPLEMENTATION
111+
"To enforce that a handle_type_name<> specialization exists" OFF)
110112
option(PYBIND11_SIMPLE_GIL_MANAGEMENT
111113
"Use simpler GIL management logic that does not support disassociation" OFF)
114+
option(PYBIND11_NUMPY_1_ONLY
115+
"Disable NumPy 2 support to avoid changes to previous pybind11 versions." OFF)
112116
set(PYBIND11_INTERNALS_VERSION
113117
""
114118
CACHE STRING "Override the ABI version, may be used to enable the unstable ABI.")
115119

120+
if(PYBIND11_DISABLE_HANDLE_TYPE_NAME_DEFAULT_IMPLEMENTATION)
121+
add_compile_definitions(PYBIND11_DISABLE_HANDLE_TYPE_NAME_DEFAULT_IMPLEMENTATION)
122+
endif()
116123
if(PYBIND11_SIMPLE_GIL_MANAGEMENT)
117124
add_compile_definitions(PYBIND11_SIMPLE_GIL_MANAGEMENT)
118125
endif()
126+
if(PYBIND11_NUMPY_1_ONLY)
127+
add_compile_definitions(PYBIND11_NUMPY_1_ONLY)
128+
endif()
119129

120130
cmake_dependent_option(
121131
USE_PYTHON_INCLUDE_DIR

README.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ with everything stripped away that isn't relevant for binding
3636
generation. Without comments, the core header files only require ~4K
3737
lines of code and depend on Python (3.6+, or PyPy) and the C++
3838
standard library. This compact implementation was possible thanks to
39-
some of the new C++11 language features (specifically: tuples, lambda
40-
functions and variadic templates). Since its creation, this library has
41-
grown beyond Boost.Python in many ways, leading to dramatically simpler
42-
binding code in many common situations.
39+
some C++11 language features (specifically: tuples, lambda functions and
40+
variadic templates). Since its creation, this library has grown beyond
41+
Boost.Python in many ways, leading to dramatically simpler binding code in many
42+
common situations.
4343

4444
Tutorial and reference documentation is provided at
4545
`pybind11.readthedocs.io <https://pybind11.readthedocs.io/en/latest>`_.
@@ -71,6 +71,7 @@ pybind11 can map the following core C++ features to Python:
7171
- Internal references with correct reference counting
7272
- C++ classes with virtual (and pure virtual) methods can be extended
7373
in Python
74+
- Integrated NumPy support (NumPy 2 requires pybind11 2.12+)
7475

7576
Goodies
7677
-------

docs/advanced/embedding.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ information, see :doc:`/compiling`.
1818

1919
.. code-block:: cmake
2020
21-
cmake_minimum_required(VERSION 3.5...3.27)
21+
cmake_minimum_required(VERSION 3.5...3.29)
2222
project(example)
2323
2424
find_package(pybind11 REQUIRED) # or `add_subdirectory(pybind11)`

0 commit comments

Comments
 (0)