Commit Graph

42 Commits

Author SHA1 Message Date
Ralf W. Grosse-Kunstleve 65f4266cef
Add `while True` & `top` method to FAQ. (#5340) 2024-08-27 21:04:48 -07: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
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
Ralf W. Grosse-Kunstleve a97e9d8cac
Dropping MSVC 2015 (#3722)
* Changing `_MSC_VER` guard to `< 1910` (dropping MSVC 2015).

* Removing MSVC 2015 from ci.yml, and .appveyor.yml entirely.

* Bringing back .appveyor.yml from master.

* appveyor Visual Studio 2017

* 1st manual pass, builds & tests with unix_clang, before pre-commit.

* After clang-format (via pre-commit).

* Manual pass looking for "2015", builds & tests with unix_clang, before pre-commit.

* Backtracking for include/pybind11 changes in previous commit.

git checkout d07865846c include/pybind11/attr.h include/pybind11/detail/common.h include/pybind11/functional.h

--------------------

CI #4160 errors observed:

2a26873727
https://github.com/pybind/pybind11/runs/5168332130?check_suite_focus=true

$ grep ' error C' *.txt | sed 's/2022-02-12[^ ]*//' | sed 's/^[0-9][0-9]*//' | sed 's/^.*\.txt: //' | sort | uniqD:\a\pybind11\pybind11\include\pybind11\cast.h(1364,1): error C2752: 'pybind11::detail::type_caster<Eigen::Ref<Eigen::Vector3f,0,pybind11::EigenDStride>,void>': more than one partial specialization matches the template argument list [D:\a\pybind11\pybind11\build\tests\pybind11_tests.vcxproj]

d:\a\pybind11\pybind11\include\pybind11\detail/common.h(1023): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized [D:\a\pybind11\pybind11\build\tests\cross_module_gil_utils.vcxproj]
d:\a\pybind11\pybind11\include\pybind11\detail/common.h(1023): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized [D:\a\pybind11\pybind11\build\tests\pybind11_cross_module_tests.vcxproj]
d:\a\pybind11\pybind11\include\pybind11\detail/common.h(1023): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized [D:\a\pybind11\pybind11\build\tests\pybind11_tests.vcxproj]
d:\a\pybind11\pybind11\include\pybind11\detail/common.h(1023): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized [D:\a\pybind11\pybind11\build\tests\test_embed\external_module.vcxproj]
D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\build\tests\pybind11_tests.vcxproj]
D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\tests\pybind11_tests.vcxproj]

$ grep ': error C2737' *.txt | sed 's/^.*MSVC//' | sed 's/___.*//' | sort | uniq

_2017

$ grep ': error C2752' *.txt

3______3.8_____MSVC_2019_____x86_-DCMAKE_CXX_STANDARD=17.txt:2022-02-12T16:12:45.9921122Z D:\a\pybind11\pybind11\include\pybind11\cast.h(1364,1): error C2752: 'pybind11::detail::type_caster<Eigen::Ref<Eigen::Vector3f,0,pybind11::EigenDStride>,void>': more than one partial specialization matches the template argument list [D:\a\pybind11\pybind11\build\tests\pybind11_tests.vcxproj]

$ grep ': fatal error C1001:' *.txt

10______pypy-3.8-v7.3.7_____windows-2022_____x64.txt:2022-02-12T16:12:56.3163683Z D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\tests\pybind11_tests.vcxproj]
1______3.6_____MSVC_2019_____x86.txt:2022-02-12T16:12:47.6774625Z D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\build\tests\pybind11_tests.vcxproj]
16______3.6_____windows-latest_____x64_-DPYBIND11_FINDPYTHON=ON.txt:2022-02-12T16:12:27.0556151Z D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\tests\pybind11_tests.vcxproj]
17______3.9_____windows-2019_____x64.txt:2022-02-12T16:12:30.3822566Z D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\tests\pybind11_tests.vcxproj]
2______3.7_____MSVC_2019_____x86.txt:2022-02-12T16:12:38.7018911Z D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\build\tests\pybind11_tests.vcxproj]
6______3.6_____windows-2022_____x64.txt:2022-02-12T16:12:00.4513642Z D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\tests\pybind11_tests.vcxproj]
7______3.9_____windows-2022_____x64.txt:2022-02-12T16:11:43.6306160Z D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\tests\pybind11_tests.vcxproj]
8______3.10_____windows-2022_____x64.txt:2022-02-12T16:11:49.9589644Z D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\tests\pybind11_tests.vcxproj]
9______pypy-3.7-v7.3.7_____windows-2022_____x64.txt:2022-02-12T16:11:53.7912112Z D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\tests\pybind11_tests.vcxproj]

* common.h: is_template_base_of

