Skip to content

Commit

Permalink
Multi-step, slightly messy merge of v2.10.0 (aa304c9)
Browse files Browse the repository at this point in the history
# Conflicts:
#	.clang-format
#	.clang-tidy
#	.github/CONTRIBUTING.md
#	.github/workflows/ci.yml
#	.github/workflows/configure.yml
#	.github/workflows/upstream.yml
#	.pre-commit-config.yaml
#	docs/Doxyfile
#	docs/advanced/cast/overview.rst
#	docs/advanced/exceptions.rst
#	docs/advanced/functions.rst
#	docs/advanced/pycpp/numpy.rst
#	docs/benchmark.py
#	docs/changelog.rst
#	docs/classes.rst
#	docs/compiling.rst
#	docs/requirements.txt
#	docs/upgrade.rst
#	include/pybind11/attr.h
#	include/pybind11/buffer_info.h
#	include/pybind11/cast.h
#	include/pybind11/chrono.h
#	include/pybind11/detail/class.h
#	include/pybind11/detail/common.h
#	include/pybind11/detail/descr.h
#	include/pybind11/detail/init.h
#	include/pybind11/detail/internals.h
#	include/pybind11/detail/type_caster_base.h
#	include/pybind11/eigen.h
#	include/pybind11/embed.h
#	include/pybind11/eval.h
#	include/pybind11/functional.h
#	include/pybind11/gil.h
#	include/pybind11/iostream.h
#	include/pybind11/numpy.h
#	include/pybind11/operators.h
#	include/pybind11/pybind11.h
#	include/pybind11/pytypes.h
#	include/pybind11/stl.h
#	include/pybind11/stl/filesystem.h
#	include/pybind11/stl_bind.h
#	noxfile.py
#	pybind11/__init__.py
#	pybind11/_version.py
#	pybind11/_version.pyi
#	pybind11/setup_helpers.py
#	pybind11/setup_helpers.pyi
#	pyproject.toml
#	setup.cfg
#	setup.py
#	tests/CMakeLists.txt
#	tests/env.py
#	tests/extra_python_package/test_files.py
#	tests/extra_setuptools/test_setuphelper.py
#	tests/local_bindings.h
#	tests/object.h
#	tests/pybind11_cross_module_tests.cpp
#	tests/pybind11_tests.h
#	tests/requirements.txt
#	tests/test_buffers.cpp
#	tests/test_buffers.py
#	tests/test_builtin_casters.cpp
#	tests/test_builtin_casters.py
#	tests/test_call_policies.cpp
#	tests/test_callbacks.cpp
#	tests/test_callbacks.py
#	tests/test_chrono.py
#	tests/test_class.cpp
#	tests/test_cmake_build/test.py
#	tests/test_constants_and_functions.cpp
#	tests/test_copy_move.cpp
#	tests/test_custom_type_casters.cpp
#	tests/test_custom_type_setup.py
#	tests/test_eigen.cpp
#	tests/test_eigen.py
#	tests/test_embed/test_interpreter.cpp
#	tests/test_embed/test_interpreter.py
#	tests/test_embed/test_trampoline.py
#	tests/test_enum.cpp
#	tests/test_enum.py
#	tests/test_eval.cpp
#	tests/test_exceptions.cpp
#	tests/test_exceptions.h
#	tests/test_exceptions.py
#	tests/test_factory_constructors.cpp
#	tests/test_factory_constructors.py
#	tests/test_gil_scoped.cpp
#	tests/test_iostream.py
#	tests/test_kwargs_and_defaults.cpp
#	tests/test_kwargs_and_defaults.py
#	tests/test_local_bindings.cpp
#	tests/test_methods_and_attributes.cpp
#	tests/test_methods_and_attributes.py
#	tests/test_modules.cpp
#	tests/test_modules.py
#	tests/test_multiple_inheritance.cpp
#	tests/test_multiple_inheritance.py
#	tests/test_numpy_array.cpp
#	tests/test_numpy_dtypes.cpp
#	tests/test_numpy_dtypes.py
#	tests/test_numpy_vectorize.cpp
#	tests/test_opaque_types.cpp
#	tests/test_operator_overloading.cpp
#	tests/test_ownership_transfer.cpp
#	tests/test_pickling.cpp
#	tests/test_pytypes.cpp
#	tests/test_pytypes.py
#	tests/test_sequences_and_iterators.cpp
#	tests/test_sequences_and_iterators.py
#	tests/test_smart_ptr.cpp
#	tests/test_stl.cpp
#	tests/test_stl_binders.py
#	tests/test_tagbased_polymorphic.cpp
#	tests/test_thread.cpp
#	tests/test_thread.py
#	tests/test_virtual_functions.cpp
#	tests/test_virtual_functions.py
#	tools/libsize.py
#	tools/pybind11NewTools.cmake
#	tools/pybind11Tools.cmake
  • Loading branch information
