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

[smart_holder] Curated git merge master after clang-format etc #3736

Merged
merged 24 commits into from
Feb 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
94a9487
docs: fix imported target name (#3689)
skoslowski Feb 6, 2022
96b943b
tests: update catch to 2.13.5 to fix glibc 2.34 failures (#3679)
mgorny Feb 6, 2022
1b84188
Minor change to improve readability (#3695)
Skylion007 Feb 7, 2022
af056b6
fix: __index__ on Enum should always be present. (#3700)
henryiii Feb 8, 2022
8581584
Manual fix-ups in preparation for clang-tidy readability-braces-aroun…
Feb 8, 2022
ddbc74c
Adding .clang-tidy readability-braces-around-statements option.
Feb 8, 2022
b4f5350
chore: use member initializer (#3704)
Feb 9, 2022
7769e77
clang-tidy readability-qualified-auto (#3702)
Feb 9, 2022
abc3869
Manually applying two clang-format changes that need fix-ups for clan…
Feb 9, 2022
7f97581
chore(clang-tidy): Enable static downcast and decl naming check (#3709)
Skylion007 Feb 9, 2022
dc9803c
Add missing clang-tidy fixes (#3715)
Skylion007 Feb 10, 2022
d6c66d2
chore(clang-tidy): Add clang-tidy rules: prefer-member-initializer an…
Skylion007 Feb 10, 2022
e96221b
Final manual curation in preparation for global `clang-format`ing (#3…
Feb 10, 2022
ec24786
Fully-automatic clang-format with include reordering (#3713)
Feb 10, 2022
46dcd9b
fix: minor CMake warning fix for unused variable (#3718)
henryiii Feb 10, 2022
6493f49
Python 2 removal part 1: tests (C++ code is intentionally ~untouched)…
Feb 11, 2022
1a432b4
docs: Correct minor typos (#3721)
utilForever Feb 11, 2022
522c59c
chore: drop Python 3.5 (#3719)
henryiii Feb 12, 2022
4415647
Adding MSVC 2022 C++20 GitHub Action (#3732)
Feb 14, 2022
a97e9d8
Dropping MSVC 2015 (#3722)
Feb 14, 2022
e1751c0
Merge branch 'master' into sh_merge_master_after_clang-format_etc
Feb 14, 2022
5820767
Tracking ci.yml changes from master.
Feb 15, 2022
d5e302c
Removing uses of env.PY2 and env.PY (no longer available).
Feb 14, 2022
05c8b9b
Automatic `pre-commit run --all-files` and clang-tidy changes (NO man…
Feb 15, 2022
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
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
...
8 changes: 7 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ FormatStyle: file

Checks: '
*bugprone*,
clang-analyzer-optin.performance.Padding,
clang-analyzer-optin.cplusplus.VirtualCall,
cppcoreguidelines-init-variables,
cppcoreguidelines-prefer-member-initializer,
cppcoreguidelines-pro-type-static-cast-downcast,
cppcoreguidelines-slicing,
clang-analyzer-optin.cplusplus.VirtualCall,
google-explicit-constructor,
llvm-namespace-comment,
misc-misplaced-const,
Expand All @@ -31,14 +34,17 @@ modernize-use-override,
modernize-use-using,
*performance*,
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,
Expand Down
11 changes: 5 additions & 6 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,7 +114,7 @@ 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
Expand Down Expand Up @@ -257,7 +256,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
122 changes: 46 additions & 76 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ concurrency:

env:
PIP_ONLY_BINARY: numpy
FORCE_COLOR: 3
PYTEST_TIMEOUT: 300

jobs:
# This is the "main" test suite, which tests a large number of different
Expand All @@ -26,8 +28,6 @@ jobs:
matrix:
runs-on: [ubuntu-latest, windows-2022, macos-latest]
python:
- '2.7'
- '3.5'
- '3.6'
- '3.9'
- '3.10'
Expand All @@ -45,18 +45,14 @@ jobs:
python: '3.6'
args: >
-DPYBIND11_FINDPYTHON=ON
-DCMAKE_CXX_FLAGS="-D_=1"
# BREAKS -DCMAKE_CXX_FLAGS="-D_=1"
- runs-on: windows-latest
python: '3.6'
args: >
-DPYBIND11_FINDPYTHON=ON
- runs-on: macos-latest
python: 'pypy-2.7'
# Inject a couple Windows 2019 runs
- runs-on: windows-2019
python: '3.9'
- runs-on: windows-2019
python: '2.7'

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

# Eventually Microsoft might have an action for setting up
# MSVC, but for now, this action works:
- name: Prepare compiler environment for Windows 🐍 2.7
if: matrix.python == 2.7 && runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1.10.0
with:
arch: x64

# This makes two environment variables available in the following step(s)
- name: Set Windows 🐍 2.7 environment variables
if: matrix.python == 2.7 && runner.os == 'Windows'
shell: bash
run: |
echo "DISTUTILS_USE_SDK=1" >> $GITHUB_ENV
echo "MSSdk=1" >> $GITHUB_ENV

# This makes sure the setup_helpers module can build packages using
# setuptools
- name: Setuptools helpers test
run: pytest tests/extra_setuptools
if: "!(matrix.python == '3.5' && matrix.runs-on == 'windows-2022')"
if: "!(matrix.runs-on == 'windows-2022')"


deadsnakes:
Expand Down Expand Up @@ -646,9 +626,9 @@ jobs:

# This tests an "install" with the CMake tools
install-classic:
name: "🐍 3.5 • Debian • x86 • Install"
name: "🐍 3.7 • Debian • x86 • Install"
runs-on: ubuntu-latest
container: i386/debian:stretch
container: i386/debian:buster

steps:
- uses: actions/checkout@v1
Expand All @@ -657,7 +637,7 @@ jobs:
run: |
apt-get update
apt-get install -y git make cmake g++ libeigen3-dev python3-dev python3-pip
pip3 install "pytest==3.1.*"
pip3 install "pytest==6.*"

- name: Configure for install
run: >
Expand Down Expand Up @@ -726,12 +706,10 @@ jobs:
fail-fast: false
matrix:
python:
- 3.5
- 3.6
- 3.7
- 3.8
- 3.9
- pypy-3.6

include:
- python: 3.9
Expand Down Expand Up @@ -778,17 +756,23 @@ jobs:
- name: Python tests
run: cmake --build build -t pytest

win32-msvc2015:
name: "🐍 ${{ matrix.python }} • MSVC 2015 • x64"
runs-on: windows-latest
win32-msvc2017:
name: "🐍 ${{ matrix.python }} • MSVC 2017 • x64"
runs-on: windows-2016
strategy:
fail-fast: false
matrix:
python:
- 2.7
- 3.6
- 3.7
# todo: check/cpptest does not support 3.8+ yet
std:
- 14

include:
- python: 3.7
std: 17
args: >
-DCMAKE_CXX_FLAGS="/permissive- /EHsc /GR"

steps:
- uses: actions/checkout@v2
Expand All @@ -801,11 +785,6 @@ jobs:
- name: Update CMake
uses: jwlawson/actions-setup-cmake@v1.12

- name: Prepare MSVC
uses: ilammy/msvc-dev-cmd@v1.10.0
with:
toolset: 14.0

- name: Prepare env
run: |
python -m pip install -r tests/requirements.txt
Expand All @@ -814,72 +793,63 @@ jobs:
- name: Configure
run: >
cmake -S . -B build
-G "Visual Studio 14 2015" -A x64
-G "Visual Studio 15 2017" -A x64
-DPYBIND11_WERROR=ON
-DDOWNLOAD_CATCH=ON
-DDOWNLOAD_EIGEN=ON
-DCMAKE_CXX_STANDARD=${{ matrix.std }}
${{ matrix.args }}

- name: Build C++14
- name: Build ${{ matrix.std }}
run: cmake --build build -j 2

- name: Run all checks
run: cmake --build build -t check


win32-msvc2017:
name: "🐍 ${{ matrix.python }} • MSVC 2017 • x64"
runs-on: windows-2016
windows-2022:
strategy:
fail-fast: false
matrix:
python:
- 2.7
- 3.5
- 3.7
std:
- 14
- 3.9

include:
- python: 2.7
std: 17
args: >
-DCMAKE_CXX_FLAGS="/permissive- /EHsc /GR"
- python: 3.7
std: 17
args: >
-DCMAKE_CXX_FLAGS="/permissive- /EHsc /GR"
name: "🐍 ${{ matrix.python }} • MSVC 2022 C++20 • x64"
runs-on: windows-2022

steps:
- uses: actions/checkout@v2

- name: Setup 🐍 ${{ matrix.python }}
- name: Setup Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}

- name: Update CMake
uses: jwlawson/actions-setup-cmake@v1.12

- name: Prepare env
run: |
python -m pip install -r tests/requirements.txt
python3 -m pip install -r tests/requirements.txt

# First build - C++11 mode and inplace
- name: Configure
- name: Update CMake
uses: jwlawson/actions-setup-cmake@v1.12

- name: Configure C++20
run: >
cmake -S . -B build
-G "Visual Studio 15 2017" -A x64
-DPYBIND11_WERROR=ON
-DDOWNLOAD_CATCH=ON
-DDOWNLOAD_EIGEN=ON
-DCMAKE_CXX_STANDARD=${{ matrix.std }}
${{ matrix.args }}
-DDOWNLOAD_EIGEN=OFF
-DCMAKE_CXX_STANDARD=20

- name: Build ${{ matrix.std }}
- name: Build C++20
run: cmake --build build -j 2

- name: Run all checks
run: cmake --build build -t check
- name: Python tests
run: cmake --build build --target pytest

- name: C++20 tests
run: cmake --build build --target cpptest -j 2

- name: Interface test C++20
run: cmake --build build --target test_cmake_build

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

- name: Build C++11
run: cmake --build build -j 2
Expand All @@ -933,7 +903,7 @@ jobs:
run: git clean -fdx

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

- name: Build C++14
run: cmake --build build2 -j 2
Expand All @@ -951,7 +921,7 @@ jobs:
run: git clean -fdx

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

- name: Build C++17
run: cmake --build build3 -j 2
Expand Down
Loading