Skip to content

Commit e1751c0

Browse files
committed
Merge branch 'master' into sh_merge_master_after_clang-format_etc
First pass manually resolving the many merge conflicts.
2 parents 1ee0f29 + a97e9d8 commit e1751c0

File tree

175 files changed

+9323
-7565
lines changed

Some content is hidden

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

175 files changed

+9323
-7565
lines changed

.appveyor.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version: 1.0.{build}
22
image:
3-
- Visual Studio 2015
3+
- Visual Studio 2017
44
test: off
55
skip_branch_with_pr: true
66
build:
@@ -11,11 +11,9 @@ environment:
1111
matrix:
1212
- PYTHON: 36
1313
CONFIG: Debug
14-
- PYTHON: 27
15-
CONFIG: Debug
1614
install:
1715
- ps: |
18-
$env:CMAKE_GENERATOR = "Visual Studio 14 2015"
16+
$env:CMAKE_GENERATOR = "Visual Studio 15 2017"
1917
if ($env:PLATFORM -eq "x64") { $env:PYTHON = "$env:PYTHON-x64" }
2018
$env:PATH = "C:\Python$env:PYTHON\;C:\Python$env:PYTHON\Scripts\;$env:PATH"
2119
python -W ignore -m pip install --upgrade pip wheel

.clang-format

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,36 @@
33
# clang-format --style=llvm --dump-config
44
BasedOnStyle: LLVM
55
AccessModifierOffset: -4
6+
AllowShortLambdasOnASingleLine: true
67
AlwaysBreakTemplateDeclarations: Yes
78
BinPackArguments: false
89
BinPackParameters: false
910
BreakBeforeBinaryOperators: All
1011
BreakConstructorInitializers: BeforeColon
1112
ColumnLimit: 99
13+
CommentPragmas: 'NOLINT:.*|^ IWYU pragma:'
14+
IncludeBlocks: Regroup
1215
IndentCaseLabels: true
1316
IndentPPDirectives: AfterHash
1417
IndentWidth: 4
1518
Language: Cpp
1619
SpaceAfterCStyleCast: true
1720
Standard: Cpp11
21+
StatementMacros: ['PyObject_HEAD']
1822
TabWidth: 4
23+
IncludeCategories:
24+
- Regex: '<pybind11/.*'
25+
Priority: -1
26+
- Regex: 'pybind11.h"$'
27+
Priority: 1
28+
- Regex: '^".*/?detail/'
29+
Priority: 1
30+
SortPriority: 2
31+
- Regex: '^"'
32+
Priority: 1
33+
SortPriority: 3
34+
- Regex: '<[[:alnum:]._]+>'
35+
Priority: 4
36+
- Regex: '.*'
37+
Priority: 5
1938
...

.clang-tidy

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ FormatStyle: file
22

33
Checks: '
44
*bugprone*,
5+
clang-analyzer-optin.performance.Padding,
6+
clang-analyzer-optin.cplusplus.VirtualCall,
57
cppcoreguidelines-init-variables,
8+
cppcoreguidelines-prefer-member-initializer,
9+
cppcoreguidelines-pro-type-static-cast-downcast,
610
cppcoreguidelines-slicing,
7-
clang-analyzer-optin.cplusplus.VirtualCall,
811
google-explicit-constructor,
912
llvm-namespace-comment,
1013
misc-misplaced-const,
@@ -31,14 +34,17 @@ modernize-use-override,
3134
modernize-use-using,
3235
*performance*,
3336
readability-avoid-const-params-in-decls,
37+
readability-braces-around-statements,
3438
readability-const-return-type,
3539
readability-container-size-empty,
3640
readability-delete-null-pointer,
3741
readability-else-after-return,
3842
readability-implicit-bool-conversion,
43+
readability-inconsistent-declaration-parameter-name,
3944
readability-make-member-function-const,
4045
readability-misplaced-array-index,
4146
readability-non-const-parameter,
47+
readability-qualified-auto,
4248
readability-redundant-function-ptr-dereference,
4349
readability-redundant-smartptr-get,
4450
readability-redundant-string-cstr,

.github/CONTRIBUTING.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,18 @@ cmake --build build -j4
9393

9494
Tips:
9595

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

106105
### Configuration options
107106

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

117116
* `-DCMAKE_BUILD_TYPE`: Release, Debug, MinSizeRel, RelWithDebInfo
118-
* `-DPYBIND11_FINDPYTHON=ON`: Use CMake 3.12+s FindPython instead of the
117+
* `-DPYBIND11_FINDPYTHON=ON`: Use CMake 3.12+'s FindPython instead of the
119118
classic, deprecated, custom FindPythonLibs
120119
* `-DPYBIND11_NOPYTHON=ON`: Disable all Python searching (disables tests)
121120
* `-DBUILD_TESTING=ON`: Enable the tests
@@ -257,7 +256,7 @@ The report is sent to stderr; you can pipe it into a file if you wish.
257256
### Build recipes
258257