* Re-applying 4 changes from 2a26873727 that work universally.

* `overload_cast = {};` only for MSVC 2017 and Clang 5

* Refining condition for using is_template_base_of workaround.

* Undoing MSVC 2015 workaround in test_constants_and_functions.cpp

* CentOS7: silence_unused_warnings

* Tweaks in response to reviews.

* Adding windows-2022 C++20

* Trying another way of adding windows-2022 C++20
2022-02-14 11:36:22 -08:00
Henry Schreiner 522c59ceb2
chore: drop Python 3.5 (#3719)
* chore: drop Python 3.5 support

* chore: more fstrings with flynt's help

* ci: drop Python 3.5

* chore: bump dependency versions

* docs: touch up py::args

* tests: remove deprecation warning

* Ban smartquotes

* Very minor tweaks (by-product of reviewing PR #3719).

Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
Co-authored-by: Ralf W. Grosse-Kunstleve <rwgk@google.com>
2022-02-11 19:06:16 -05:00
Ralf W. Grosse-Kunstleve 6493f496e3
Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688)
* `#error BYE_BYE_GOLDEN_SNAKE`

* Removing everything related to 2.7 from ci.yml

* Commenting-out Centos7

* Removing `PYTHON: 27` from .appveyor.yml

* "PY2" removal, mainly from tests. C++ code is not touched.

* Systematic removal of `u` prefix from `u"..."` and `u'...'` literals. Collateral cleanup of a couple minor other things.

* Cleaning up around case-insensitive hits for `[^a-z]py.*2` in tests/.

* Removing obsolete Python 2 mention in compiling.rst

* Proper `#error` for Python 2.

* Using PY_VERSION_HEX to guard `#error "PYTHON 2 IS NO LONGER SUPPORTED.`

* chore: bump pre-commit

* style: run pre-commit for pyupgrade 3+

* tests: use sys.version_info, not PY

* chore: more Python 2 removal

* Uncommenting Centos7 block (PR #3691 showed that it is working again).

* Update pre-commit hooks

* Fix pre-commit hook

* refactor: remove Python 2 from CMake

* refactor: remove Python 2 from setup code

* refactor: simplify, better static typing

* feat: fail with nice messages

* refactor: drop Python 2 C++ code

* docs: cleanup for Python 3

* revert: intree

revert: intree

* docs: minor touchup to py2 statement

Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
2022-02-10 18:28:08 -08:00
Aaron Gokaslan 0fb981b219
Add blacken-docs and pycln pre-commit hooks (#3292)
* Apply blacken-docs and fix language-hints

* Add blacken-docs pre-commit hook

* Add pycln pre-commit hook

* Enable a few builtin hooks

* Black no longer ignores pyi files
2021-09-22 15:38:50 -04:00
Jan Iwaszkiewicz cf006af2f0
Fix typos and docs style (#3088)
* py::pickle typo

* correct dots and parentheses
2021-07-10 11:16:07 -07:00
luzpaz 8bee61b645
docs: fix various typos (#3075)
Found via `codespell -q 3 -L nd,ot,thist`
2021-07-04 19:58:35 -04:00
jakobjw 98f9a33c62
Correct typo in FAQ (#2868) 2021-02-20 23:28:27 +01:00
Henry Schreiner e4e5c49a26
docs: known issues (#2565)
* docs: FAQ CMake updates

* docs: limitations

* ci: don't over label

* docs: update CHANGELOG, add a bit more structure

* ci: label PRs with more labels, and sooner

* docs: updates from @rwgk

* docs: address @YannickJadoul's points
2020-10-09 11:19:13 -04:00
Henry Schreiner 6bcd220c8d
refactor: module -> module_ with typedef (#2544)
* WIP: module -> module_ without typedef

* refactor: allow py::module to work again
2020-10-03 13:38:03 -04:00
Henry Schreiner 37f845a1dc
ci: disallow some common capitalization mistakes (#2472)
* ci: only annotate linux for now

* style: block some common mistakes
2020-09-08 15:26:50 +02:00
Lin Hsu d031efe788 Typo 2020-07-01 00:08:05 +02:00
Eric Cousineau baf69345f6 Minor modifications to interrupt handling FAQ (#2007) 2019-11-25 22:14:06 +08:00
Charles Brossollet 0f1d3bfee2 Add FAQ entry for dealing with long functions interruption (#2000)
* Add FAQ entry, with code example, for dealing with long functions interruption
2019-11-25 17:59:53 +08:00
Ivor Wanders 2b045757b5 Improve documentation related to inheritance. (#1676)
* Adds section to the reference.
* Adds section to advanced classes page describing how to use `get_overload`.
2019-06-10 22:12:28 +02:00
Ahuva Kroizer 8f5b7fce84 FAQ addition (#1606)
* Add possible solution to ImportError issue
2018-11-13 13:25:57 +01:00
Semen Yesylevskyy ef13fb2e1c Info about inconsistent detection of Python version between pybind11 … (#1093)
* Info about inconsistent detection of Python version between pybind11 and CMake in FAQ
2018-09-12 00:20:56 +02:00
David Caron 307ea6b7fd Typo 2018-04-24 17:44:57 -03:00
Marc Schlaich ab003dbdd9 Correct VS version in FAQ 2018-03-10 14:19:31 -04:00
Wenzel Jakob e7d304fbc6
added citation reference (fixes #767) (#1189) 2017-11-17 18:44:20 +01:00
Dean Moldovan 56613945ae Use semi-constexpr signatures on MSVC
MSCV does not allow `&typeid(T)` in constexpr contexts, but the string
part of the type signature can still be constexpr. In order to avoid
`typeid` as long as possible, `descr` is modified to collect type
information as template parameters instead of constexpr `typeid`.
The actual `std::type_info` pointers are only collected in the end,
as a `constexpr` (gcc/clang) or regular (MSVC) function call.

Not only does it significantly reduce binary size on MSVC, gcc/clang
benefit a little bit as well, since they can skip some intermediate
`std::type_info*` arrays.
2017-09-16 12:02:49 +02:00
Jason Rhinelander 97aa54fefa Compile with hidden visibility always; set via cmake property rather than compiler flag
This updates the compilation to always apply hidden visibility to
resolve the issues with default visibility causing problems under debug
compilations.  Moreover using the cmake property makes it easier for a
caller to override if absolutely needed for some reason.

For `pybind11_add_module` we use cmake to set the property; for the
targets, we append to compilation option to non-MSVC compilers.
2017-08-14 11:44:17 -04:00
Dean Moldovan 443ab5946b Replace PYBIND11_PLUGIN with PYBIND11_MODULE
This commit also adds `doc()` to `object_api` as a shortcut for the
`attr("__doc__")` accessor.

The module macro changes from:
```c++
PYBIND11_PLUGIN(example) {
    pybind11::module m("example", "pybind11 example plugin");
    m.def("add", [](int a, int b) { return a + b; });
    return m.ptr();
}
```

to:

```c++
PYBIND11_MODULE(example, m) {
    m.doc() = "pybind11 example plugin";
    m.def("add", [](int a, int b) { return a + b; });
}
```

Using the old macro results in a deprecation warning. The warning
actually points to the `pybind11_init` function (since attributes
don't bind to macros), but the message should be quite clear:
"PYBIND11_PLUGIN is deprecated, use PYBIND11_MODULE".
2017-05-29 03:21:19 +02:00
Lori A. Burns 5cafc99884 add CMake exported interface library and Config detection file 2016-12-13 21:44:19 +01:00
Wenzel Jakob 2fb5f1d0c3 added message about recursion limits 2016-11-16 17:37:10 +01:00
Jason Rhinelander fb7c9fd326 Remove obsolete example reference (#457)
* Remove obsolete example reference
* Make example fully-working (except for #includes)

Fixes #456.
2016-10-22 18:54:33 +02:00
Jason Rhinelander 20ef62656f Fix minor documentation spelling mistakes 2016-09-21 13:39:02 -04:00
Wenzel Jakob fe34241e50 minor doc & style fixes 2016-09-06 13:02:29 +09:00
Wenzel Jakob 70f5a4dc8b minor: added error message to faq 2016-09-05 17:19:18 +09:00
Wenzel Jakob f600c1d899 updated FAQ section on Python detection 2016-06-03 14:47:54 +02:00
Wenzel Jakob a439ccaa0e minor FAQ edits, referenced cppimport project 2016-05-17 10:47:52 +02:00
Wenzel Jakob c62360d994 minor FAQ updates 2016-05-03 14:32:47 +02:00
Wenzel Jakob f64feaf3e4 documentation improvements 2016-04-28 15:32:07 +02:00
Wenzel Jakob e84f557edf documentation improvements 2016-04-26 23:48:55 +02:00
Wenzel Jakob c79dbe425d FAQ improvements 2016-04-18 10:53:38 +02:00
Wenzel Jakob 2e03a5857c added comment about cmake issues (#99) 2016-04-14 11:27:15 +02:00
Wenzel Jakob 50ed3614de added a faq entry about import issues 2016-04-11 17:38:25 +02:00
Wenzel Jakob a3e34f4a5f comment about old versions of visual studio 2016-03-15 15:06:47 +01:00
Wenzel Jakob 4a48afb356 doc updates 2016-03-09 21:31:21 +01:00
Wenzel Jakob de623a7668 added faq 2016-03-09 21:11:19 +01:00