Commit Graph

3203 Commits

Author SHA1 Message Date
Ralf W. Grosse-Kunstleve
35b26794ec Merge branch 'master' into sh_merge_master 2023-09-10 10:49:38 -07:00
Sergei Izmailov
c83605936b
feature: Support move-only iterators in py::make_*iterator (#4834)
* feature: Support move-only iterators in `py::make_*iterator`

* fix: Missing static assertion message

* fixup: Missing `explicit` in single argument constructors

* fix: Simplify tests: make existing iterator move-only

* fix: Missing `noexcept`
2023-09-07 05:57:39 -07:00
dependabot[bot]
4a2f7e4681
chore(deps): bump actions/checkout from 1 to 4 (#4836)
* chore(deps): bump actions/checkout from 1 to 4

Bumps [actions/checkout](https://github.com/actions/checkout) from 1 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v1...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update .github/workflows/ci.yml

* actions/checkout@v1 for centos:7

* Fix oversight: centos:7 actually works with actions/checkout@v3

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2023-09-06 15:57:18 -04:00
pre-commit-ci[bot]
467fe27bd9
chore(deps): update pre-commit hooks (#4838)
* chore(deps): update pre-commit hooks

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.0.281 → v0.0.287](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.281...v0.0.287)
- [github.com/pre-commit/mirrors-mypy: v1.4.1 → v1.5.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.4.1...v1.5.1)
- [github.com/asottile/blacken-docs: 1.15.0 → 1.16.0](https://github.com/asottile/blacken-docs/compare/1.15.0...1.16.0)
- [github.com/Lucas-C/pre-commit-hooks: v1.5.1 → v1.5.4](https://github.com/Lucas-C/pre-commit-hooks/compare/v1.5.1...v1.5.4)
- [github.com/PyCQA/pylint: v3.0.0a6 → v3.0.0a7](https://github.com/PyCQA/pylint/compare/v3.0.0a6...v3.0.0a7)

* style: pre-commit fixes

* Update pyproject.toml

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2023-09-06 06:04:27 -07:00
Ralf W. Grosse-Kunstleve
c9638a1927
Help Coverty avoid generating a false positive. (#4817)
* Change variable name `it` to `curr_overl` to improve readability, add `assert()` in the only place where `curr_overl` could become `nullptr`.

* Move the `assert()` to where Coverty generates a false positive.

* variable name as suggested by @henryiii
2023-09-01 11:31:22 -07:00
Sergei Izmailov
db412e6e86
fix: Render py::function as Callable (#4829)
* fix: Render `py::function` as `Callable`

* style: pre-commit fixes

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-08-30 22:43:01 -07:00
Sergei Izmailov
e705fb5f27
Fix enum's __str__ docstring (#4827)
* fix: Enum __str__ function name

* tests: Test enum.__str__.__doc__
2023-08-30 14:20:46 -07:00
Ralf W. Grosse-Kunstleve
1adac5a5b1
PYBIND11_INTERNALS_VERSION bump for MSVC, piggy-backed on PR #4779. See comments there. (#4819) 2023-08-30 10:05:24 -07:00
Peter Würtz
76b8858110
fix: Different MSVC versions may be ABI incompatible, guard with _MSC_VER (#2898) (#4779) 2023-08-23 09:49:35 -07:00
Jean Elsner
b9359ceadb
Remove newlines from docstring signature (#4735)
* Remove newlines from docstring signature

* Jean/dev (#1)

Replace newlines in arg values with spaces

* style: pre-commit fixes

* Don't use std::find_if for C++ 11 compatibility

* Avoid implicit char to bool conversion

* Test default arguments for line breaks

* style: pre-commit fixes

* Separate Eigen tests

* style: pre-commit fixes

* Fix merge

* Try importing numpy

* Avoid unreferenced variable in catch block

* style: pre-commit fixes

* Update squash function

* Reduce try block

* Additional test cases

* style: pre-commit fixes

* Put statement inside braces

* Move string into function body

* Rename repr for better readability. Make constr explicit.

* Add multiline string default argument test case

* style: pre-commit fixes

* Add std namespace, do not modify string repr

* Test for all space chars, test str repr not modified

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-08-15 07:48:59 -07:00
Kenji
f47ff3280e
Fix grammar in functions.rst (#4791)
The previous sentence had an extra "a" before "several", which isn't right.
2023-08-15 07:09:13 -07:00
Ralf W. Grosse-Kunstleve
80bcd21fb7
[ci skip] Adopt nanobind config. (#4792) 2023-08-15 07:02:54 -07:00
Ralf W. Grosse-Kunstleve
add281a2da
Migrate to readthedocs configuration file v2¶ (#4789)
* Copy of recommded readthedocs configuration file v2

* [ci skip] It is now requirements (not requirements_file)
2023-08-14 21:46:17 -07:00
Henry Schreiner
9039e6ac42
chore: use 2x faster black mirror (#4784)
Committed via https://github.com/asottile/all-repos
2023-08-10 15:17:56 -04:00
Ralf W. Grosse-Kunstleve
23cd9128de test_type_caster_odr_guard: pytest.skip(...NVCOMPILER...) 2023-08-07 22:51:41 -07:00
Ralf W. Grosse-Kunstleve
b9e956b002 Tracking ci.yml changes from master. 2023-08-07 21:03:46 -07:00
Ralf W. Grosse-Kunstleve
6f702e7f0e Merge branch 'master' into smart_holder 2023-08-07 20:59:51 -07:00
Pieter P
4bf60c609a
Disable strip when build type is unset (#4454) (#4780) 2023-08-07 20:58:30 -07:00
Ralf W. Grosse-Kunstleve
690a115d84
Add py::set_error(), use in updated py::exception<> documentation (#4772)
* Copy clang 17 compatibility fixes from PR #4762 to a separate PR.

* static py::exception<> -> static py::handle

* Add `py::set_error()` but also try the suggestion of @malfet (https://github.com/pytorch/pytorch/pull/106401#pullrequestreview-1559961407).

* clang 17 compatibility fixes (#4767)

* Copy clang 17 compatibility fixes from PR #4762 to a separate PR.

* Add gcc:13 C++20

* Add silkeh/clang:16-bullseye C++20

* chore(deps): update pre-commit hooks (#4770)

updates:
- [github.com/psf/black: 23.3.0 → 23.7.0](https://github.com/psf/black/compare/23.3.0...23.7.0)
- [github.com/astral-sh/ruff-pre-commit: v0.0.276 → v0.0.281](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.276...v0.0.281)
- [github.com/asottile/blacken-docs: 1.14.0 → 1.15.0](https://github.com/asottile/blacken-docs/compare/1.14.0...1.15.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* docs: Remove upper bound on pybind11 in example pyproject.toml for setuptools (#4774)

* docs: Remove upper bound on pybind11 in example pyproject.toml for setuptools

* Update docs/compiling.rst

---------

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>

* Provide better type hints for a variety of generic types (#4259)

* Provide better type hints for a variety of generic types

* Makes better documentation
* tuple, dict, list, set, function

* Move to py::typing

* style: pre-commit fixes

* Update copyright line with correct year and actual author. The author information was copy-pasted from the git log output.

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* Use `py::set_error()` everywhere possible (only one special case, in common.h).
Overload `py::set_error(py::handle, py::handle)`.
Change back to `static py::handle exc = ... .release();`
Deprecate `py::exception<>::operator()`

* Add `PYBIND11_WARNING_DISABLE` for INTEL and MSVC (and sort alphabetically).

* `PYBIND11_WARNING_DISABLE_INTEL(10441)` does not work.

For ICC only, falling back to the recommended `py::set_error()` to keep the testing simple.

It is troublesome to add `--diag-disable=10441` specifically for test_exceptions.cpp, even that is non-ideal because it covers the entire file, not just the one line we need it for, and the value of exercising the trivial deprecated `operator()` on this one extra platform is practically zero.

* Fix silly oversight.

* NVHPC 23.5.0 generates deprecation warnings. They are currently not treated as errors, but falling back to using `py::set_error()` to not have to deal with that distraction.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Keto D. Zhang <keto.zhang@gmail.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
Co-authored-by: Dustin Spicuzza <dustin@virtualroadside.com>
2023-08-07 20:48:20 -07:00
Axel Huebl
824dc27a01
CI: Reenable an NVHPC Test (#4764)
Update from CentOS to Ubuntu and to a recent version
of NVHPC (former: PGI).

Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2023-08-04 11:17:33 -07:00
Ralf W. Grosse-Kunstleve
fc9de040aa Tracking ci.yml changes from master. 2023-08-03 22:54:55 -07:00
Ralf W. Grosse-Kunstleve
7b62184cd2 Merge branch 'master' into sh_merge_master 2023-08-03 22:53:08 -07:00
Dustin Spicuzza
f8703154ec
Provide better type hints for a variety of generic types (#4259)
* Provide better type hints for a variety of generic types

* Makes better documentation
* tuple, dict, list, set, function

* Move to py::typing

* style: pre-commit fixes

* Update copyright line with correct year and actual author. The author information was copy-pasted from the git log output.

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-08-03 22:48:57 -07:00
Keto D. Zhang
9ad7e827a2
docs: Remove upper bound on pybind11 in example pyproject.toml for setuptools (#4774)
* docs: Remove upper bound on pybind11 in example pyproject.toml for setuptools

* Update docs/compiling.rst

---------

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2023-08-03 22:14:23 -07:00
pre-commit-ci[bot]
413e6328dc
chore(deps): update pre-commit hooks (#4770)
updates:
- [github.com/psf/black: 23.3.0 → 23.7.0](https://github.com/psf/black/compare/23.3.0...23.7.0)
- [github.com/astral-sh/ruff-pre-commit: v0.0.276 → v0.0.281](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.276...v0.0.281)
- [github.com/asottile/blacken-docs: 1.14.0 → 1.15.0](https://github.com/asottile/blacken-docs/compare/1.14.0...1.15.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-08-03 22:11:25 -07:00
Xiaofei Wang
f1e2e55bda
[smart_holder] Make smart holder type caster of unique_ptr accept automatic_reference (#4775)
* Also accept automatic_reference

* Add a test case

* Remove the test case

* Add another test case

* Fix test case
2023-08-03 18:33:16 -07:00
Ralf W. Grosse-Kunstleve
17b614303f
clang 17 compatibility fixes (#4767)
* Copy clang 17 compatibility fixes from PR #4762 to a separate PR.

* Add gcc:13 C++20

* Add silkeh/clang:16-bullseye C++20
2023-08-03 13:36:29 -07:00
Ralf W. Grosse-Kunstleve
f3e0602802
Add command to check for vX.Y.Z tag vs pybind11/_version.py consistency. (#4757)
* Add command to check for vX.Y.Z tag vs pybind11/_version.py consistency. Piggy-backing hints for converting changelog to release message.

* Simpler way of double-checking version number in sources vs. git tag

* Even simpler.

* Fix rst rendering (hopefully) and remove stray dots.

* [ci skip] Trying more to make GitHub rst renderer show this nicely.

* [ci skip] Fix up RST rendering issues.

Lesson learned:

This is NOT GOOD:

```
- Bullet nesting level 1.
    - Bullet nesting level 2.
```

This is BETTER:

```
- Bullet nesting level 1.
  - Bullet nesting level 2.
```

Also consistently adding empty lines between bullet points, to make the .rst
file easier to read.

Also piggy-backing a few very minor enhancements.
2023-07-23 11:10:10 -07:00
Ralf W. Grosse-Kunstleve
b6444460ee Merge branch 'master' into sh_merge_master 2023-07-17 21:53:28 -07:00
Ralf W. Grosse-Kunstleve
8d08dc64ca
Copy v2.11.1 changelog section as released. (#4755) 2023-07-17 12:07:42 -07:00
Ethan Steinberg
99131a85b6
Provide PYBIND11_NO_ASSERT_GIL_HELD_INCREF_DECREF as an option (#4753)
* Remove GIL checks

* Update common.h

* Add flag

* style: pre-commit fixes

* Update pytypes.h

* style: pre-commit fixes

* Update common.h

* style: pre-commit fixes

* Update pytypes.h

* style: pre-commit fixes

* Update common.h

* style: pre-commit fixes

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-07-17 00:05:52 -07:00
Ralf W. Grosse-Kunstleve
ec1b57c50c
Disable PYBIND11_ASSERT_GIL_HELD_INCREF_DECREF generally for PyPy (not just PyPy Windows). (#4751) 2023-07-15 12:55:00 -07:00
bzaar
0620d71638
Update README.rst - Add missing comma in the list of acknowlegements (#4750) 2023-07-15 09:58:54 -07:00
Ralf W. Grosse-Kunstleve
9dba679766 Merge branch 'master' into sh_merge_master 2023-07-15 02:36:22 -07:00
Ralf W. Grosse-Kunstleve
e85696e80e
Post release version bump (#4747)
* Boilerplate version number update after v2.11.0 release.

* Small updates to release.rst
2023-07-14 14:53:58 -07:00
Ralf W. Grosse-Kunstleve
1a917f1852
docs: preparation for v2.11.0 release (#4744)
* Remove .dev1 from version number.

* Update Changelog (starting from `nox -s make_changelog` output)

* Miscellaneous minor fixes from proofreading in GitHub web view.

* docs: minor changelog updates

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
2023-07-14 10:20:38 -05:00
Ralf W. Grosse-Kunstleve
fc2b9226b0 Tracking ci.yml changes from master. 2023-07-12 13:24:25 -07:00
Ralf W. Grosse-Kunstleve
9319f4ae75 Merge branch 'master' into sh_merge_master 2023-07-12 13:23:42 -07:00
Aaron Gokaslan
b33d06f615
bugfix: fixes a test suite bug in the __new__ example (#4698)
* bugfix: fixes a test suite bug in the __new__ example

* See https://github.com/pybind/pybind11/pull/4698#discussion_r1227107682

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2023-07-12 13:20:08 -07:00
Henry Schreiner
2e5f5c4cf8
fix: support CMake 3.27, drop 3.4 (#4719)
* fix: support CMake 3.27, drop 3.4

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Update upgrade.rst

* Update upgrade.rst

* Update upgrade.rst

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2023-07-12 13:10:24 -05:00
Luc de Jonckheere
6d22dba82f
Warning on comparing wrapper enums with is (#4732)
* Warning on comparing wrapper enums with is

* backticks for quoting and link to related issue

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2023-07-12 08:56:40 -07:00
dependabot[bot]
b2732c6e1a
chore(deps): bump pypa/gh-action-pypi-publish from 1.8.6 to 1.8.7 (#4718)
* chore(deps): bump pypa/gh-action-pypi-publish from 1.8.6 to 1.8.7

Bumps [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) from 1.8.6 to 1.8.7.
- [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases)
- [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/v1.8.6...v1.8.7)

---
updated-dependencies:
- dependency-name: pypa/gh-action-pypi-publish
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Apply suggestions from code review

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2023-07-12 08:55:18 -07:00
pre-commit-ci[bot]
47dc0c4bd1
chore(deps): update pre-commit hooks (#4727)
updates:
- [github.com/pre-commit/mirrors-clang-format: v16.0.4 → v16.0.6](https://github.com/pre-commit/mirrors-clang-format/compare/v16.0.4...v16.0.6)
- https://github.com/charliermarsh/ruff-pre-commithttps://github.com/astral-sh/ruff-pre-commit
- [github.com/astral-sh/ruff-pre-commit: v0.0.270 → v0.0.276](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.270...v0.0.276)
- [github.com/pre-commit/mirrors-mypy: v1.3.0 → v1.4.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.3.0...v1.4.1)
- [github.com/asottile/blacken-docs: 1.13.0 → 1.14.0](https://github.com/asottile/blacken-docs/compare/1.13.0...1.14.0)
- [github.com/codespell-project/codespell: v2.2.4 → v2.2.5](https://github.com/codespell-project/codespell/compare/v2.2.4...v2.2.5)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2023-07-11 10:31:43 -07:00
dependabot[bot]
d462dd91a5
chore(deps): bump scipy from 1.8.0 to 1.10.0 in /tests (#4731)
Bumps [scipy](https://github.com/scipy/scipy) from 1.8.0 to 1.10.0.
- [Release notes](https://github.com/scipy/scipy/releases)
- [Commits](https://github.com/scipy/scipy/compare/v1.8.0...v1.10.0)

---
updated-dependencies:
- dependency-name: scipy
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2023-07-10 10:43:20 -07:00
Ralf W. Grosse-Kunstleve
782b6281a2
Drop PyPy 3.7 from GitHub Actions (ci.yml) (#4728)
* Remove `pypy-3.7` from ci.yml

* Update .github/workflows/ci.yml

---------

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2023-07-09 09:40:47 -07:00
Henry Schreiner
5ccb9e412d
chore: ruff moved to astral-sh (#4726)
* chore: ruff moved to astral-sh

Committed via https://github.com/asottile/all-repos

* ci: bump CUDA version
2023-07-04 08:38:14 -04:00
Ralf W. Grosse-Kunstleve
ddb677b5ea Tracking ci.yml changes from master. 2023-06-27 15:11:55 -07:00
Ralf W. Grosse-Kunstleve
3a5d27e1f0 Merge branch 'master' into sh_merge_master 2023-06-27 15:11:06 -07:00
Ralf W. Grosse-Kunstleve
2fb3d7cbde
Trivial refactoring to make the capsule API more user friendly. (#4720)
* Trivial refactoring to make the capsule API more user friendly.

* Use new API in production code. Thanks @Lalaland for pointing this out.
2023-06-27 15:08:32 -07:00
Ralf W. Grosse-Kunstleve
e10da79b6e
Undo ci.yml gcc10 workaround after docker-library/gcc#95 was resolved. (#4717)
The gcc10 workaround was introduced with PR #4705.
2023-06-24 12:12:35 -07:00