259258
This builds with the Intel compiler (assuming it is in your path, along with a
260-
recent CMake and Python 3):
259+
recent CMake and Python):
261260

262261
```bash
263262
python3 -m venv venv

.github/workflows/ci.yml

Lines changed: 45 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ concurrency:
1616

1717
env:
1818
PIP_ONLY_BINARY: numpy
19+
FORCE_COLOR: 3
20+
PYTEST_TIMEOUT: 300
1921

2022
jobs:
2123
# This is the "main" test suite, which tests a large number of different
@@ -26,8 +28,6 @@ jobs:
2628
matrix:
2729
runs-on: [ubuntu-latest, windows-2022, macos-latest]
2830
python:
29-
- '2.7'
30-
- '3.5'
3131
- '3.6'
3232
- '3.9'
3333
- '3.10'
@@ -50,13 +50,9 @@ jobs:
5050
python: '3.6'
5151
args: >
5252
-DPYBIND11_FINDPYTHON=ON
53-
- runs-on: macos-latest
54-
python: 'pypy-2.7'
5553
# Inject a couple Windows 2019 runs
5654
- runs-on: windows-2019
5755
python: '3.9'
58-
- runs-on: windows-2019
59-
python: '2.7'
6056

6157
name: "🐍 ${{ matrix.python }} • ${{ matrix.runs-on }} • x64 ${{ matrix.args }}"
6258
runs-on: ${{ matrix.runs-on }}
@@ -169,27 +165,11 @@ jobs:
169165
- name: Interface test
170166
run: cmake --build build2 --target test_cmake_build
171167

172-
# Eventually Microsoft might have an action for setting up
173-
# MSVC, but for now, this action works:
174-
- name: Prepare compiler environment for Windows 🐍 2.7
175-
if: matrix.python == 2.7 && runner.os == 'Windows'
176-
uses: ilammy/[email protected]
177-
with:
178-
arch: x64
179-
180-
# This makes two environment variables available in the following step(s)
181-
- name: Set Windows 🐍 2.7 environment variables
182-
if: matrix.python == 2.7 && runner.os == 'Windows'
183-
shell: bash
184-
run: |
185-
echo "DISTUTILS_USE_SDK=1" >> $GITHUB_ENV
186-
echo "MSSdk=1" >> $GITHUB_ENV
187-
188168
# This makes sure the setup_helpers module can build packages using
189169
# setuptools
190170
- name: Setuptools helpers test
191171
run: pytest tests/extra_setuptools
192-
if: "!(matrix.python == '3.5' && matrix.runs-on == 'windows-2022')"
172+
if: "!(matrix.runs-on == 'windows-2022')"
193173

194174

195175
deadsnakes:
@@ -646,9 +626,9 @@ jobs:
646626

647627
# This tests an "install" with the CMake tools
648628
install-classic:
649-
name: "🐍 3.5 • Debian • x86 • Install"
629+
name: "🐍 3.7 • Debian • x86 • Install"
650630
runs-on: ubuntu-latest
651-
container: i386/debian:stretch
631+
container: i386/debian:buster
652632

653633
steps:
654634
- uses: actions/checkout@v1
@@ -657,7 +637,7 @@ jobs:
657637
run: |
658638
apt-get update
659639
apt-get install -y git make cmake g++ libeigen3-dev python3-dev python3-pip
660-
pip3 install "pytest==3.1.*"
640+
pip3 install "pytest==6.*"
661641
662642
- name: Configure for install
663643
run: >
@@ -726,12 +706,10 @@ jobs:
726706
fail-fast: false
727707
matrix:
728708
python:
729-
- 3.5
730709
- 3.6
731710
- 3.7
732711
- 3.8
733712
- 3.9
734-
- pypy-3.6
735713

736714
include:
737715
- python: 3.9
@@ -778,17 +756,23 @@ jobs:
778756
- name: Python tests
779757
run: cmake --build build -t pytest
780758

781-
win32-msvc2015:
782-
name: "🐍 ${{ matrix.python }} • MSVC 2015 • x64"
783-
runs-on: windows-latest
759+
win32-msvc2017:
760+
name: "🐍 ${{ matrix.python }} • MSVC 2017 • x64"
761+
runs-on: windows-2016
784762
strategy:
785763
fail-fast: false
786764
matrix:
787765
python:
788-
- 2.7
789766
- 3.6
790767
- 3.7
791-
# todo: check/cpptest does not support 3.8+ yet
768+
std:
769+
- 14
770+
771+
include:
772+
- python: 3.7
773+
std: 17
774+
args: >
775+
-DCMAKE_CXX_FLAGS="/permissive- /EHsc /GR"
792776
793777
steps:
794778
- uses: actions/checkout@v2
@@ -801,11 +785,6 @@ jobs:
801785
- name: Update CMake
802786
uses: jwlawson/[email protected]
803787

804-
- name: Prepare MSVC
805-
uses: ilammy/[email protected]
806-
with:
807-
toolset: 14.0
808-
809788
- name: Prepare env
810789
run: |
811790
python -m pip install -r tests/requirements.txt
@@ -814,72 +793,63 @@ jobs:
814793
- name: Configure
815794
run: >
816795
cmake -S . -B build
817-
-G "Visual Studio 14 2015" -A x64
796+
-G "Visual Studio 15 2017" -A x64
818797
-DPYBIND11_WERROR=ON
819798
-DDOWNLOAD_CATCH=ON
820799
-DDOWNLOAD_EIGEN=ON
800+
-DCMAKE_CXX_STANDARD=${{ matrix.std }}
801+
${{ matrix.args }}
821802
822-
- name: Build C++14
803+
- name: Build ${{ matrix.std }}
823804
run: cmake --build build -j 2
824805

825806
- name: Run all checks
826807
run: cmake --build build -t check
827808

828-
829-
win32-msvc2017:
830-
name: "🐍 ${{ matrix.python }} • MSVC 2017 • x64"
831-
runs-on: windows-2016
809+
windows-2022:
832810
strategy:
833811
fail-fast: false
834812
matrix:
835813
python:
836-
- 2.7
837-
- 3.5
838-
- 3.7
839-
std:
840-
- 14
814+
- 3.9
841815

842-
include:
843-
- python: 2.7
844-
std: 17
845-
args: >
846-
-DCMAKE_CXX_FLAGS="/permissive- /EHsc /GR"
847-
- python: 3.7
848-
std: 17
849-
args: >
850-
-DCMAKE_CXX_FLAGS="/permissive- /EHsc /GR"
816+
name: "🐍 ${{ matrix.python }} • MSVC 2022 C++20 • x64"
817+
runs-on: windows-2022
851818

852819
steps:
853820
- uses: actions/checkout@v2
854821

855-
- name: Setup 🐍 ${{ matrix.python }}
822+
- name: Setup Python ${{ matrix.python }}
856823
uses: actions/setup-python@v2
857824
with:
858825
python-version: ${{ matrix.python }}
859826

860-
- name: Update CMake
861-
uses: jwlawson/[email protected]
862-
863827
- name: Prepare env
864828
run: |
865-
python -m pip install -r tests/requirements.txt
829+
python3 -m pip install -r tests/requirements.txt
866830
867-
# First build - C++11 mode and inplace
868-
- name: Configure
831+
- name: Update CMake
832+
uses: jwlawson/[email protected]
833+
834+
- name: Configure C++20
869835
run: >
870836
cmake -S . -B build
871-
-G "Visual Studio 15 2017" -A x64
872837
-DPYBIND11_WERROR=ON
873838
-DDOWNLOAD_CATCH=ON
874-
-DDOWNLOAD_EIGEN=ON
875-
-DCMAKE_CXX_STANDARD=${{ matrix.std }}
876-
${{ matrix.args }}
839+
-DDOWNLOAD_EIGEN=OFF
840+
-DCMAKE_CXX_STANDARD=20
877841
878-
- name: Build ${{ matrix.std }}
842+
- name: Build C++20
879843
run: cmake --build build -j 2
880844

881-
- name: Run all checks
882-
run: cmake --build build -t check
845+
- name: Python tests
846+
run: cmake --build build --target pytest
847+
848+
- name: C++20 tests
849+
run: cmake --build build --target cpptest -j 2
850+
851+
- name: Interface test C++20
852+
run: cmake --build build --target test_cmake_build
883853

884854
mingw:
885855
name: "🐍 3 • windows-latest • ${{ matrix.sys }}"
@@ -915,7 +885,7 @@ jobs:
915885
- name: Configure C++11
916886
# LTO leads to many undefined reference like
917887
# `pybind11::detail::function_call::function_call(pybind11::detail::function_call&&)
918-
run: cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=11 -S . -B build
888+
run: cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=11 -DDOWNLOAD_CATCH=ON -S . -B build
919889

920890
- name: Build C++11
921891
run: cmake --build build -j 2
@@ -933,7 +903,7 @@ jobs:
933903
run: git clean -fdx
934904

935905
- name: Configure C++14
936-
run: cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=14 -S . -B build2
906+
run: cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=14 -DDOWNLOAD_CATCH=ON -S . -B build2
937907

938908
- name: Build C++14
939909
run: cmake --build build2 -j 2
@@ -951,7 +921,7 @@ jobs:
951921
run: git clean -fdx
952922

953923
- name: Configure C++17
954-
run: cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=17 -S . -B build3
924+
run: cmake -G "MinGW Makefiles" -DCMAKE_CXX_STANDARD=17 -DDOWNLOAD_CATCH=ON -S . -B build3
955925

956926
- name: Build C++17
957927
run: cmake --build build3 -j 2

0 commit comments

Comments
 (0)