EricCousineau-TRI committed Oct 12, 2023
2 parents 36695db + cc8f36e commit 53a0de4
Show file tree
Hide file tree
Showing 182 changed files with 12,947 additions and 8,632 deletions.
6 changes: 2 additions & 4 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 1.0.{build}
image:
- Visual Studio 2015
- Visual Studio 2017
test: off
skip_branch_with_pr: true
build:
Expand All @@ -11,11 +11,9 @@ environment:
matrix:
- PYTHON: 36
CONFIG: Debug
- PYTHON: 27
CONFIG: Debug
install:
- ps: |
$env:CMAKE_GENERATOR = "Visual Studio 14 2015"
$env:CMAKE_GENERATOR = "Visual Studio 15 2017"
if ($env:PLATFORM -eq "x64") { $env:PYTHON = "$env:PYTHON-x64" }
$env:PATH = "C:\Python$env:PYTHON\;C:\Python$env:PYTHON\Scripts\;$env:PATH"
python -W ignore -m pip install --upgrade pip wheel
Expand Down
19 changes: 19 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,36 @@
# clang-format --style=llvm --dump-config
BasedOnStyle: LLVM
AccessModifierOffset: -4
AllowShortLambdasOnASingleLine: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: All
BreakConstructorInitializers: BeforeColon
ColumnLimit: 99
CommentPragmas: 'NOLINT:.*|^ IWYU pragma:'
IncludeBlocks: Regroup
IndentCaseLabels: true
IndentPPDirectives: AfterHash
IndentWidth: 4
Language: Cpp
SpaceAfterCStyleCast: true
Standard: Cpp11
StatementMacros: ['PyObject_HEAD']
TabWidth: 4
IncludeCategories:
- Regex: '<pybind11/.*'
Priority: -1
- Regex: 'pybind11.h"$'
Priority: 1
- Regex: '^".*/?detail/'
Priority: 1
SortPriority: 2
- Regex: '^"'
Priority: 1
SortPriority: 3
- Regex: '<[[:alnum:]._]+>'
Priority: 4
- Regex: '.*'
Priority: 5
...
116 changes: 63 additions & 53 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,65 +1,75 @@
FormatStyle: file

