Skip to content

pybind11: v2.6.2+ #977

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

Merged
merged 2 commits into from
May 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Other
"""""

- ADIOS2: require version 2.7.0+ #927
- pybind11: require version 2.6.2+ #977


0.13.4
Expand Down
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,9 @@ if(openPMD_USE_PYTHON STREQUAL AUTO)
if(openPMD_USE_INTERNAL_PYBIND11)
add_subdirectory("${openPMD_SOURCE_DIR}/share/openPMD/thirdParty/pybind11")
set(openPMD_HAVE_PYTHON TRUE)
message(STATUS "pybind11: Using INTERNAL version 2.6.1")
message(STATUS "pybind11: Using INTERNAL version 2.6.2")
else()
find_package(pybind11 2.6.1 CONFIG)
find_package(pybind11 2.6.2 CONFIG)
if(pybind11_FOUND)
set(openPMD_HAVE_PYTHON TRUE)
message(STATUS "pybind11: Found version '${pybind11_VERSION}'")
Expand All @@ -320,9 +320,9 @@ elseif(openPMD_USE_PYTHON)
if(openPMD_USE_INTERNAL_PYBIND11)
add_subdirectory("${openPMD_SOURCE_DIR}/share/openPMD/thirdParty/pybind11")
set(openPMD_HAVE_PYTHON TRUE)
message(STATUS "pybind11: Using INTERNAL version 2.6.1")
message(STATUS "pybind11: Using INTERNAL version 2.6.2")
else()
find_package(pybind11 2.6.1 REQUIRED CONFIG)
find_package(pybind11 2.6.2 REQUIRED CONFIG)
set(openPMD_HAVE_PYTHON TRUE)
message(STATUS "pybind11: Found version '${pybind11_VERSION}'")
endif()
Expand Down
1 change: 1 addition & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Upgrade Guide
------

ADIOS 2.7.0 is now the minimally supported version for ADIOS2 support.
pybind11 2.6.2 is now the minimally supported version for Python support.


0.13.0
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Required:
Shipped internally in `share/openPMD/thirdParty/`:
* [MPark.Variant](https://github.com/mpark/variant) 1.4.0+ ([BSL-1.0](https://github.com/mpark/variant/blob/master/LICENSE.md))
* [Catch2](https://github.com/catchorg/Catch2) 2.13.4+ ([BSL-1.0](https://github.com/catchorg/Catch2/blob/master/LICENSE.txt))
* [pybind11](https://github.com/pybind/pybind11) 2.6.1+ ([new BSD](https://github.com/pybind/pybind11/blob/master/LICENSE))
* [pybind11](https://github.com/pybind/pybind11) 2.6.2+ ([new BSD](https://github.com/pybind/pybind11/blob/master/LICENSE))
* [NLohmann-JSON](https://github.com/nlohmann/json) 3.9.1+ ([MIT](https://github.com/nlohmann/json/blob/develop/LICENSE.MIT))

I/O backends:
Expand All @@ -120,7 +120,7 @@ while those can be built either with or without:
Optional language bindings:
* Python:
* Python 3.6 - 3.9
* pybind11 2.6.1+
* pybind11 2.6.2+
* numpy 1.15+
* mpi4py 2.1+ (optional, for MPI)
* pandas 1.0+ (optional, for dataframes)
Expand Down Expand Up @@ -262,7 +262,7 @@ The following options allow to switch to external installs:
|---------------------------------|------------|---------------|---------|
| `openPMD_USE_INTERNAL_VARIANT` | **ON**/OFF | MPark.Variant | 1.4.0+ |
| `openPMD_USE_INTERNAL_CATCH` | **ON**/OFF | Catch2 | 2.13.4+ |
| `openPMD_USE_INTERNAL_PYBIND11` | **ON**/OFF | pybind11 | 2.6.1+ |
| `openPMD_USE_INTERNAL_PYBIND11` | **ON**/OFF | pybind11 | 2.6.2+ |
| `openPMD_USE_INTERNAL_JSON` | **ON**/OFF | NLohmann-JSON | 3.9.1+ |

By default, this will build as a shared library (`libopenPMD.[so|dylib|dll]`) and installs also its headers.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/dev/buildoptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ CMake Option Values Installs Library Version
================================= =========== ======== ============= ========
``openPMD_USE_INTERNAL_VARIANT`` **ON**/OFF Yes MPark.Variant 1.4.0+
``openPMD_USE_INTERNAL_CATCH`` **ON**/OFF No Catch2 2.13.4+
``openPMD_USE_INTERNAL_PYBIND11`` **ON**/OFF No pybind11 2.6.1+
``openPMD_USE_INTERNAL_PYBIND11`` **ON**/OFF No pybind11 2.6.2+
``openPMD_USE_INTERNAL_JSON`` **ON**/OFF No NLohmann-JSON 3.9.1+
================================= =========== ======== ============= ========

Expand Down
4 changes: 2 additions & 2 deletions docs/source/dev/dependencies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The following libraries are shipped internally in ``share/openPMD/thirdParty/``

* `MPark.Variant <https://github.com/mpark/variant>`_ 1.4.0+ (`BSL-1.0 <https://github.com/mpark/variant/blob/master/LICENSE.md>`_)
* `Catch2 <https://github.com/catchorg/Catch2>`_ 2.13.4+ (`BSL-1.0 <https://github.com/catchorg/Catch2/blob/master/LICENSE.txt>`__)
* `pybind11 <https://github.com/pybind/pybind11>`_ 2.6.1+ (`new BSD <https://github.com/pybind/pybind11/blob/master/LICENSE>`_)
* `pybind11 <https://github.com/pybind/pybind11>`_ 2.6.2+ (`new BSD <https://github.com/pybind/pybind11/blob/master/LICENSE>`_)
* `NLohmann-JSON <https://github.com/nlohmann/json>`_ 3.9.1+ (`MIT <https://github.com/nlohmann/json/blob/develop/LICENSE.MIT>`_)

Optional: I/O backends
Expand All @@ -40,7 +40,7 @@ Optional: language bindings
* Python:

* Python 3.6 - 3.9
* pybind11 2.6.1+
* pybind11 2.6.2+
* numpy 1.15+
* mpi4py 2.1+ (optional, for MPI)
* pandas 1.0+ (optional, for dataframes)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ requires = [
"setuptools>=42",
"wheel",
"cmake>=3.15.0,<4.0.0",
"pybind11>=2.6.1,<3.0.0"
"pybind11>=2.6.2,<3.0.0"
]
build-backend = "setuptools.build_meta"
41 changes: 26 additions & 15 deletions share/openPMD/thirdParty/pybind11/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,13 @@ if(NOT pybind11_FIND_QUIETLY)
message(STATUS "pybind11 v${pybind11_VERSION} ${pybind11_VERSION_TYPE}")
endif()

# Avoid infinite recursion if tests include this as a subdirectory
if(DEFINED PYBIND11_MASTER_PROJECT)
set(PYBIND11_TEST OFF)
endif()

# Check if pybind11 is being used directly or via add_subdirectory
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR AND NOT DEFINED PYBIND11_MASTER_PROJECT)
### Warn if not an out-of-source builds
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
set(lines
Expand All @@ -73,6 +78,8 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()

set(pybind11_system "")
else()
set(PYBIND11_MASTER_PROJECT OFF)
set(pybind11_system SYSTEM)
Expand Down Expand Up @@ -159,12 +166,24 @@ endif()
# You can also place ifs *in* the Config.in, but not here.

# This section builds targets, but does *not* touch Python

# Build the headers-only target (no Python included):
# (long name used here to keep this from clashing in subdirectory mode)
add_library(pybind11_headers INTERFACE)
add_library(pybind11::pybind11_headers ALIAS pybind11_headers) # to match exported target
add_library(pybind11::headers ALIAS pybind11_headers) # easier to use/remember
# Non-IMPORT targets cannot be defined twice
if(NOT TARGET pybind11_headers)
# Build the headers-only target (no Python included):
# (long name used here to keep this from clashing in subdirectory mode)
add_library(pybind11_headers INTERFACE)
add_library(pybind11::pybind11_headers ALIAS pybind11_headers) # to match exported target
add_library(pybind11::headers ALIAS pybind11_headers) # easier to use/remember

target_include_directories(
pybind11_headers ${pybind11_system} INTERFACE $<BUILD_INTERFACE:${pybind11_INCLUDE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

target_compile_features(pybind11_headers INTERFACE cxx_inheriting_constructors cxx_user_literals
cxx_right_angle_brackets)
else()
# It is invalid to install a target twice, too.
set(PYBIND11_INSTALL OFF)
endif()

include("${CMAKE_CURRENT_SOURCE_DIR}/tools/pybind11Common.cmake")

Expand All @@ -175,14 +194,6 @@ elseif(USE_PYTHON_INCLUDE_DIR AND DEFINED PYTHON_INCLUDE_DIR)
file(RELATIVE_PATH CMAKE_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_PREFIX} ${PYTHON_INCLUDE_DIRS})
endif()

# Fill in headers target
target_include_directories(
pybind11_headers ${pybind11_system} INTERFACE $<BUILD_INTERFACE:${pybind11_INCLUDE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

target_compile_features(pybind11_headers INTERFACE cxx_inheriting_constructors cxx_user_literals
cxx_right_angle_brackets)

if(PYBIND11_INSTALL)
install(DIRECTORY ${pybind11_INCLUDE_DIR}/pybind11 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
set(PYBIND11_CMAKECONFIG_INSTALL_DIR
Expand Down
52 changes: 34 additions & 18 deletions share/openPMD/thirdParty/pybind11/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,27 @@

|Latest Documentation Status| |Stable Documentation Status| |Gitter chat| |CI| |Build status|

|Repology| |PyPI package| |Conda-forge| |Python Versions|

`Setuptools example <https://github.com/pybind/python_example>`_
• `Scikit-build example <https://github.com/pybind/scikit_build_example>`_
• `CMake example <https://github.com/pybind/cmake_example>`_

.. start

.. warning::

Combining older versions of pybind11 (< 2.6.0) with the brand-new Python
3.9.0 will trigger undefined behavior that typically manifests as crashes
during interpreter shutdown (but could also destroy your data. **You have been
Combining older versions of pybind11 (< 2.6.0) with Python 3.9.0 will
trigger undefined behavior that typically manifests as crashes during
interpreter shutdown (but could also destroy your data. **You have been
warned.**)

We recommend that you wait for Python 3.9.1 slated for release in December,
which will include a `fix <https://github.com/python/cpython/pull/22670>`_
that resolves this problem. In the meantime, please update to the latest
version of pybind11 (2.6.0 or newer), which includes a temporary workaround
specifically when Python 3.9.0 is detected at runtime.
We recommend that you update to the latest patch release of Python (3.9.1),
which includes a `fix <https://github.com/python/cpython/pull/22670>`_
that resolves this problem. If you do use Python 3.9.0, please update to
the latest version of pybind11 (2.6.0 or newer), which includes a temporary
workaround specifically when Python 3.9.0 is detected at runtime.


**pybind11** is a lightweight header-only library that exposes C++ types
in Python and vice versa, mainly to create Python bindings of existing
Expand All @@ -36,7 +45,7 @@ this heavy machinery has become an excessively large and unnecessary
dependency.

Think of this library as a tiny self-contained version of Boost.Python
with everything stripped away that isnt relevant for binding
with everything stripped away that isn't relevant for binding
generation. Without comments, the core header files only require ~4K
lines of code and depend on Python (2.7 or 3.5+, or PyPy) and the C++
standard library. This compact implementation was possible thanks to
Expand Down Expand Up @@ -93,15 +102,15 @@ goodies:
whenever possible to efficiently transfer custom data types.

- It's easy to expose the internal storage of custom data types through
Python's buffer protocols. THis is handy e.g. for fast conversion
Pythons' buffer protocols. This is handy e.g. for fast conversion
between C++ matrix classes like Eigen and NumPy without expensive
copy operations.

- pybind11 can automatically vectorize functions so that they are
transparently applied to all entries of one or more NumPy array
arguments.

- Pythons slice-based access and assignment operations can be
- Python's slice-based access and assignment operations can be
supported with just a few lines of code.

- Everything is contained in just a few header files; there is no need
Expand All @@ -123,15 +132,14 @@ goodies:
Supported compilers
-------------------

1. Clang/LLVM 3.3 or newer (for Apple Xcodes clang, this is 5.0.0 or
1. Clang/LLVM 3.3 or newer (for Apple Xcode's clang, this is 5.0.0 or
newer)
2. GCC 4.8 or newer
3. Microsoft Visual Studio 2015 Update 3 or newer
4. Intel C++ compiler 18 or newer
(`possible issue <https://github.com/pybind/pybind11/pull/2573>`_ on 20.2)
5. Cygwin/GCC (tested on 2.5.1)
6. NVCC (CUDA 11.0 tested)
7. NVIDIA PGI (20.7 and 20.9 tested)
4. Intel classic C++ compiler 18 or newer (ICC 20.2 tested in CI)
5. Cygwin/GCC (previously tested on 2.5.1)
6. NVCC (CUDA 11.0 tested in CI)
7. NVIDIA PGI (20.9 tested in CI)

About
-----
Expand Down Expand Up @@ -165,11 +173,19 @@ to the terms and conditions of this license.

.. |Latest Documentation Status| image:: https://readthedocs.org/projects/pybind11/badge?version=latest
:target: http://pybind11.readthedocs.org/en/latest
.. |Stable Documentation Status| image:: https://img.shields.io/badge/docs-stable-blue
.. |Stable Documentation Status| image:: https://img.shields.io/badge/docs-stable-blue.svg
:target: http://pybind11.readthedocs.org/en/stable
.. |Gitter chat| image:: https://img.shields.io/gitter/room/gitterHQ/gitter.svg
:target: https://gitter.im/pybind/Lobby
.. |CI| image:: https://github.com/pybind/pybind11/workflows/CI/badge.svg
:target: https://github.com/pybind/pybind11/actions
.. |Build status| image:: https://ci.appveyor.com/api/projects/status/riaj54pn4h08xy40?svg=true
:target: https://ci.appveyor.com/project/wjakob/pybind11
.. |PyPI package| image:: https://img.shields.io/pypi/v/pybind11.svg
:target: https://pypi.org/project/pybind11/
.. |Conda-forge| image:: https://img.shields.io/conda/vn/conda-forge/pybind11.svg
:target: https://github.com/conda-forge/pybind11-feedstock
.. |Repology| image:: https://repology.org/badge/latest-versions/python:pybind11.svg
:target: https://repology.org/project/python:pybind11/versions
.. |Python Versions| image:: https://img.shields.io/pypi/pyversions/pybind11.svg
:target: https://pypi.org/project/pybind11/
2 changes: 1 addition & 1 deletion share/openPMD/thirdParty/pybind11/include/pybind11/attr.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ template <typename... Extra,
size_t named = constexpr_sum(std::is_base_of<arg, Extra>::value...),
size_t self = constexpr_sum(std::is_same<is_method, Extra>::value...)>
constexpr bool expected_num_args(size_t nargs, bool has_args, bool has_kwargs) {
return named == 0 || (self + named + has_args + has_kwargs) == nargs;
return named == 0 || (self + named + size_t(has_args) + size_t(has_kwargs)) == nargs;
}

PYBIND11_NAMESPACE_END(detail)
Expand Down
Loading