Commit Graph

55 Commits

Author SHA1 Message Date
Ralf W. Grosse-Kunstleve
f1a2e03d19
feat: remove Python 3.6 support (#5177)
* Change Python version guard: PYTHON < 3.7 IS UNSUPPORTED.

* Replace or remove Python 3.6 jobs.

* Move appveyor to Python 3.8

* Change `[tool.pylint]` `master.py-version` from `3.6` to `3.8`

* Change `[tool.pylint]` `master.py-version` to `3.7`

* Remove `centos:7` job; Change almalinux:8 job to use Python 3.8

* Try 🐍 3.8 • ubuntu-20.04 • x64 without `-DCMAKE_CXX_FLAGS="-D_=1"`

* Update setup.cfg as suggested by @henryiii

* Try running `cmake --build . --target cpptest` on all platforms (`standard` job).

* Disable deadsnakes jobs entirely.

* Apply PR #5179: Add Python 3.10, 3.11, 3.12 to win32 job matrix.

* Add back `-DCMAKE_CXX_FLAGS="-D_=1"` but do not install boost in that case.

* PY_VERSION_HEX < 3.7 cleanup pass: include/pybind11

* WITH_THREAD cleanup pass: include/pybind11

* Undo incorrect change.

* Revert "Disable deadsnakes jobs entirely."

This reverts commit bbcd0087b2.

* WITH_THREAD cleanup pass: tests/

* Change Python version guard in pybind11/__init__.py: pybind11 does not support Python < 3.7.

* Misc cleanup pass

* chore: use future imports

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

* Update tests/test_numpy_array.py

* Update test_numpy_array.py

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-06-22 00:55:00 -04:00
Henry Schreiner
186df220fd
docs: building suggestions update (#5168)
* docs: building suggestions update

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

* docs: address review comments

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

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-06-18 17:41:54 -04:00
Henry Schreiner
7f2214bc68
chore: bump cmake to 3.29 (#5075)
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
2024-03-27 20:11:13 -04:00
Pascal Thomet
768cebe17e
doc: add litgen to the automatic generators list (compiling.rst) (#5012)
* doc: add litgen to the automatic generators list (compiling.rst)

Added this:

[litgen]_ is an automatic python bindings generator with a focus on generating
documented and discoverable bindings: bindings will nicely reproduce the documentation
found in headers. It is is based on srcML (srcml.org), a highly scalable, multi-language
parsing tool with a developer centric approach. The API that you want to expose to python
must be C++14 compatible (but your implementation can use more modern constructs).

.. [litgen] https://pthom.github.io/litgen

* style: pre-commit fixes

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-01-28 09:10:03 -08:00
Pol Mesalles
daea1130b4
fix(cmake): upgrade maximum supported CMake version to 3.27 (#4786)
* Upgrade maximum supported CMake version to 3.27 to fix warning with CMP0148 policy (#4785)

* Update `macos_brew_install_llvm` pipeline to use expected Python installation

* Fix `Python_EXECUTABLE` Cmake variable typo

* Apply suggestions from code review

* fix: use FindPython for CMake 3.18+ by default for pybind11's tests

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

* tests: fix issues with finding Python

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

* tests: also set executable on subdir tests

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

* fix(cmake): correct logic for FindPython

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

* Update ci.yml

* Revert "Update ci.yml"

This reverts commit 33798adf3f.

---------

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
2023-12-14 14:36:45 -05: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
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
Axel Huebl
a7e7a6e846
Docs: No Strip in Debug (#3779)
The docs were not 100% the same as we advertise with our
tooling function: most users do not want to strip symbols
in Debug builds.
2022-03-17 11:21:28 -07: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
Sebastian Koslowski
94a948722f
docs: fix imported target name (#3689) 2022-02-05 19:11:59 -05:00
Philipp Bucher
c9bbf8d2ee docs: fix minor typo (#3311) 2021-09-28 10:17:52 -04: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
Thomas Ballinger
39a0aac88e
docs fix to avoid nonexistent SmartCompile (#3241) 2021-09-08 14:00:00 -04:00
Antony Lee
1be0a0a610
Add helper to build in-tree extensions. (#2831)
For single-file extensions, a convenient pattern offered by cython
is to place the source files directly in the python source tree
(`foo/__init__.py`, `foo/ext.pyx`), deriving the package names from
their filesystem location.  Adapt this pattern for pybind11, using an
`intree_extensions` helper, which should be thought of as the moral
equivalent to `cythonize`.

Differences with cythonize: I chose not to include globbing support
(`intree_extensions(glob.glob("**/*.cpp"))` seems sufficient), nor to
provide extension-customization kwargs (directly setting the attributes
on the resulting Pybind11Extension objects seems sufficient).

We could choose to have `intree_extension` (singular instead) and make
users write `[*map(intree_extension, glob.glob("**/*.cpp"))]`; no strong
opinion here.

Co-authored-by: Aaron Gokaslan <skylion.aaron@gmail.com>
2021-07-13 17:21:55 -04: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
Aaron Gokaslan
b4b67f026b
Fix typos (#3044) 2021-06-17 13:39:59 -07:00
Henry Schreiner
0df11d857c
docs: update build description slightly (#2794)
* docs: update build description slightly

* docs: missing ticks
2021-01-16 20:12:19 -05:00
Steve Siano
6f66e7603c
docs: add a note about compiling the example (#2737)
* docs: mention PYTHONPATH in installing.rst

When pybind11 is included as a submodule, the user needs to update their
Python module search path.  Otherwise, the first c++ compilation command
in docs/basics.rst will fail.

* docs: add a note about compiling the example

This note shows how to modify the compilation command for the example
when the pybind11 source has been included as a Git submodule.

* docs: add a note about compiling the example

Added an internal link to the docs

* docs: updated a note about compiling the example

Also updated the command substitution syntax for consistency
2020-12-24 09:51:36 -05:00
Yannick Jadoul
028812ae7e
docs: add warning about FindPython's Development component when libraries don't exist (e.g. on manylinux) (#2689)
* Add waring about FindPython's Development component when libraries don't exist (e.g. on manylinux)

* Minor wording update (thanks, @henryiii!)
2020-11-24 13:37:51 -05:00
Henry Schreiner
ebd5c5b48c
feat: way to only recompile changed files (#2643)
* feat: lazy compile

* refactor: lazy -> only_changed

* refactor: leave the changed function up to the user

* refactor: pass a function, based on @YannickJadoul and @HDembinski's suggestions

* refactor: old -> _old, as it's not intended for users

* docs: slight improvmenent from @rwgk

* docs: Ccache spelling, extra warning about pip caching

Ccache spelling noted by @YannickJadoul
2020-11-11 11:45:28 -05:00
Henry Schreiner
a8c2e3eec5
fix: ipo should be off for debug or relwithdebinfo (#2590)
* fix: ipo should be off for debug or relwithdebinfo

Closes #2587

* docs: slightly more detailed about IPO

* Update pybind11Common.cmake
2020-10-14 13:43:31 -04:00
jbarlow83
49cdb70a4d
docs: use sorted(glob()) in example setup.py (#2561) 2020-10-08 09:04:27 -04:00
Henry Schreiner
b6f37f67ac
docs: minor cleanup (#2555)
* docs: minor cleanup

* ci: fix add-path command

* docs: add example of use in-place

* Update .github/workflows/ci.yml
2020-10-07 20:41:03 -04:00
Henry Schreiner
3488494a81
refactor: import check as a common function (#2526)
* feat: import check as a common function

* docs: add cmake to docs
2020-10-02 22:34:22 -04:00
Henry Schreiner
b9d00273ee
feat: parallel compiler (#2521) 2020-10-02 10:03:35 -04:00
Henry Schreiner
dec33c29f2
docs: installing section (#2494)
* docs: installing section

* docs: feedback from @wjakob
2020-09-16 20:00:19 -04:00
Henry Schreiner
fd61f5038e
feat: setup.py redesign and helpers (#2433)
* feat: setup.py redesign and helpers

* refactor: simpler design with two outputs

* refactor: helper file update and Windows support

* fix: review points from @YannickJadoul

* refactor: fixes to naming and more docs

* feat: more customization points

* feat: add entry point pybind11-config

* refactor: Try Extension-focused method

* refactor: rename alt/inplace to global

* fix: allow usage with git modules, better docs

* feat: global as an extra (@YannickJadoul's suggestion)

* feat: single version location

* fix: remove the requirement that setuptools must be imported first

* fix: some review points from @wjacob

* fix: use .in, add procedure to docs

* refactor: avoid monkeypatch copy

* docs: minor typos corrected

* fix: minor points from @YannickJadoul

* fix: typo on Windows C++ mode

* fix: MSVC 15 update 3+ have c++14 flag

See <https://docs.microsoft.com/en-us/cpp/build/reference/std-specify-language-standard-version?view=vs-2019>

* docs: discuss making SDists by hand

* ci: use pep517.build instead of manual setup.py

* refactor: more comments from @YannickJadoul

* docs: updates from @ktbarrett

* fix: change to newly recommended tool instead of pep517.build

This was intended as a proof of concept; build seems to be the correct replacement.

See https://github.com/pypa/pep517/pull/83

* docs: updates from @wjakob

* refactor: dual version locations

* docs: typo spotted by @wjakob
2020-09-16 17:13:41 -04:00
Griffin Downs
a4cee36b6f
Add vcpkg installation instructions (#1936)
* Add vcpkg installation instructions

* Casing

* Move instructions

Co-authored-by: Henry Fredrick Schreiner <henry.fredrick.schreiner@cern.ch>
2020-09-16 08:07:06 -04:00
Wenzel Jakob
36c666f027 pybind11_add_module(): OPT_SIZE target 2020-09-06 16:46:38 +02:00
Henry Schreiner
1729aae96f
feat: new FindPython support (#2370)
* feat: FindPython support

* refactor: rename to PYBIND11_FINDPYTHON

* docs: Caps fixes

* feat: NOPYTHON mode

* test: check simple call

* docs: add changelog/upgrade guide

* feat: Support Python3 and Python2

* refactor: Use targets in tests

* fix: support CMake 3.4+

* feat: classic search also finds virtual environments

* docs: some updates from @wjakob's review

* fix: wrong name for QUIET mode variable, reported by @skoslowski

* refactor: cleaner output messaging

* fix: support debug Python's in FindPython mode too

* fixup! refactor: cleaner output messaging

* fix: missing pybind11_FOUND and pybind11_INCLUDE_DIR restored to subdir mode

* fix: nicer reporting of Python / PyPy

* fix: out-of-order variable fix

* docs: minor last-minute cleanup
2020-08-19 12:26:26 -04:00
Dustin Spicuzza
6f3470f757
Add robotpy-build to list of tools (#2359) 2020-08-10 16:10:45 -04:00
Henry Schreiner
1651c32492 update: address review points 2020-07-30 20:27:55 -04:00
Henry Schreiner
1b92cd1703 fix: address review points from @YannickJadoul 2020-07-30 20:27:55 -04:00
Henry Schreiner
6ec1775fff feat: drop CMake 3.6 and below, modernize CMake
fix: include PYTHON_IS_DEBUG
2020-07-30 20:27:55 -04:00
Dustin Spicuzza
2c4cd8419d Add AutoWIG to list of binding generators (#1990)
* Add AutoWIG to list of binding generators
2020-04-26 18:40:54 +02:00
Axel Huebl
6ebfc4b2b0 Document CMAKE_CXX_STANDARD
This variable is a CMake community standard to set the C++
standard of a build. Document it in favor of the previous variable,
which stays as a legacy flag for existing projects.

https://cmake.org/cmake/help/v3.17/variable/CMAKE_CXX_STANDARD.html
2020-04-26 09:17:10 +02:00
nstelzen
c251434011 Added note in documentation regarding make install (#1801)
* Added note regarding make install
2019-06-10 16:35:36 +02:00
Axel Huebl
435dbdd114 add_module: allow include as SYSTEM (#1416)
pybind11 headers passed via the `pybind11_add_module` CMake
function can now be included as `SYSTEM` includes (`-isystem`).

This allows to set stricter (or experimental) warnings in
calling projects that might throw otherwise in headers
a user of pybind11 can not influence.
2018-08-29 13:20:11 +02:00
Ivan Smirnov
5cbfda5b68 Update build commands for Linux / OS X in the docs (#907) 2017-08-30 21:58:43 +02:00
Dean Moldovan
8665ee8100 Fix documentation build
* Doxygen needs `RECURSIVE = YES` in order to parse the `detail` subdir.

* The `-W` warnings-as-errors option for sphinx doesn't work with the
  makefile build. Switched to calling sphinx directly.

* Fix "citation [cppimport] is not referenced" warning.
2017-08-17 15:10:51 +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
8f6c129689 Fix CMake example code in embedding docs
[skip ci]
2017-05-31 13:49:27 +02:00
Dean Moldovan
6d2411f1ac Add tutorial page for embedding the interpreter 2017-05-28 02:12:24 +02:00
Jason Rhinelander
77710ff01c Make PYBIND11_CPP_STANDARD work under MSVC
Under MSVC we were ignoring PYBIND11_CPP_STANDARD and simply not
passing any standard (which makes MSVC default to its C++14 mode).

MSVC 2015u3 added the `/std:c++14` and `/std:c++latest` flags; the
latter, under MSVC 2017, enables some C++17 features (such as
`std::optional` and `std::variant`), so it is something we need to
start supporting under MSVC.

This makes the PYBIND11_CPP_STANDARD cmake variable work under MSVC,
defaulting it to /std:c++14 (matching the default -std=c++14 for
non-MSVC).

It also adds a new appveyor test running under MSVC 2017 with
/std:c++latest, which runs (and passes) the
`std::optional`/`std::variant` tests.

Also updated the documentation to clarify the c++ flags and add show
MSVC flag examples.
2017-05-09 16:41:47 -04:00
Wenzel Jakob
f3de2d5521 reference binder project from documentation 2016-12-26 13:54:50 +01:00
Dean Moldovan
71e8a7962c Rename target from pybind11::pybind11 to pybind11::module
Makes room for an eventual pybind11::embedded target.
2016-12-19 16:34:48 +01:00
Dean Moldovan
0cbec5c96e Add new options and docs for pybind11_add_module
See the documentation for a description of the options.
2016-12-19 16:34:48 +01:00
Lori A. Burns
f4b81b36bf reflow some docs paragraphs 2016-12-13 21:44:19 +01:00
Lori A. Burns
5cafc99884 add CMake exported interface library and Config detection file 2016-12-13 21:44:19 +01:00