Checks: '
*bugprone*,
cppcoreguidelines-init-variables,
cppcoreguidelines-slicing,
clang-analyzer-optin.cplusplus.VirtualCall,
google-explicit-constructor,
llvm-namespace-comment,
misc-misplaced-const,
misc-non-copyable-objects,
misc-static-assert,
misc-throw-by-value-catch-by-reference,
misc-uniqueptr-reset-release,
misc-unused-parameters,
modernize-avoid-bind,
modernize-make-shared,
modernize-redundant-void-arg,
modernize-replace-auto-ptr,
modernize-replace-disallow-copy-and-assign-macro,
modernize-replace-random-shuffle,
modernize-shrink-to-fit,
modernize-use-auto,
modernize-use-bool-literals,
modernize-use-equals-default,
modernize-use-equals-delete,
modernize-use-default-member-init,
modernize-use-noexcept,
modernize-use-emplace,
modernize-use-override,
modernize-use-using,
*performance*,
readability-avoid-const-params-in-decls,
readability-const-return-type,
readability-container-size-empty,
readability-delete-null-pointer,
readability-else-after-return,
readability-implicit-bool-conversion,
readability-make-member-function-const,
readability-misplaced-array-index,
readability-non-const-parameter,
readability-redundant-function-ptr-dereference,
readability-redundant-smartptr-get,
readability-redundant-string-cstr,
readability-simplify-subscript-expr,
readability-static-accessed-through-instance,
readability-static-definition-in-anonymous-namespace,
readability-string-compare,
readability-uniqueptr-delete-release,
-bugprone-exception-escape,
-bugprone-reserved-identifier,
-bugprone-unused-raii,
'
Checks: |
*bugprone*,
*performance*,
clang-analyzer-optin.cplusplus.VirtualCall,
clang-analyzer-optin.performance.Padding,
cppcoreguidelines-init-variables,
cppcoreguidelines-prefer-member-initializer,
cppcoreguidelines-pro-type-static-cast-downcast,
cppcoreguidelines-slicing,
google-explicit-constructor,
llvm-namespace-comment,
misc-definitions-in-headers,
misc-misplaced-const,
misc-non-copyable-objects,
misc-static-assert,
misc-throw-by-value-catch-by-reference,
misc-uniqueptr-reset-release,
misc-unused-parameters,
modernize-avoid-bind,
modernize-loop-convert,
modernize-make-shared,
modernize-redundant-void-arg,
modernize-replace-auto-ptr,
modernize-replace-disallow-copy-and-assign-macro,
modernize-replace-random-shuffle,
modernize-shrink-to-fit,
modernize-use-auto,
modernize-use-bool-literals,
modernize-use-default-member-init,
modernize-use-emplace,
modernize-use-equals-default,
modernize-use-equals-delete,
modernize-use-noexcept,
modernize-use-nullptr,
modernize-use-override,
modernize-use-using,
readability-avoid-const-params-in-decls,
readability-braces-around-statements,
readability-const-return-type,
readability-container-size-empty,
readability-delete-null-pointer,
readability-else-after-return,
readability-implicit-bool-conversion,
readability-inconsistent-declaration-parameter-name,
readability-make-member-function-const,
readability-misplaced-array-index,
readability-non-const-parameter,
readability-qualified-auto,
readability-redundant-function-ptr-dereference,
readability-redundant-smartptr-get,
readability-redundant-string-cstr,
readability-simplify-subscript-expr,
readability-static-accessed-through-instance,
readability-static-definition-in-anonymous-namespace,
readability-string-compare,
readability-suspicious-call-argument,
readability-uniqueptr-delete-release,
-bugprone-easily-swappable-parameters,
-bugprone-exception-escape,
-bugprone-reserved-identifier,
-bugprone-unused-raii,
CheckOptions:
- key: performance-for-range-copy.WarnOnAllAutoCopies
value: true
- key: performance-inefficient-string-concatenation.StrictMode
value: true
- key: performance-unnecessary-value-param.AllowedTypes
value: 'exception_ptr$;'
- key: readability-implicit-bool-conversion.AllowPointerConditions
value: true

HeaderFilterRegex: 'pybind11/.*h'

