mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-23 13:45:10 +00:00
Merge branch 'pybind:master' into master
This commit is contained in:
commit
0056a3e156
12
.clang-tidy
12
.clang-tidy
@ -1,9 +1,10 @@
|
|||||||
FormatStyle: file
|
FormatStyle: file
|
||||||
|
|
||||||
Checks: '
|
Checks: |
|
||||||
*bugprone*,
|
*bugprone*,
|
||||||
clang-analyzer-optin.performance.Padding,
|
*performance*,
|
||||||
clang-analyzer-optin.cplusplus.VirtualCall,
|
clang-analyzer-optin.cplusplus.VirtualCall,
|
||||||
|
clang-analyzer-optin.performance.Padding,
|
||||||
cppcoreguidelines-init-variables,
|
cppcoreguidelines-init-variables,
|
||||||
cppcoreguidelines-prefer-member-initializer,
|
cppcoreguidelines-prefer-member-initializer,
|
||||||
cppcoreguidelines-pro-type-static-cast-downcast,
|
cppcoreguidelines-pro-type-static-cast-downcast,
|
||||||
@ -28,14 +29,13 @@ modernize-shrink-to-fit,
|
|||||||
modernize-use-auto,
|
modernize-use-auto,
|
||||||
modernize-use-bool-literals,
|
modernize-use-bool-literals,
|
||||||
modernize-use-default-member-init,
|
modernize-use-default-member-init,
|
||||||
|
modernize-use-emplace,
|
||||||
modernize-use-equals-default,
|
modernize-use-equals-default,
|
||||||
modernize-use-equals-delete,
|
modernize-use-equals-delete,
|
||||||
modernize-use-emplace,
|
|
||||||
modernize-use-noexcept,
|
modernize-use-noexcept,
|
||||||
modernize-use-nullptr,
|
modernize-use-nullptr,
|
||||||
modernize-use-override,
|
modernize-use-override,
|
||||||
modernize-use-using,
|
modernize-use-using,
|
||||||
*performance*,
|
|
||||||
readability-avoid-const-params-in-decls,
|
readability-avoid-const-params-in-decls,
|
||||||
readability-braces-around-statements,
|
readability-braces-around-statements,
|
||||||
readability-const-return-type,
|
readability-const-return-type,
|
||||||
@ -57,10 +57,10 @@ readability-static-definition-in-anonymous-namespace,
|
|||||||
readability-string-compare,
|
readability-string-compare,
|
||||||
readability-suspicious-call-argument,
|
readability-suspicious-call-argument,
|
||||||
readability-uniqueptr-delete-release,
|
readability-uniqueptr-delete-release,
|
||||||
|
-bugprone-easily-swappable-parameters,
|
||||||
-bugprone-exception-escape,
|
-bugprone-exception-escape,
|
||||||
-bugprone-reserved-identifier,
|
-bugprone-reserved-identifier,
|
||||||
-bugprone-unused-raii,
|
-bugprone-unused-raii,
|
||||||
'
|
|
||||||
|
|
||||||
CheckOptions:
|
CheckOptions:
|
||||||
- key: performance-for-range-copy.WarnOnAllAutoCopies
|
- key: performance-for-range-copy.WarnOnAllAutoCopies
|
||||||
@ -73,5 +73,3 @@ CheckOptions:
|
|||||||
value: true
|
value: true
|
||||||
|
|
||||||
HeaderFilterRegex: 'pybind11/.*h'
|
HeaderFilterRegex: 'pybind11/.*h'
|
||||||
|
|
||||||
WarningsAsErrors: '*'
|
|
||||||
|
8
.github/CONTRIBUTING.md
vendored
8
.github/CONTRIBUTING.md
vendored
@ -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.
|
so you can use git to monitor the changes.
|
||||||
|
|
||||||
```bash
|
```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
|
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 -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 -- --keep-going
|
cmake --build build -j 2
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can add `--fix` to the options list if you want.
|
||||||
|
|
||||||
### Include what you use
|
### Include what you use
|
||||||
|
|
||||||
To run include what you use, install (`brew install include-what-you-use` on
|
To run include what you use, install (`brew install include-what-you-use` on
|
||||||
|
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -281,6 +281,8 @@ jobs:
|
|||||||
std: 20
|
std: 20
|
||||||
- clang: 10
|
- clang: 10
|
||||||
std: 17
|
std: 17
|
||||||
|
- clang: 14
|
||||||
|
std: 20
|
||||||
|
|
||||||
name: "🐍 3 • Clang ${{ matrix.clang }} • C++${{ matrix.std }} • x64"
|
name: "🐍 3 • Clang ${{ matrix.clang }} • C++${{ matrix.std }} • x64"
|
||||||
container: "silkeh/clang:${{ matrix.clang }}"
|
container: "silkeh/clang:${{ matrix.clang }}"
|
||||||
|
4
.github/workflows/format.yml
vendored
4
.github/workflows/format.yml
vendored
@ -36,7 +36,7 @@ jobs:
|
|||||||
# in .github/CONTRIBUTING.md and update as needed.
|
# in .github/CONTRIBUTING.md and update as needed.
|
||||||
name: Clang-Tidy
|
name: Clang-Tidy
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: silkeh/clang:12
|
container: silkeh/clang:13
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ jobs:
|
|||||||
- name: Configure
|
- name: Configure
|
||||||
run: >
|
run: >
|
||||||
cmake -S . -B build
|
cmake -S . -B build
|
||||||
-DCMAKE_CXX_CLANG_TIDY="$(which clang-tidy)"
|
-DCMAKE_CXX_CLANG_TIDY="$(which clang-tidy);--use-color;--warnings-as-errors=*"
|
||||||
-DDOWNLOAD_EIGEN=ON
|
-DDOWNLOAD_EIGEN=ON
|
||||||
-DDOWNLOAD_CATCH=ON
|
-DDOWNLOAD_CATCH=ON
|
||||||
-DCMAKE_CXX_STANDARD=17
|
-DCMAKE_CXX_STANDARD=17
|
||||||
|
3
docs/_static/css/custom.css
vendored
Normal file
3
docs/_static/css/custom.css
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
.highlight .go {
|
||||||
|
color: #707070;
|
||||||
|
}
|
11
docs/_static/theme_overrides.css
vendored
11
docs/_static/theme_overrides.css
vendored
@ -1,11 +0,0 @@
|
|||||||
.wy-table-responsive table td,
|
|
||||||
.wy-table-responsive table th {
|
|
||||||
white-space: initial !important;
|
|
||||||
}
|
|
||||||
.rst-content table.docutils td {
|
|
||||||
vertical-align: top !important;
|
|
||||||
}
|
|
||||||
div[class^='highlight'] pre {
|
|
||||||
white-space: pre;
|
|
||||||
white-space: pre-wrap;
|
|
||||||
}
|
|
23
docs/conf.py
23
docs/conf.py
@ -35,6 +35,7 @@ DIR = Path(__file__).parent.resolve()
|
|||||||
# ones.
|
# ones.
|
||||||
extensions = [
|
extensions = [
|
||||||
"breathe",
|
"breathe",
|
||||||
|
"sphinx_copybutton",
|
||||||
"sphinxcontrib.rsvgconverter",
|
"sphinxcontrib.rsvgconverter",
|
||||||
"sphinxcontrib.moderncmakedomain",
|
"sphinxcontrib.moderncmakedomain",
|
||||||
]
|
]
|
||||||
@ -125,23 +126,7 @@ todo_include_todos = False
|
|||||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||||
# a list of builtin themes.
|
# a list of builtin themes.
|
||||||
|
|
||||||
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
|
html_theme = "furo"
|
||||||
|
|
||||||
if not on_rtd: # only import and set the theme if we're building docs locally
|
|
||||||
import sphinx_rtd_theme
|
|
||||||
|
|
||||||
html_theme = "sphinx_rtd_theme"
|
|
||||||
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
|
||||||
|
|
||||||
html_context = {"css_files": ["_static/theme_overrides.css"]}
|
|
||||||
else:
|
|
||||||
html_context = {
|
|
||||||
"css_files": [
|
|
||||||
"//media.readthedocs.org/css/sphinx_rtd_theme.css",
|
|
||||||
"//media.readthedocs.org/css/readthedocs-doc-embed.css",
|
|
||||||
"_static/theme_overrides.css",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
# Theme options are theme-specific and customize the look and feel of a theme
|
# Theme options are theme-specific and customize the look and feel of a theme
|
||||||
# further. For a list of options available for each theme, see the
|
# further. For a list of options available for each theme, see the
|
||||||
@ -172,6 +157,10 @@ else:
|
|||||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||||
html_static_path = ["_static"]
|
html_static_path = ["_static"]
|
||||||
|
|
||||||
|
html_css_files = [
|
||||||
|
"css/custom.css",
|
||||||
|
]
|
||||||
|
|
||||||
# Add any extra paths that contain custom files (such as robots.txt or
|
# Add any extra paths that contain custom files (such as robots.txt or
|
||||||
# .htaccess) here, relative to this directory. These files are copied
|
# .htaccess) here, relative to this directory. These files are copied
|
||||||
# directly to the root of the documentation.
|
# directly to the root of the documentation.
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 60 KiB |
@ -1,5 +1,6 @@
|
|||||||
breathe==4.32.0
|
breathe==4.34.0
|
||||||
sphinx==4.4.0
|
furo==2022.6.21
|
||||||
sphinx_rtd_theme==1.0.0
|
sphinx==5.0.2
|
||||||
|
sphinx-copybutton==0.5.0
|
||||||
sphinxcontrib-moderncmakedomain==3.21.4
|
sphinxcontrib-moderncmakedomain==3.21.4
|
||||||
sphinxcontrib-svg2pdfconverter==1.2.0
|
sphinxcontrib-svg2pdfconverter==1.2.0
|
||||||
|
@ -692,9 +692,9 @@ struct type_caster<Type, enable_if_t<is_eigen_sparse<Type>::value>> {
|
|||||||
array outerIndices((rowMajor ? src.rows() : src.cols()) + 1, src.outerIndexPtr());
|
array outerIndices((rowMajor ? src.rows() : src.cols()) + 1, src.outerIndexPtr());
|
||||||
array innerIndices(src.nonZeros(), src.innerIndexPtr());
|
array innerIndices(src.nonZeros(), src.innerIndexPtr());
|
||||||
|
|
||||||
return matrix_type(std::make_tuple(
|
return matrix_type(pybind11::make_tuple(
|
||||||
std::move(data), std::move(innerIndices), std::move(outerIndices)),
|
std::move(data), std::move(innerIndices), std::move(outerIndices)),
|
||||||
std::make_pair(src.rows(), src.cols()))
|
pybind11::make_tuple(src.rows(), src.cols()))
|
||||||
.release();
|
.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,10 +61,10 @@ def docs(session: nox.Session) -> None:
|
|||||||
session.chdir("docs")
|
session.chdir("docs")
|
||||||
|
|
||||||
if "pdf" in session.posargs:
|
if "pdf" in session.posargs:
|
||||||
session.run("sphinx-build", "-b", "latexpdf", ".", "_build")
|
session.run("sphinx-build", "-M", "latexpdf", ".", "_build")
|
||||||
return
|
return
|
||||||
|
|
||||||
session.run("sphinx-build", "-b", "html", ".", "_build")
|
session.run("sphinx-build", "-M", "html", ".", "_build")
|
||||||
|
|
||||||
if "serve" in session.posargs:
|
if "serve" in session.posargs:
|
||||||
session.log("Launching docs at http://localhost:8000/ - use Ctrl-C to quit")
|
session.log("Launching docs at http://localhost:8000/ - use Ctrl-C to quit")
|
||||||
|
@ -7,7 +7,7 @@ if("${PYTHON_MODULE_EXTENSION}" MATCHES "pypy" OR "${Python_INTERPRETER_ID}" STR
|
|||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(Catch 2.13.5)
|
find_package(Catch 2.13.9)
|
||||||
|
|
||||||
if(CATCH_FOUND)
|
if(CATCH_FOUND)
|
||||||
message(STATUS "Building interpreter tests using Catch v${CATCH_VERSION}")
|
message(STATUS "Building interpreter tests using Catch v${CATCH_VERSION}")
|
||||||
|
@ -342,9 +342,8 @@ TEST_SUBMODULE(virtual_functions, m) {
|
|||||||
const AdderBase &adder,
|
const AdderBase &adder,
|
||||||
const AdderBase::DataVisitor &visitor) {
|
const AdderBase::DataVisitor &visitor) {
|
||||||
adder(first, second, [&](const AdderBase::Data &first_plus_second) {
|
adder(first, second, [&](const AdderBase::Data &first_plus_second) {
|
||||||
adder(first_plus_second,
|
// NOLINTNEXTLINE(readability-suspicious-call-argument)
|
||||||
third,
|
adder(first_plus_second, third, visitor);
|
||||||
visitor); // NOLINT(readability-suspicious-call-argument)
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user