1
0
mirror of https://github.com/pybind/pybind11.git synced 2025-02-28 13:52:46 +00:00
Commit Graph

161 Commits

Author SHA1 Message Date
Henry Schreiner
918d4481a4
fix(cmake): support cross-compiles with classic Python ()
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2022-05-20 09:38:29 -04:00
Henry Schreiner
1e4bd22bdc
fix(cmake): support release and debug at the same time () 2022-05-18 23:19:33 -04:00
Henry Schreiner
dff6fa0554
fix(cmake): avoid issue with NVCC + Windows () 2022-05-16 23:45:54 -04:00
HaarigerHarald
f306012b55
fix: file extension on windows with cp36 and cp37 () 2022-05-04 13:12:33 -04:00
Stefano Rivera
465b2e0bd8
Use sysconfig in Python >= 3.10 ()
* Use sysconfig in Python >= 3.10

Rely on sysconfig for installation paths for Python >= 3.10. distutils
has been deprecated and will be removed.

Fixes: 

* Explicitly select the posix_prefix scheme for platinclude on Debian

Debian's default scheme is posix_local, for installing locally-built
packages to /usr/local/.  We want to find the Python headers in /usr/,
so search posix_prefix.
2022-03-01 13:47:10 -05:00
Henry Schreiner
522c59ceb2
chore: drop Python 3.5 ()
* 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 ).

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
Chris Ohk
1a432b426f
docs: Correct minor typos () 2022-02-11 10:42:48 -05:00
Ralf W. Grosse-Kunstleve
6493f496e3
Python 2 removal part 1: tests (C++ code is intentionally ~untouched) ()
* `#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  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
Henry Schreiner
46dcd9bc75
fix: minor CMake warning fix for unused variable () 2022-02-10 17:03:33 -05:00
Mattia Basaglia
dc4717bac2
fix: module extension detection for python 3.10 ()
* Fix module extension detection for python 3.10

* Fix for python < 3.10

* Use importlib
2022-01-31 11:10:45 -05:00
Henry Schreiner
e50f841de0
fix: do not use LTS on mips64 and ppc64le () 2021-12-21 15:42:34 -05:00
Sergiu Deitsch
d2b2131603
cmake: report version type in the version string () 2021-11-16 10:03:41 -05:00
Henry Schreiner
90707b46f2
fix(build): support conan's multiple includes of all files () 2021-10-27 15:06:02 -04:00
Henry Schreiner
e7e2c79f3f
fix: improve support for Python 3.11-dev ()
* ci: support Python 3.11-dev

Also update 3.10 to final, better PyPy usage

* fix: use PyFrame_GetCode on Python 3.9+

* ci: some bitiness of pypy not supported on win

* chore: update CMake support to 3.22rc1 to quiet warning

* fix: use dev version of py to fix Py 3.11

* tests: print proper Eigen version

* ci: include pypy2, not sure why

* ci: avoid running on Python 3.11 for now

* ci: fix runs

* ci: simpler PyPy usage, drop unmaintained scipy + pypy index

* ci: only binary numpy, wait on pypy 3.8

* refactor: address review
2021-10-26 14:50:34 -04:00
Henry Schreiner
d58699c9ab
fix(cmake): reduce chance for variable collision () 2021-09-24 17:47:03 -04:00
Wenzel Jakob
409be8336f CMake: react to python version changes
The new FindPython-based variant of the CMake scripts caches information
about the chosen Python version that can become stale. For example,
suppose I configure a simple pybind11-based project as follows

```
cmake -S . -B build -GNinja -DPython_ROOT=<path to python 3.8>
```

which will generate `my_extension.cpython-38-x86_64-linux-gnu.so`.
A subsequent change to the python version like

```
cmake -S . -B build -GNinja -DPython_ROOT=<path to python 3.9>
```

does not update all necessary build system information. In particular,
the compiled file is still called
`my_extension.cpython-38-x86_64-linux-gnu.so`.

This commit fixes the problem by detecting changes in
`Python_EXECUTABLE` and re-running Python as needed.

Note that the previous way of detecting Python does not seem to be
affected, it always specifies the right suffix.
2021-09-24 17:42:06 +02:00
Henry Schreiner
6ad3f874a7
fix(build): avoid a possible warning about shadowed variables and changing behaviors () 2021-09-23 15:42:16 -04:00
Aaron Gokaslan
9df2f1ff13
maint(precommit): Apply isort ()
* Apply isort

* Tweak isort config

* Add env.py as a known_first_party

* Add one missing known first party

* Make config compat with older isort versions

* Add another comment

* Revert pyproject setting
2021-08-13 12:37:05 -04:00
Ralf W. Grosse-Kunstleve
7d3b05715b
Improved workaround for Centos 8 failure (follow-on to PR ). ()
* Rollback of PR  (Working around Centos 8 failure).

* Adding `-DCMAKE_BUILD_TYPE=Release`

* Improving existing workaround (undoing the originally intended rollback).

* Fixing minor documentation bug.
2021-08-12 13:21:49 -07:00
Jerome Robert
9e8a741baa
fix: Mingw64 corrected and add a CI job to test it ()
* mingw64 platform string is like mingw_xxx not "mingw"

See https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-python/0099-Change-the-get_platform-method-in-sysconfig-and-dist.patch

* Mingw: Do not dllexport exceptions

This is a fix for errors like:

D:/a/pybind11/pybind11/include/pybind11/detail/common.h:735:23: error: 'dllexport' implies default visibility, but 'class pybind11::builtin_exception' has already been declared with a different visibility
  735 | class PYBIND11_EXPORT builtin_exception : public std::runtime_error {
      |                       ^~~~~~~~~~~~~~~~~

* GHA: Test Mingw64 build

* fix: avoid thin binaries on mingw

* fix: drop lto on MinGW

* Mingw64: disable PYBIND11_DEPRECATED

It trigger many warnings for unknown reasons

Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
2021-07-30 13:48:41 -04:00
Henry Schreiner
7cc0ebb475
fix: the CMake config in Python package had a hard coded path () 2021-07-27 17:23:52 -04:00
Henry Schreiner
2415c09459
feat(package): support pipx run () 2021-07-15 15:01:29 -04:00
Aaron Gokaslan
c4b0dc7cdd
Add shellcheck style checking () 2021-07-14 16:52:13 -04:00
Henry Schreiner
7a64b8adcc
docs: fix script issues for changelog compilation ()
[skip ci]
2021-07-12 14:10:46 -04:00
Ralf W. Grosse-Kunstleve
6d1b197b46
Splitting out pybind11/stl/filesystem.h. ()
* Splitting out pybind11/stl/filesystem.h.

To solve breakages like: https://github.com/deepmind/open_spiel/runs/2999582108

Mostly following the suggestion here: https://github.com/pybind/pybind11/pull/2730#issuecomment-750507575

Except using pybind11/stl/filesystem.h instead of pybind11/stlfs.h, as decided via chat.

stl.h restored to the exact state before merging PR  via:
```
git checkout 733f8de24f stl.h
```

* Properly including new stl subdirectory in pip wheel config.

This now passes interactively:
```
pytest tests/extra_python_package/
```

* iwyu cleanup.

iwyuh.py -c -std=c++17 -DPYBIND11_TEST_BOOST -Ipybind11/include -I/usr/include/python3.9 -I/usr/include/eigen3 include/pybind11/stl/filesystem.h

* Adding PYBIND11_HAS_FILESYSTEM_IS_OPTIONAL.

* Eliminating else after return.
2021-07-08 09:02:48 -07:00
Robert Schütz
d00fc62931
use CMAKE_INSTALL_FULL_INCLUDEDIR () 2021-06-19 18:45:53 -04:00
Akira Kawata
417fd120cc
Fix: fix typo of WITHOUT_SOABI () 2021-05-06 00:19:05 -07:00
Weiming Zhao
4f0727f280
Fix the enabling of default extension handling () 2021-04-05 23:50:50 -04:00
Axel Huebl
c78dfb69f2
MSVC but not Clang: /MP ()
On Windows, clang-cl does not understand /MP.
```
clang-cl: warning: argument unused during compilation: '/MP' [-Wunused-command-line-argument]
```
with Clang 10.0.0
2021-02-08 15:40:04 -05:00
Henry Schreiner
08bca374fd
docs: update changelog, nicer output for script () 2021-01-21 11:34:39 -05:00
Henry Schreiner
eb83feefff
style: avoid using unintialized variables ()
* style: avoid using unintialized variables

Tested with cmake --warn-unintialized -S . -B build

* refactor: use function for possibly uninit vars
2021-01-19 18:48:22 -05:00
heyer2
76a160070b
fix: STATIC and SHARED flags not being detected ()
* Fix STATIC and SHARED flags not being detected

* fix: use classic naming for all lib types

Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
2021-01-14 19:51:41 +01:00
Henry Schreiner
230fa53f16
fix: Don't override global settings for VISIBILITY if set ()
Sometimes programmers want to control this, and while it can be changed after the fact, it's commonly set via a CMAKE_ variable; if that variable is set, we should respect that (like the CMAKE_INTERPROCEDURAL_OPTIMIZATION setting).
2021-01-14 08:31:48 -05:00
Yannick Jadoul
f243450e89
ci: disable builds for 3.10.0a4, and enable a nightly 3.10-dev build ()
* Disable builds for 3.10.0a4, and enable a nightly 3.10-dev build

* Fix job name

* Remove deadsnakes job for now

* Add deadsnakes jobs

* There's no deadsnakes 2.7

* Add 3.10 to versions to be discovered by legacy FindPython, and fix debug input to deadsnakes/action

* Try out branch with fix

* Update to deadsnakes/action@v2.1.1
2021-01-13 23:13:19 -05:00
Henry Schreiner
5bd766bf6c
docs: update changelog and add script to help generate it () 2020-12-21 21:04:33 -05:00
Henry Schreiner
ffb113d1d8
fix: regression with installed pybind11 overriding local one ()
* fix: regression with installed pybind11 overriding discovered one

Closes 

* docs: wording incorrect
2020-12-15 21:55:14 -05:00
Frank
f8b8107b46
fix: make FindPython2 and FindPython3 work () 2020-11-15 11:55:42 -05:00
Henry Schreiner
3e4d54bc01
fix: match new extension discovery with changes to classic discovery ()
* fix: match new extension discovery with changes to classic discovery

Followup to  - this was fixed in 2.6.0, but only for classic Python

* fix: followup to avoid warnings
2020-11-05 14:37:11 -05:00
Henry Schreiner
b8dc60ec8f
fix: Python include directory was missing from DIRS () 2020-11-02 20:45:54 -05:00
Henry Schreiner
a42211536b fix: new line in PYPY_VERSION 2020-10-15 17:38:49 -04:00
Henry Schreiner
ad2fe0ee7b fix: pypy3 windows extension issue 2020-10-15 17:38:49 -04:00
Henry Schreiner
645d83813b
feat: typing support for helpers ()
* feat: basic typing support

* docs: mention syncing as suggested by @rwgk

* docs: update changelog

* docs: copy of warning in limitations
2020-10-14 14:08:41 -04:00
Henry Schreiner
a8c2e3eec5
fix: ipo should be off for debug or relwithdebinfo ()
* fix: ipo should be off for debug or relwithdebinfo

Closes 

* docs: slightly more detailed about IPO

* Update pybind11Common.cmake
2020-10-14 13:43:31 -04:00
Henry Schreiner
d46f3322a4
fix: allow cmake varibles from Python calls to be cached () 2020-10-09 17:33:45 -04:00
Henry Schreiner
2a2f52201d
fix: find_import didn't work properly for classic tools ()
* fix: find_import didn't work properly for classic tools

* ci: fix all files not being checked in style run
2020-10-05 15:31:00 -04:00
Henry Schreiner
3488494a81
refactor: import check as a common function ()
* feat: import check as a common function

* docs: add cmake to docs
2020-10-02 22:34:22 -04:00
Henry Schreiner
6d2d08db00
fix: conda-forge patch () 2020-10-02 09:56:54 -04:00
Wenzel Jakob
3232e59b83
Check if module file extension could be queried correctly ()
On very incomplete python installations (e.g. within Docker), it's
possible that distutils is not installed. In that case, the
``execute_command`` statement that queries distutils for the Python
module extension fails, and pybind11 uses the empty string. This commit
adds an extra check that causes a CMake failure with more actionable
information (just spent a lot of time trying to track down this problem :))
2020-09-30 17:49:11 -04:00
Henry Schreiner
82dbc5b78f
ci: releases ()
* ci: releases

* docs: minor update form @wjakob

* fix: enforce reasonable version of setuptools
2020-09-30 15:48:08 -04:00
Henry Schreiner
e01f492462
fix: Add a nice CMake error when Interpreter component is missing. ()
Closes , found by @rhjdjong
2020-09-21 18:34:48 -04:00