Commit Graph

696 Commits

Author SHA1 Message Date
Henry Schreiner
66d394f259 docs: standardize header a bit (#5749) 2025-07-11 13:51:17 -07:00
Ralf W. Grosse-Kunstleve
fa72aff53d [skip ci] Small docs/release.rst update, mainly to remove git push --tags. (#5748)
* [skip ci] Small docs/release.rst update, mainly to warn about `git push --tags`.

* Remove mention of `git push --tags`

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

---------

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2025-07-11 13:49:30 -07:00
Ralf W. Grosse-Kunstleve
ed5057ded6 chore: prepare for 3.0.0 (final) (#5746)
* Update docs/changelog.md and change version to v3.0.0 (final)

* [skip ci] Add `|SPEC 4 — Using and Creating Nightly Wheels|` badge in main README.rst
2025-07-10 09:16:14 -07:00
Henry Schreiner
ea3e33e40d chore: prepare for 3.0.0rc4 (#5736)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-06-19 10:51:52 -04:00
dependabot[bot]
bdc56d9e2e chore(deps): bump urllib3 from 2.2.2 to 2.5.0 in /docs (#5735)
Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.2.2 to 2.5.0.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/2.2.2...2.5.0)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-version: 2.5.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-19 00:16:25 -04:00
Henry Schreiner
cf3d1a75a2 feat: numpy scalars (#5726) 2025-06-18 19:40:31 -04:00
Jan Iwaszkiewicz
e2f86af216 docs: add documentation entry for warnings (#5356)
* [docs] Add entry for warnings

* Fix code formatting

* Update docs

* Fix issue with docs

* [skip ci] Minor edits.

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
2025-06-17 14:03:58 -04:00
dependabot[bot]
ff0e381d9e chore(deps): bump requests from 2.32.3 to 2.32.4 in /docs (#5720)
Bumps [requests](https://github.com/psf/requests) from 2.32.3 to 2.32.4.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.32.3...v2.32.4)

---
updated-dependencies:
- dependency-name: requests
  dependency-version: 2.32.4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-10 17:35:50 -04:00
Henry Schreiner
5d32ed76c0 docs: prepare for RC 3 (#5713)
* docs: prepare for RC 3

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

* docs: one more rc 3 update

* chore: bump to 3.0.0rc3

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

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-06-05 11:14:33 -04:00
Henry Schreiner
df595b1657 docs: changelog update for 3.0.0rc2
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-29 11:05:00 -04:00
Henry Schreiner
a1b1972241 chore: prepare for 3.0.0rc2 (#5698)
* chore: prepare for 3.0.0rc2

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

* Update docs/changelog.md

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-29 01:16:32 -04:00
Henry Schreiner
9d06626521 docs: more warnings about locking and the GIL (#5689)
* docs: more warnings about locking and the GIL

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

* fix require → reacquire typo

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgkio@gmail.com>
2025-05-24 19:12:49 -04:00
Henry Schreiner
d7769de533 feat: scoped_critical_section (#5684)
* feat: scoped_critical_section

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

* refactor: pull out to file

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

* style: pre-commit fixes

* fix: GIL code in some compilers

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

* fix: move to correct spot

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

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-05-23 17:41:45 -04:00
Xuehai Pan
e3883dd5d5 refactor: use CPython macros to construct PYBIND11_VERSION_HEX (#5683)
* refactor: use CPython macros to construct `PYBIND11_VERSION_HEX`

* docs: update release guide

* tests: add test to keep version values in sync

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

* style: pre-commit fixes

* test: update version test

* test: update version test

* test: update version test

* chore: update code comments

* Update docs/release.rst

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-05-23 17:12:46 -04:00
Henry Schreiner
8d503e30be docs: update contributing/release guide a little (#5681)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-22 01:38:10 -04:00
Henry Schreiner
fc888f758f docs: prepare for 3.0.0rc1 (#5679)
* docs: prepare for 3.0.0rc1

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

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update changelog.md

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-21 14:14:27 -04:00
Henry Schreiner
e8f16e2fdd docs: remove setup.py mentions, mention presets (#5677)
* docs: remove setup.py mentions, mention presets

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

* Update .github/CONTRIBUTING.md

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-20 19:02:41 -04:00
b-pass
07d028f218 feat: Embeded sub-interpreters (#5666)
* First draft a subinterpreter embedding API

* Move subinterpreter tests to their own file

* Migrate subinterpreter tests to use the new embedded class.

* Add a test for moving subinterpreters across threads for destruction

And find a better way to make that work.

* Code organization

* Add a test which shows demostrates how gil_scoped interacts with sub-interpreters

* Add documentation for embeded sub-interpreters

* Some additional docs work

* Add some convenience accessors

* Add some docs cross references

* Sync some things that were split out into #5665

* Update subinterpreter docs example to not use the CPython api

* Fix pip test

* style: pre-commit fixes

* Fix MSVC warnings

I am surprised other compilers allowed this code with a deleted move ctor.

* Add some sub-headings to the docs

* Oops, make_unique is C++14 so remove it from the tests.

* I think this fixes the EndInterpreter issues on all versions.

It just has to be ifdef'd because it is slightly broken on 3.12, working well on 3.13, and kind of crashy on 3.14beta.  These two verion ifdefs solve all the issues.

* Add a note about exceptions.

They contain Python object references and acquire the GIL, that means they are a danger with subinterpreters!

* style: pre-commit fixes

* Add try/catch to docs examples to match the tips

* Python 3.12 is very picky about this first PyThreadState

Try special casing the destruction on the same thread.

* style: pre-commit fixes

* Missed a rename in a ifdef block

* I think this test is causing problems in 3.12, so try ifdefing it to see if the problems go away.

* style: pre-commit fixes

* Document the 3.12 constraints with a warning

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* ci: add cpptest to the clang-tidy job

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

* noexcept move operations

* Update include/pybind11/subinterpreter.h

std::memset

Co-authored-by: Aaron Gokaslan <aaronGokaslan@gmail.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Aaron Gokaslan <aaronGokaslan@gmail.com>
2025-05-20 18:17:48 -04:00
Henry Schreiner
ec8b050824 chore: convert changelog to markdown (#5672)
* chore: move changelog to markdown

* chore: switch to simpler block def

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

* style: pre-commit fixes

* chore: handle more block ends

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

* docs: fix md display

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

* docs: one more fix

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

* style: pre-commit fixes

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-05-20 14:52:14 -04:00
Ralf W. Grosse-Kunstleve
4587d33cf9 docs: prepare for v3.0.0rc1 (#5589)
* Squashed prepv300/manuscript — 30b9c268aeb98308ea42aaccfd5fe454e173c6fc — 2025-03-30 14:56:03 -0700 [skip ci]

[Browse prepv300/manuscript tree](30b9c268ae)

[Browse prepv300/manuscript commits](30b9c268ae/)

* docs: update changelog

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

* docs: upgrade guide CMake suggestions

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

* Explain type_caster_enum_type_enabled, copyable_holder_caster_shared_ptr_with_smart_holder_support_enabled, move_only_holder_caster_unique_ptr_with_smart_holder_support_enabled in Upgrade guide.

* Add a small section for py::bind_vector, py::bind_map & py::smart_holder

* Fix tiny oversight: Reference back to the current release v2.13 (not v2.12)

* Remove sentence: Using self._pybind11_conduit_v1_() ... should keep extension compatibility.

This isn't true, because we also modernized `PYBIND11_PLATFORM_ABI_ID`
(which I believe was absolutely necessary). I think it'll be too complicated
to explain that here, and there is a mention in the Upgrade guide.

* Changelog: combine #4953 and #5439

* Trivial whitespace/formatting fixes/enhancements.

* chore: add more to deprecation page

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

* docs: update for recent additions

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

* docs: fixes and set rc1 version

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

* fix: support rc versions

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

* Undo erroneous copilot change: We need to use `detail::enable_if_t`, for compatibility with C++11 and C++14.

* Empty lines cleanup.

* Rewording of "CMake support now defaults to ..." paragraph.

* Add missing backticks in upgrade guide.

* Try :ref:deprecated instead of :doc:deprecated

* docs: last bit of polish

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

* Piggy-back trivial whitespace cleanup that was missed in PR #5669

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-19 09:02:11 -04:00
Xuehai Pan
6bf25d1e39 feat: add semi-public API: pybind11::detail::is_holder_constructed (#5669)
* Add semi-public API: `pybind11::detail::is_holder_constructed`

* Update docs for `pybind11::custom_type_setup`

* Update tests in `test_custom_type_setup.cpp`

* Apply suggestions from code review
2025-05-18 21:11:56 -04:00
b-pass
9afc9c4ffb feat: change PYBIND11_EMBEDDED_MODULE to multiphase init (#5665)
* Move embedded modules to multiphase init

So that they too can support multi-interpreter and nogil tags

* Update the multiple interpreter test for embedded module changes

* Add a note to embedded module docs about the new tags

* Oops, missed a warning pop

* Remove unused variable

* Update ci.yml

* Fix this embedded GIL test for free-threading

* Oops, need to use ptr() here

* This test created a subinterpreter when PYBIND11_SUBINTERPRETER_SUPPORT was off

So the fix is really this test should not be run in these older versions at all.

The hang was a GIL issue between the subinterpreters during pybind11::exception::what().

* fix: standard mutex for 3.13t

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

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2025-05-18 09:39:26 -04:00
b-pass
1107c0936e docs: Add documentation for mod_gil_not_used and multiple_interpreters (#5659)
* Add documentation (advanced/misc) for mod_gil_not_used and multiple_interpreters options

* Add some comparison of free-threading vs sub-interpreters

* Formatting

* Reword for clarity

* style: pre-commit fixes

* Suggested changes, including a long-winded explaination of parallelism in python today

* Slight formatting updates and GPT suggested clarifications

* Better section title

* Update docs/advanced/misc.rst

Copilot suggestion

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update docs/advanced/misc.rst

Copilot suggestion

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update docs/advanced/misc.rst

* Add a deadlock warning, and minor corrections

* Rewrite the example to avoid free-threading risky behaviors

* Oops, missed a line in the example

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2025-05-16 19:45:38 -04:00
Henry Schreiner
af231a6054 chore: use scikit-build-core for the build (#5598)
* chore: use scikit-build-core for the build

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

* fix: support tests job

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

* refactor: use tomlkit instead of manual parsing

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

* tests: add tests for output

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

* chore: remove more unused files

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

* fix: restore global pin

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

* fix: test and fix pinning

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

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-05-15 14:39:23 -04:00
Noah Oblath
74b5242713 feat: add py::potentially_slicing_weak_ptr(handle) function (#5624)
* Added weak_ptr test (currently failing)

* Cleanup

* [skip ci] Simplify test case.

* Add test_class_sp_trampoline_weak_ptr.cpp,py (using std::shared_ptr as holder). Tweak test_class_sh_trampoline_weak_ptr.py to pass, with `# THIS NEEDS FIXING` comment.

* Resolve clang-tidy errors

```
/__w/pybind11/pybind11/tests/test_class_sh_trampoline_weak_ptr.cpp:23:43: error: the parameter 'sp' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param,-warnings-as-errors]
   23 |     void set_wp(std::shared_ptr<VirtBase> sp) { wp = sp; }
      |                                           ^
      |                 const                    &
4443 warnings generated.
```

```
/__w/pybind11/pybind11/tests/test_class_sp_trampoline_weak_ptr.cpp:23:43: error: the parameter 'sp' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param,-warnings-as-errors]
   23 |     void set_wp(std::shared_ptr<VirtBase> sp) { wp = sp; }
      |                                           ^
      |                 const                    &
4430 warnings generated.
```

* PYPY, GRAALPY: skip last part of test_weak_ptr_base

* Rename test_weak_ptr_base → test_weak_ptr_owner

* Add SpOwner, test_with_sp_owner, test_with_sp_and_wp_owners

* Modify py::trampoline_self_life_support semantics: if trampoline class does not inherit from this class, preserve established Inheritance Slicing behavior.

rwgk reached this point with the help of ChatGPT:

* https://chatgpt.com/share/68056498-7d94-8008-8ff0-232e2aba451c

The only production code change in this commit is:

```
diff --git a/include/pybind11/detail/type_caster_base.h b/include/pybind11/detail/type_caster_base.h
index d4f9a41e..f3d45301 100644
--- a/include/pybind11/detail/type_caster_base.h
+++ b/include/pybind11/detail/type_caster_base.h
@@ -776,6 +776,14 @@ struct load_helper : value_and_holder_helper {
                 if (released_ptr) {
                     return std::shared_ptr<T>(released_ptr, type_raw_ptr);
                 }
+                auto *self_life_support
+                    = dynamic_raw_ptr_cast_if_possible<trampoline_self_life_support>(type_raw_ptr);
+                if (self_life_support == nullptr) {
+                    std::shared_ptr<void> void_shd_ptr = hld.template as_shared_ptr<void>();
+                    std::shared_ptr<T> to_be_released(void_shd_ptr, type_raw_ptr);
+                    vptr_gd_ptr->released_ptr = to_be_released;
+                    return to_be_released;
+                }
                 std::shared_ptr<T> to_be_released(
                     type_raw_ptr, shared_ptr_trampoline_self_life_support(loaded_v_h.inst));
                 vptr_gd_ptr->released_ptr = to_be_released;
```

* Remove debug printf in include/pybind11/pybind11.h

* Resolve MSVC error

```
    11>D:\a\pybind11\pybind11\tests\test_class_sp_trampoline_weak_ptr.cpp(44,50): error C2220: the following warning is treated as an error [D:\a\pybind11\pybind11\build\tests\pybind11_tests.vcxproj]
    11>D:\a\pybind11\pybind11\tests\test_class_sp_trampoline_weak_ptr.cpp(44,50): warning C4458: declaration of 'sp' hides class member [D:\a\pybind11\pybind11\build\tests\pybind11_tests.vcxproj]
             D:\a\pybind11\pybind11\tests\test_class_sp_trampoline_weak_ptr.cpp(54,31):
             see declaration of 'pybind11_tests::class_sp_trampoline_weak_ptr::SpOwner::sp'
```

* [skip ci] Undo the production code change under 4638e017b6

Also undo the corresponding test change in test_class_sh_trampoline_weak_ptr.py

But keep all extra debugging code for now.

* [skip ci] Introduce lambda in `WpOwner::set_wp` bindings, but simply cast to `std::shared_ptr<VirtBase>` for now.

* Add `py::potentially_slicing_shared_ptr()`

* Add `type_id<T>()` to `py::potentially_slicing_shared_ptr()` error message and add test.

* test_potentially_slicing_shared_ptr.cpp,py (for smart_holder only)

* Generalize test_potentially_slicing_shared_ptr.cpp,py for testing with smart_holder and std::shared_ptr as holder.

* Add back test_potentially_slicing_shared_ptr_not_convertible_error(), it got lost accidentally in commit 56d23dc478

* Add simple trampoline state assertions.

* Resolve clang-tidy errors.

```
/__w/pybind11/pybind11/tests/test_potentially_slicing_shared_ptr.cpp:30:9: error: 'magic_token' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer,-warnings-as-errors]
   29 |     trampoline_is_alive_simple(const trampoline_is_alive_simple &other) {
      |                                                                         : magic_token(other.magic_token)
   30 |         magic_token = other.magic_token;
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/__w/pybind11/pybind11/tests/test_potentially_slicing_shared_ptr.cpp:33:9: error: 'magic_token' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer,-warnings-as-errors]
   32 |     trampoline_is_alive_simple(trampoline_is_alive_simple &&other) noexcept {
      |                                                                             : magic_token(other.magic_token)
   33 |         magic_token = other.magic_token;
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

* Add a (long) C++ comment for py::potentially_slicing_shared_ptr<>()

* [skip ci] Add new "Avoiding Inheritance Slicing and ``std::weak_ptr`` surprises" section in advanced/classes.rst

* [skip ci] Add introductory comment to test_potentially_slicing_shared_ptr.py

* Minimal (!) changes to have py::potentially_slicing_weak_ptr<T>(handle) as the public API. For CI testing, before changing the names around more widely, and the documentation.

* Rename test_potentially_slicing_shared_ptr.cpp,py → test_potentially_slicing_weak_ptr.cpp,py

* Update docs/advanced/classes.rst and C++ comments → potentially_slicing_weak_ptr

* Write "shared_ptr" instead of just "pointer" in a couple places in docs/advanced/classes.rst

* Add comment for force_potentially_slicing_shared_ptr in type_caster_base.h, to make a direct connection py::potentially_slicing_weak_ptr

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
2025-05-13 10:07:33 -04:00
Ralf W. Grosse-Kunstleve
c630e22c1c Add static_asserts to enforce that py::smart_holder is combined with py::trampoline_self_life_support (#5633)
* Strictly enforce: trampoline must inherit from trampoline_self_life_support when used in combination with smart_holder

* Simplify test_class_sh_trampoline_basic.cpp,py (only one Abase is needed now)

* Replace obsolete sophisticated `throw value_error()` with a simple `assert()`

* Strictly enforce: trampoline should inherit from trampoline_self_life_support only if used in combination with smart_holder

* Resolve clang-tidy error

```
/__w/pybind11/pybind11/tests/test_class_sh_trampoline_basic.cpp:35:46: error: the parameter 'obj' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param,-warnings-as-errors]
   35 | int AddInCppSharedPtr(std::shared_ptr<Abase> obj, int other_val) {
      |                                              ^
      |                       const                 &
```

* Disable new static_assert if PYBIND11_RUN_TESTING_WITH_SMART_HOLDER_AS_DEFAULT_BUT_NEVER_USE_IN_PRODUCTION_PLEASE is defined.
2025-04-30 22:12:13 -07:00
Bryn Lloyd
3c586340fb Add class doc string to native_enum (#5617)
* add class doc string to native_enum

* adapt doc argument name

* fix test, make class enum doc None by default

* fix other python versions?

* make clang-tidy happy

* rename 'enum_doc' to 'class_doc'

* update documentation

* [skip ci] Polish changed documentation (mostly done by ChatGPT).

---------

Co-authored-by: Bryn Lloyd <12702862+dyollb@users.noreply.github.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
2025-04-14 23:19:06 -07:00
Ralf W. Grosse-Kunstleve
e38beb96c4 [skip ci] Move "Pitfalls with raw pointers and shared ownership" section to a more prominent location. (#5611) 2025-04-10 12:12:00 -07:00
Henry Schreiner
d27fdaa272 chore: update for CMake 4.0 (#5593)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-03-31 22:50:40 -04:00
Ralf W. Grosse-Kunstleve
f365314ec0 Enable Conversions Between Native Python Enum Types and C++ Enums (#5555)
* Apply smart_holder-branch-based PR #5280 on top of master.

* Add pytest.skip("GraalPy does not raise UnicodeDecodeError")

* Add `parent_scope` as first argument to `py::native_enum` ctor.

* Replace `operator+=` API with `.finalize()` API. The error messages still need cleanup.

* Resolve clang-tidy performance-unnecessary-value-param errors

* Rename (effectively) native_enum_add_to_parent() -> finalize()

* Update error message: pybind11::native_enum<...>("Fake", ...): MISSING .finalize()

* Pass py::module_ by reference to resolve clang-tidy errors (this is entirely inconsequential otherwise for all practical purposes).

* test_native_enum_correct_use_failure -> test_native_enum_missing_finalize_failure

* Add test_native_enum_double_finalize(), test_native_enum_value_after_finalize()

* Clean up public/protected API.

* [ci skip] Update the Enumerations section in classes.rst

* Rename `py::native_enum_kind` → `py::enum_kind` as suggested by gh-henryiii:

https://github.com/pybind/pybind11/pull/5555#issuecomment-2711672335

* Experiment: StrEnum

enum.StrEnum does not map to C++ enum:

* https://chatgpt.com/share/67d5e965-ccb0-8008-95b7-0df2502309b3

```
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-8.3.3, pluggy-1.5.0
C++ Info: 13.3.0 C++20 __pybind11_internals_v10000000_system_libstdcpp_gxx_abi_1xxx_use_cxx11_abi_1__ PYBIND11_SIMPLE_GIL_MANAGEMENT=False PYBIND11_NUMPY_1_ONLY=False
configfile: pytest.ini
plugins: parallel-0.1.1, xdist-3.6.1
collected 40 items / 39 deselected / 1 selected

test_native_enum.py F                                                    [100%]

=================================== FAILURES ===================================
________________________ test_native_enum_StrEnum_greek ________________________

    def test_native_enum_StrEnum_greek():
        assert not hasattr(m, "greek")
>       m.native_enum_StrEnum_greek(m)

test_native_enum.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.12/enum.py:764: in __call__
    return cls._create_(
        boundary   = None
        cls        = <enum 'StrEnum'>
        module     = None
        names      = [('Alpha', 10), ('Omega', 20)]
        qualname   = None
        start      = 1
        type       = None
        value      = 'greek'
        values     = ()
/usr/lib/python3.12/enum.py:917: in _create_
    return metacls.__new__(metacls, class_name, bases, classdict, boundary=boundary)
        _          = <class 'str'>
        bases      = (<enum 'StrEnum'>,)
        boundary   = None
        class_name = 'greek'
        classdict  = {'_generate_next_value_': <function StrEnum._generate_next_value_ at 0x701ec1711e40>, 'Alpha': 10, 'Omega': 20, '__module__': 'test_native_enum'}
        cls        = <enum 'StrEnum'>
        first_enum = <enum 'StrEnum'>
        item       = ('Omega', 20)
        member_name = 'Omega'
        member_value = 20
        metacls    = <class 'enum.EnumType'>
        module     = 'test_native_enum'
        names      = [('Alpha', 10), ('Omega', 20)]
        qualname   = None
        start      = 1
        type       = None
/usr/lib/python3.12/enum.py:606: in __new__
    raise exc.with_traceback(tb)
        __class__  = <class 'enum.EnumType'>
        __new__    = <function StrEnum.__new__ at 0x701ec1711da0>
        _gnv       = <staticmethod(<function StrEnum._generate_next_value_ at 0x701ec1711e40>)>
        _order_    = None
        _simple    = False
        bases      = (<enum 'StrEnum'>,)
        boundary   = None
        classdict  = {'Alpha': <enum._proto_member object at 0x701ebc74f9b0>, 'Omega': <enum._proto_member object at 0x701ebc74cce0>, '__module__': 'test_native_enum', '_all_bits_': 0, ...}
        cls        = 'greek'
        exc        = TypeError('10 is not a string')
        first_enum = <enum 'StrEnum'>
        ignore     = ['_ignore_']
        invalid_names = set()
        key        = '_ignore_'
        kwds       = {}
        member_names = {'Alpha': None, 'Omega': None}
        member_type = <class 'str'>
        metacls    = <class 'enum.EnumType'>
        name       = 'Omega'
        save_new   = False
        tb         = <traceback object at 0x701ebc7a6cc0>
        use_args   = True
        value      = 20
/usr/lib/python3.12/enum.py:596: in __new__
    enum_class = super().__new__(metacls, cls, bases, classdict, **kwds)
        __class__  = <class 'enum.EnumType'>
        __new__    = <function StrEnum.__new__ at 0x701ec1711da0>
        _gnv       = <staticmethod(<function StrEnum._generate_next_value_ at 0x701ec1711e40>)>
        _order_    = None
        _simple    = False
        bases      = (<enum 'StrEnum'>,)
        boundary   = None
        classdict  = {'Alpha': <enum._proto_member object at 0x701ebc74f9b0>, 'Omega': <enum._proto_member object at 0x701ebc74cce0>, '__module__': 'test_native_enum', '_all_bits_': 0, ...}
        cls        = 'greek'
        exc        = TypeError('10 is not a string')
        first_enum = <enum 'StrEnum'>
        ignore     = ['_ignore_']
        invalid_names = set()
        key        = '_ignore_'
        kwds       = {}
        member_names = {'Alpha': None, 'Omega': None}
        member_type = <class 'str'>
        metacls    = <class 'enum.EnumType'>
        name       = 'Omega'
        save_new   = False
        tb         = <traceback object at 0x701ebc7a6cc0>
        use_args   = True
        value      = 20
/usr/lib/python3.12/enum.py:271: in __set_name__
    enum_member = enum_class._new_member_(enum_class, *args)
        args       = (10,)
        enum_class = <enum 'greek'>
        member_name = 'Alpha'
        self       = <enum._proto_member object at 0x701ebc74f9b0>
        value      = 10
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <enum 'greek'>, values = (10,)

    def __new__(cls, *values):
        "values must already be of type `str`"
        if len(values) > 3:
            raise TypeError('too many arguments for str(): %r' % (values, ))
        if len(values) == 1:
            # it must be a string
            if not isinstance(values[0], str):
>               raise TypeError('%r is not a string' % (values[0], ))
E               TypeError: 10 is not a string

cls        = <enum 'greek'>
values     = (10,)

/usr/lib/python3.12/enum.py:1322: TypeError
=========================== short test summary info ============================
FAILED test_native_enum.py::test_native_enum_StrEnum_greek - TypeError: 10 is...
======================= 1 failed, 39 deselected in 0.07s =======================

ERROR: completed_process.returncode=1
```

* Remove StrEnum code.

* Make enum_kind::Enum the default kind.

* Catch redundant .export_values() calls.

* [ci skip] Add back original documentation for `py::enum_` under new advanced/deprecated.rst

* [ci skip] Add documentation for `py::enum_kind` and `py::detail::type_caster_enum_type_enabled`

* Rename `Type` to `EnumType` for readability.

* Eliminate py::enum_kind, use "enum.Enum", "enum.IntEnum" directly. This is still WIP.

* EXPERIMENTAL StrEnum code. To be removed.

* Remove experimental StrEnum code:

My judgement: Supporting StrEnum is maybe nice, but not very valuable. I don't think it is worth the extra C++ code.

A level of indirection would need to be managed, e.g.

    RED   ↔ Python "r" ↔ C++ 0
    Green ↔ Python "g" ↔ C++ 1

These mappings would need to be stored and processed.

* Add test with enum.IntFlag (no production code changes required).

* First import_or_getattr() implementation (dedicated tests are still missing).

* Fix import_or_getattr() implementation, add tests, fix clang-tidy errors.

* [ci skip] Update classes.rst: replace `py::enum_kind` with `native_type_name`

* For "constructor similar to that of enum.Enum" point to https://docs.python.org/3/howto/enum.html#functional-api, as suggested by gh-timohl (https://github.com/pybind/pybind11/pull/5555#discussion_r2009277507).

* Advertise Enum, IntEnum, Flag, IntFlags are compatible stdlib enum types in the documentation (as suggested by gh-timohl, https://github.com/pybind/pybind11/pull/5555#pullrequestreview-2708832587); add test for enum.Flag to ensure that is actually true.
2025-03-24 20:31:59 -07:00
dependabot[bot]
d422fda125 chore(deps): bump jinja2 from 3.1.5 to 3.1.6 in /docs (#5554)
Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.5 to 3.1.6.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst)
- [Commits](https://github.com/pallets/jinja/compare/3.1.5...3.1.6)

---
updated-dependencies:
- dependency-name: jinja2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-06 17:18:19 -05:00
Ralf W. Grosse-Kunstleve
2943a27a14 squash-merge smart_holder branch into master (#5542)
* Pure `git merge --squash smart_holder` (no manual interventions).

* Remove ubench/ directory.

* Remove include/pybind11/smart_holder.h

* [ci skip] smart_ptrs.rst updates [WIP/unfinished]

* [ci skip] smart_ptrs.rst updates continued; also updating classes.rst, advanced/classes.rst

* Remove README_smart_holder.rst

* Restore original README.rst from master

* [ci skip] Minimal change to README.rst, to leave a hint that this is pybind11v3

* [ci skip] Work in ChatGPT suggestions.

* Change macro name to PYBIND11_RUN_TESTING_WITH_SMART_HOLDER_AS_DEFAULT_BUT_NEVER_USE_IN_PRODUCTION_PLEASE

* Add a note pointing to the holder reinterpret_cast.

* Incorporate suggestion by @virtuald: https://github.com/pybind/pybind11/pull/5542#discussion_r1967000989

* Systematically change most py::class_ to py::classh under docs/

* Remove references to README_smart_holder.rst

This should have been part of commit eb550d03d3.

* [ci skip] Fix minor oversight (``class_`` -> ``py::class_``) noticed by chance.

* [ci skip] Resolve suggestion by @virtuald

https://github.com/pybind/pybind11/pull/5542#discussion_r1969940605

* [ci skip] Apply suggestions by @timohl (thanks!)

* https://github.com/pybind/pybind11/pull/5542#discussion_r1970714551
* https://github.com/pybind/pybind11/pull/5542#discussion_r1971315329
* https://github.com/pybind/pybind11/pull/5542#discussion_r1971322821

* Replace `classh : class_` inhertance with `using`, as suggested by @henryiii

https://github.com/pybind/pybind11/pull/5542#issuecomment-2689034104

* Revert "Systematically change most py::class_ to py::classh under docs/"

This reverts commit ac9d31e13f.

* docs: focus on py::smart_holder instead of py::classh

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

* Restore minor general fixes that got lost when ac9d31e13f was reverted.

* Remove `- smart_holder` from list of branches in all .github/workflows

* Extend classh note to explain whitespace noise motivation.

* Suggest `py::smart_holder` for "most situations for safety"

* Add back PYBIND11_HAS_INTERNALS_WITH_SMART_HOLDER_SUPPORT

This define was
* introduced with https://github.com/pybind/pybind11/pull/5286
* removed with https://github.com/pybind/pybind11/pull/5531

It is has been in use here:
* f02a2b7653/pybind11_protobuf/native_proto_caster.h (L89-L101)

Currently pybind11 unit tests for the two holder caster backwards compatibility traits

* `copyable_holder_caster_shared_ptr_with_smart_holder_support_enabled`
* `move_only_holder_caster_unique_ptr_with_smart_holder_support_enabled`

are missing.

* Add py::trampoline_self_life_support to all trampoline examples under docs/.

Address suggestion by @timohl:

* https://github.com/pybind/pybind11/pull/5542#issuecomment-2686452062

Add to the "please think twice" note: the overhead for safety is likely in the noise.

Also fix a two-fold inconsistency introduced by revert-commit 1e646c91b4:

1.

py::trampoline_self_life_support is mentioned in a note, but is missing in the example right before.

2.

The section starting with

    To enable safely passing a ``std::unique_ptr`` to a trampoline object between

is obsolete.

* Fix whitespace accident (indentation) introduced with 1e646c91b4

Apparently the mis-indentation was introduced when resolving merge conflicts for what became 1e646c91b4

* WHITESPACE CHANGES ONLY in README.rst (list of people that made significant contributions)

* Add Ethan Steinberg to list of people that made significant contributions (for completeness, unrelated to smart_holder work).

* [ci skip] Add to list of people that made significant contributions: major and/or influential contributors to smart_holder branch

* #2904 by @rhaschke was merged on Mar 16, 2021
* #3012 by @rhaschke was merged on May 28, 2021
* #3039 by @jakobandersen was merged on Jun 29, 2021
* #3048 by @Skylion007 was merged on Jun 18, 2021
* #3588 by @virtuald was merged on Jan 3, 2022
* #3633 by @wangxf123456 was merged on Jan 25, 2022
* #3635 by @virtuald was merged on Jan 26, 2022
* #3645 by @wangxf123456 was merged on Jan 25, 2022
* #3796 by @wangxf123456 was merged on Mar 10, 2022
* #3807 by @wangxf123456 was merged on Mar 18, 2022
* #3838 by @wangxf123456 was merged on Apr 15, 2022
* #3929 by @tomba was merged on May 7, 2022
* #4031 by @wangxf123456 was merged on Jun 27, 2022
* #4343 by @wangxf123456 was merged on Nov 18, 2022
* #4381 by @wangxf123456 was merged on Dec 5, 2022
* #4539 by @wangxf123456 was merged on Feb 28, 2023
* #4609 by @wangxf123456 was merged on Apr 6, 2023
* #4775 by @wangxf123456 was merged on Aug 3, 2023
* #4921 by @iwanders was merged on Nov 7, 2023
* #4924 by @iwanders was merged on Nov 6, 2023
* #5401 by @msimacek was merged on Oct 8, 2024

Co-authored-by: Aaron Gokaslan <aaronGokaslan@gmail.com>
Co-authored-by: Dustin Spicuzza <dustin@virtualroadside.com>
Co-authored-by: Ivor Wanders <iwanders@users.noreply.github.com>
Co-authored-by: Jakob Lykke Andersen <Jakob@caput.dk>
Co-authored-by: Michael Šimáček <michael.simacek@oracle.com>
Co-authored-by: Robert Haschke <rhaschke@users.noreply.github.com>
Co-authored-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
Co-authored-by: Xiaofei Wang <6218006+wangxf123456@users.noreply.github.com>

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Aaron Gokaslan <aaronGokaslan@gmail.com>
Co-authored-by: Dustin Spicuzza <dustin@virtualroadside.com>
Co-authored-by: Ivor Wanders <iwanders@users.noreply.github.com>
Co-authored-by: Jakob Lykke Andersen <Jakob@caput.dk>
Co-authored-by: Michael Šimáček <michael.simacek@oracle.com>
Co-authored-by: Robert Haschke <rhaschke@users.noreply.github.com>
Co-authored-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
Co-authored-by: Xiaofei Wang <6218006+wangxf123456@users.noreply.github.com>
2025-03-05 12:40:53 -08:00
gentlegiantJGC
73825f351b Improved reference_internal documentation (#5528)
* Improved reference_internal documentation

Improved the wording to make it easier to understand and added a note about the policy falling back to move if the return value is not an lvalue reference or pointer.

* Added bold and ticket number
2025-02-20 09:53:56 -08:00
Nikul Patel
c19c291b98 feat: --extension-suffix for pybind11 command (#5360)
* fix docs build command on different global and venv python versions

* feat: add --extension-suffix

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

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Nikul Patel <nikul@z830>
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
2025-01-24 17:13:21 -05:00
Tim Ohliger
1b7aa0bb66 feat: rework of arg/return type hints to support .noconvert() (#5486)
* Added rework of arg/return typing

* Changed `Path` to `pathlib.Path` for compatibility with pybind11-stubgen

* Removed old arg/return type hint implementation

* Added noconvert support for arg/return type hints

* Added commented failing tests for Literals with special characters

* Added return_descr/arg_descr for correct typing in typing::Callable

* Fixed clang-tidy issues

* Changed io_name to have explicit return type (for C++11 support)

* style: pre-commit fixes

* Added support for nested callables

* Fixed missing include

* Fixed is_return_value constructor call

* Fixed clang-tidy issue

* Uncommented test cases for special characters in literals

* Moved literal tests to correct test case

* Added escaping of special characters in typing::Literal

* Readded mistakenly deleted bracket

* Moved sanitize_string_literal to correct namespace

* Added test for Literal with `!` and changed StringLiteral template param name

* Added test for Literal with multiple and repeated special chars

* Simplified string literal sanitization function

* Added test for `->` in literal

* Added test for `->` with io_name

* Removed unused parameter name to prevent warning

* Added escaping of `-` in literal to prevent processing of `->`

* Fixed wrong computation of sanitized string literal length

* Added cast to prevent error with MSVC

* Simplified special character check

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-01-24 17:01:06 -05:00
dependabot[bot]
945e251a6c chore(deps): bump jinja2 from 3.1.4 to 3.1.5 in /docs (#5490)
Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.4 to 3.1.5.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst)
- [Commits](https://github.com/pallets/jinja/compare/3.1.4...3.1.5)

---
updated-dependencies:
- dependency-name: jinja2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-08 21:02:02 -08:00
pre-commit-ci[bot]
b17555f340 chore(deps): update pre-commit hooks (#5459)
* chore(deps): update pre-commit hooks

updates:
- [github.com/pre-commit/mirrors-clang-format: v19.1.3 → v19.1.4](https://github.com/pre-commit/mirrors-clang-format/compare/v19.1.3...v19.1.4)
- [github.com/astral-sh/ruff-pre-commit: v0.7.2 → v0.8.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.7.2...v0.8.1)
- [github.com/sirosen/texthooks: 0.6.7 → 0.6.8](https://github.com/sirosen/texthooks/compare/0.6.7...0.6.8)
- [github.com/PyCQA/pylint: v3.3.1 → v3.3.2](https://github.com/PyCQA/pylint/compare/v3.3.1...v3.3.2)
- [github.com/python-jsonschema/check-jsonschema: 0.29.4 → 0.30.0](https://github.com/python-jsonschema/check-jsonschema/compare/0.29.4...0.30.0)

* Resolve ruff pre-commit errors:

```
ruff.....................................................................Failed
- hook id: ruff
- exit code: 1

warning: The following rules have been removed and ignoring them has no effect:
    - PT004

docs/benchmark.py:51:17: UP031 Use format specifiers instead of percent format
   |
50 |     for cl in range(nclasses):
51 |         decl += "class cl%03i {\n" % cl
   |                 ^^^^^^^^^^^^^^^^^^ UP031
52 |         decl += "public:\n"
53 |         bindings += f'    py::class_<cl{cl:03}>("cl{cl:03}")\n'
   |
   = help: Replace with format specifiers

docs/benchmark.py:88:15: UP031 Use format specifiers instead of percent format
   |
86 |         elapsed = (n2 - n1).total_seconds()
87 |         size = os.stat("test.so").st_size
88 |         print("   {%i, %f, %i}," % (nclasses * nfns, elapsed, size))
   |               ^^^^^^^^^^^^^^^^^^ UP031
89 |     print("}")
   |
   = help: Replace with format specifiers

tools/make_changelog.py:62:9: PLC0206 Extracting value from dictionary without calling `.items()`
   |
61 |           msg += f"\n  `#{issue.number} <{issue.html_url}>`_"
62 |           for cat in cats:
   |  _________^
63 | |             if issue.title.lower().startswith(f"{cat}:"):
64 | |                 cats[cat].append(msg)
65 | |                 break
66 | |         else:
67 | |             cats["unknown"].append(msg)
   | |_______________________________________^ PLC0206
68 |
69 |   for cat, msgs in cats.items():
   |

Found 3 errors.

```

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
2024-12-08 15:21:49 -08:00
Tim Ohliger
1d09fc8300 Option for arg/return type hints and correct typing for std::filesystem::path (#5450)
* Added arg/return type handling.

* Added support for nested arg/return type in py::typing::List

* Added support for arg/return type in stl/filesystem

* Added tests for arg/return type in stl/filesystem and py::typing::List

* Added arg/return name to more py::typing classes

* Added arg/return type to Callable[...]

* Added tests for typing container classes (also nested)

* Changed typing classes to avoid using C++14 auto return type deduction.

* Fixed clang-tidy errors.

* Changed Enable to SFINAE

* Added test for Tuple[T, ...]

* Added RealNumber with custom caster for testing typing classes.

* Added tests for Set, Iterable, Iterator, Union, and Optional

* Added tests for Callable

* Fixed Callable with ellipsis test

* Changed TypeGuard/TypeIs to use return type (being the narrower type) + Tests

* Added test for use of fallback type name with stl vector

* Updated documentation.

* Fixed unnecessary constructor call in test.

* Fixed reference counting in example type caster.

* Fixed clang-tidy issues.

* Fix for clang-tidy

* Updated cast method to use pybind11 API rather than Python C API in custom caster example

* Updated load to use pybind11 API rather than Python C API in custom caster example

* Changed test of arg/return name to use pybind11 API instead of Python C API

* Updated code in adcanced/cast example and improved documentation text

* Fixed references in custom type caster docs

* Fixed wrong logical and operator in test

* Fixed wrong logical operator in doc example

* Added comment to test about `float` vs `float | int`

* Updated std::filesystem::path docs in cast/overview section

* Remove one stray dot.

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
2024-12-08 11:30:49 -08:00
Tim Stumbaugh
f46f5be4fa Fix incorrect link syntax in upgrade guide (#5434)
Looks like some markdown spilled into our restructured text
2024-11-06 11:21:33 -08:00
Thomas Köppe
af67e87393 docs/advanced A document about deadlock potential with C++ statics (#5394)
* [docs/advanced] A document about deadlock potential with C++ statics

* [docs/advanced] Refer to deadlock.md from misc.rst

* [docs/advanced] Fix tables in deadlock.md

* Use :ref:`deadlock-reference-label`

* Revert "Use :ref:`deadlock-reference-label`"

This reverts commit e5734d275f.

* Add simple references to docs/advanced/deadlock.md filename. (Maybe someone can work on clickable links later.)

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
2024-10-08 10:51:20 -07:00
Henry Schreiner
5b7c0b04b9 docs: update changelog for 2.13.6 (#5372)
* docs: update changelog for 2.13.6

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

* docs: mention supported versions

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-09-13 16:59:50 -04:00
Ralf W. Grosse-Kunstleve
65f4266cef Add while True & top method to FAQ. (#5340) 2024-08-27 21:04:48 -07:00
Henry Schreiner
c2291e597f docs: prepare for 2.13.5 (#5327)
* docs: prepare for 2.13.5

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

* Update docs/changelog.rst

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-08-22 14:12:17 -04:00
DWesl
efa2b20d69 docs: clarify requirements for including pybind11 (#5326)
* DOC: Clarify requirements for including pybind11

Inherited from requirements for including Python.h

Closes #4999

* style: pre-commit fixes

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-08-22 00:29:21 -04:00
Henry Schreiner
9966ad409d fix: allow -Wpedantic in C++20 mode (#5322)
* fix: allow -Wpedantic again

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

* tests: ignore pedantic warning for PYBIND11_DECLARE_HOLDER_TYPE

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

* tests: try just turning off pedantic for one file

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

* tests: only run pedantic in C++20 mode

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

* Update tests/local_bindings.h

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-08-22 00:27:50 -04:00
Henry Schreiner
bd5951b691 docs: prepare for 2.13.4 (#5312)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-08-14 23:57:37 -04:00
Henry Schreiner
28dbce4157 feat: require CMake 3.15+ (#5304)
* feat: require CMake 3.15+

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

* Apply suggestions from code review

* Update CMakeLists.txt

* fix: adapt for CMake 3.30+ (using 3.18+)

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

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-08-14 18:21:04 -04:00
pwdcd
0116906189 chore: remove repetitive words (#5308)
Signed-off-by: pwdcd <pwdcd@icloud.com>
2024-08-13 22:04:10 -07:00
Henry Schreiner
4a06eca591 docs: prepare for 2.13.3
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-08-13 13:25:38 -04:00
Henry Schreiner
40f2c7863b docs: prepare for 2.13.2 (#5299)
* docs: prepare for 2.13.2

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

* Update changelog.rst

* Update changelog.rst

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-08-13 09:04:03 -04:00