WarningsAsErrors: '*'
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docs/*.svg binary
26 changes: 14 additions & 12 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,18 @@ cmake --build build -j4

Tips:

* You can use `virtualenv` (from PyPI) instead of `venv` (which is Python 3
only).
* You can use `virtualenv` (faster, from PyPI) instead of `venv`.
* You can select any name for your environment folder; if it contains "env" it
will be ignored by git.
* If you dont have CMake 3.14+, just add cmake to the pip install command.
* If you don't have CMake 3.14+, just add "cmake" to the pip install command.
* You can use `-DPYBIND11_FINDPYTHON=ON` to use FindPython on CMake 3.12+
* In classic mode, you may need to set `-DPYTHON_EXECUTABLE=/path/to/python`.
FindPython uses `-DPython_ROOT_DIR=/path/to` or
`-DPython_EXECUTABLE=/path/to/python`.

### Configuration options

In CMake, configuration options are given with “-D”. Options are stored in the
In CMake, configuration options are given with "-D". Options are stored in the
build directory, in the `CMakeCache.txt` file, so they are remembered for each
build directory. Two selections are special - the generator, given with `-G`,
and the compiler, which is selected based on environment variables `CXX` and
Expand All @@ -115,12 +114,12 @@ after the initial run.
The valid options are:

* `-DCMAKE_BUILD_TYPE`: Release, Debug, MinSizeRel, RelWithDebInfo
* `-DPYBIND11_FINDPYTHON=ON`: Use CMake 3.12+s FindPython instead of the
* `-DPYBIND11_FINDPYTHON=ON`: Use CMake 3.12+'s FindPython instead of the
classic, deprecated, custom FindPythonLibs
* `-DPYBIND11_NOPYTHON=ON`: Disable all Python searching (disables tests)
* `-DBUILD_TESTING=ON`: Enable the tests
* `-DDOWNLOAD_CATCH=ON`: Download catch to build the C++ tests
* `-DOWNLOAD_EIGEN=ON`: Download Eigen for the NumPy tests
* `-DDOWNLOAD_EIGEN=ON`: Download Eigen for the NumPy tests
* `-DPYBIND11_INSTALL=ON/OFF`: Enable the install target (on by default for the
master project)
* `-DUSE_PYTHON_INSTALL_DIR=ON`: Try to install into the python dir
Expand Down Expand Up @@ -159,8 +158,9 @@ tests with these targets:
* `test_cmake_build`: Install / subdirectory tests

If you want to build just a subset of tests, use
`-DPYBIND11_TEST_OVERRIDE="test_callbacks.cpp;test_pickling.cpp"`. If this is
empty, all tests will be built.
`-DPYBIND11_TEST_OVERRIDE="test_callbacks;test_pickling"`. If this is
empty, all tests will be built. Tests are specified without an extension if they need both a .py and
.cpp file.

You may also pass flags to the `pytest` target by editing `tests/pytest.ini` or
by using the `PYTEST_ADDOPTS` environment variable
Expand Down Expand Up @@ -235,12 +235,14 @@ directory inside your pybind11 git clone. Files will be modified in place,
so you can use git to monitor the changes.

```bash
docker run --rm -v $PWD:/mounted_pybind11 -it silkeh/clang:12
docker run --rm -v $PWD:/mounted_pybind11 -it silkeh/clang:13
apt-get update && apt-get install -y python3-dev python3-pytest
cmake -S /mounted_pybind11/ -B build -DCMAKE_CXX_CLANG_TIDY="$(which clang-tidy);-fix" -DDOWNLOAD_EIGEN=ON -DDOWNLOAD_CATCH=ON -DCMAKE_CXX_STANDARD=17
cmake --build build -j 2 -- --keep-going
cmake -S /mounted_pybind11/ -B build -DCMAKE_CXX_CLANG_TIDY="$(which clang-tidy);--use-color" -DDOWNLOAD_EIGEN=ON -DDOWNLOAD_CATCH=ON -DCMAKE_CXX_STANDARD=17
cmake --build build -j 2
```

You can add `--fix` to the options list if you want.

### Include what you use

To run include what you use, install (`brew install include-what-you-use` on
Expand All @@ -256,7 +258,7 @@ The report is sent to stderr; you can pipe it into a file if you wish.
### Build recipes

This builds with the Intel compiler (assuming it is in your path, along with a
recent CMake and Python 3):
recent CMake and Python):

```bash
python3 -m venv venv
Expand Down
32 changes: 32 additions & 0 deletions .github/matchers/pylint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"problemMatcher": [
{
"severity": "warning",
"pattern": [
{
"regexp": "^([^:]+):(\\d+):(\\d+): ([A-DF-Z]\\d+): \\033\\[[\\d;]+m([^\\033]+).*$",
"file": 1,
"line": 2,
"column": 3,
"code": 4,
"message": 5
}
],
"owner": "pylint-warning"
},
{
"severity": "error",
"pattern": [
{
"regexp": "^([^:]+):(\\d+):(\\d+): (E\\d+): \\033\\[[\\d;]+m([^\\033]+).*$",
"file": 1,
"line": 2,
"column": 3,
"code": 4,
"message": 5
}
],
"owner": "pylint-error"
}
]
}
Loading

0 comments on commit 53a0de4

Please sign in to comment.