1.. _changelog: 2 3Changelog 4######### 5
| 1.. _changelog: 2 3Changelog 4######### 5
|
6Starting with version 1.8, pybind11 releases use a 7[semantic versioning](http://semver.org) policy.
| 6Starting with version 1.8.0, pybind11 releases use a `semantic versioning 7<http://semver.org>`_ policy.
|
8
| 8
|
9Breaking changes queued for v2.0.0 (Not yet released)
| 9 10v2.1.1 (April 7, 2017)
|
10-----------------------------------------------------
| 11-----------------------------------------------------
|
11* Redesigned virtual call mechanism and user-facing syntax (see 12 https://github.com/pybind/pybind11/commit/86d825f3302701d81414ddd3d38bcd09433076bc)
| |
13
| 12
|
14* Remove ``handle.call()`` method
| 13* Fixed minimum version requirement for MSVC 2015u3 14 `#773 <https://github.com/pybind/pybind11/pull/773>`_.
|
15
| 15
|
161.9.0 (Not yet released) 17------------------------ 18* Queued changes: map indexing suite, documentation for indexing suites. 19* Mapping a stateless C++ function to Python and back is now "for free" (i.e. no call overheads) 20* Support for translation of arbitrary C++ exceptions to Python counterparts
| 16v2.1.0 (March 22, 2017) 17----------------------------------------------------- 18 19* pybind11 now performs function overload resolution in two phases. The first 20 phase only considers exact type matches, while the second allows for implicit 21 conversions to take place. A special ``noconvert()`` syntax can be used to 22 completely disable implicit conversions for specific arguments. 23 `#643 <https://github.com/pybind/pybind11/pull/643>`_, 24 `#634 <https://github.com/pybind/pybind11/pull/634>`_, 25 `#650 <https://github.com/pybind/pybind11/pull/650>`_. 26 27* Fixed a regression where static properties no longer worked with classes 28 using multiple inheritance. The ``py::metaclass`` attribute is no longer 29 necessary (and deprecated as of this release) when binding classes with 30 static properties. 31 `#679 <https://github.com/pybind/pybind11/pull/679>`_, 32 33* Classes bound using ``pybind11`` can now use custom metaclasses. 34 `#679 <https://github.com/pybind/pybind11/pull/679>`_, 35 36* ``py::args`` and ``py::kwargs`` can now be mixed with other positional 37 arguments when binding functions using pybind11. 38 `#611 <https://github.com/pybind/pybind11/pull/611>`_. 39 40* Improved support for C++11 unicode string and character types; added 41 extensive documentation regarding pybind11's string conversion behavior. 42 `#624 <https://github.com/pybind/pybind11/pull/624>`_, 43 `#636 <https://github.com/pybind/pybind11/pull/636>`_, 44 `#715 <https://github.com/pybind/pybind11/pull/715>`_. 45 46* pybind11 can now avoid expensive copies when converting Eigen arrays to NumPy 47 arrays (and vice versa). `#610 <https://github.com/pybind/pybind11/pull/610>`_. 48 49* The "fast path" in ``py::vectorize`` now works for any full-size group of C or 50 F-contiguous arrays. The non-fast path is also faster since it no longer performs 51 copies of the input arguments (except when type conversions are necessary). 52 `#610 <https://github.com/pybind/pybind11/pull/610>`_. 53 54* Added fast, unchecked access to NumPy arrays via a proxy object. 55 `#746 <https://github.com/pybind/pybind11/pull/746>`_. 56 57* Transparent support for class-specific ``operator new`` and 58 ``operator delete`` implementations. 59 `#755 <https://github.com/pybind/pybind11/pull/755>`_. 60 61* Slimmer and more efficient STL-compatible iterator interface for sequence types. 62 `#662 <https://github.com/pybind/pybind11/pull/662>`_. 63 64* Improved custom holder type support. 65 `#607 <https://github.com/pybind/pybind11/pull/607>`_. 66 67* ``nullptr`` to ``None`` conversion fixed in various builtin type casters. 68 `#732 <https://github.com/pybind/pybind11/pull/732>`_. 69 70* ``enum_`` now exposes its members via a special ``__members__`` attribute. 71 `#666 <https://github.com/pybind/pybind11/pull/666>`_. 72 73* ``std::vector`` bindings created using ``stl_bind.h`` can now optionally 74 implement the buffer protocol. `#488 <https://github.com/pybind/pybind11/pull/488>`_. 75 76* Automated C++ reference documentation using doxygen and breathe. 77 `#598 <https://github.com/pybind/pybind11/pull/598>`_. 78 79* Added minimum compiler version assertions. 80 `#727 <https://github.com/pybind/pybind11/pull/727>`_. 81 82* Improved compatibility with C++1z. 83 `#677 <https://github.com/pybind/pybind11/pull/677>`_. 84 85* Improved ``py::capsule`` API. Can be used to implement cleanup 86 callbacks that are involved at module destruction time. 87 `#752 <https://github.com/pybind/pybind11/pull/752>`_. 88 89* Various minor improvements and fixes. 90 `#595 <https://github.com/pybind/pybind11/pull/595>`_, 91 `#588 <https://github.com/pybind/pybind11/pull/588>`_, 92 `#589 <https://github.com/pybind/pybind11/pull/589>`_, 93 `#603 <https://github.com/pybind/pybind11/pull/603>`_, 94 `#619 <https://github.com/pybind/pybind11/pull/619>`_, 95 `#648 <https://github.com/pybind/pybind11/pull/648>`_, 96 `#695 <https://github.com/pybind/pybind11/pull/695>`_, 97 `#720 <https://github.com/pybind/pybind11/pull/720>`_, 98 `#723 <https://github.com/pybind/pybind11/pull/723>`_, 99 `#729 <https://github.com/pybind/pybind11/pull/729>`_, 100 `#724 <https://github.com/pybind/pybind11/pull/724>`_, 101 `#742 <https://github.com/pybind/pybind11/pull/742>`_, 102 `#753 <https://github.com/pybind/pybind11/pull/753>`_. 103 104v2.0.1 (Jan 4, 2017) 105----------------------------------------------------- 106 107* Fix pointer to reference error in type_caster on MSVC 108 `#583 <https://github.com/pybind/pybind11/pull/583>`_. 109 110* Fixed a segmentation in the test suite due to a typo 111 `cd7eac <https://github.com/pybind/pybind11/commit/cd7eac>`_. 112 113v2.0.0 (Jan 1, 2017) 114----------------------------------------------------- 115 116* Fixed a reference counting regression affecting types with custom metaclasses 117 (introduced in v2.0.0-rc1). 118 `#571 <https://github.com/pybind/pybind11/pull/571>`_. 119 120* Quenched a CMake policy warning. 121 `#570 <https://github.com/pybind/pybind11/pull/570>`_. 122 123v2.0.0-rc1 (Dec 23, 2016) 124----------------------------------------------------- 125 126The pybind11 developers are excited to issue a release candidate of pybind11 127with a subsequent v2.0.0 release planned in early January next year. 128 129An incredible amount of effort by went into pybind11 over the last ~5 months, 130leading to a release that is jam-packed with exciting new features and numerous 131usability improvements. The following list links PRs or individual commits 132whenever applicable. 133 134Happy Christmas! 135 136* Support for binding C++ class hierarchies that make use of multiple 137 inheritance. `#410 <https://github.com/pybind/pybind11/pull/410>`_. 138 139* PyPy support: pybind11 now supports nightly builds of PyPy and will 140 interoperate with the future 5.7 release. No code changes are necessary, 141 everything "just" works as usual. Note that we only target the Python 2.7 142 branch for now; support for 3.x will be added once its ``cpyext`` extension 143 support catches up. A few minor features remain unsupported for the time 144 being (notably dynamic attributes in custom types). 145 `#527 <https://github.com/pybind/pybind11/pull/527>`_. 146 147* Significant work on the documentation -- in particular, the monolitic 148 ``advanced.rst`` file was restructured into a easier to read hierarchical 149 organization. `#448 <https://github.com/pybind/pybind11/pull/448>`_. 150 151* Many NumPy-related improvements: 152 153 1. Object-oriented API to access and modify NumPy ``ndarray`` instances, 154 replicating much of the corresponding NumPy C API functionality. 155 `#402 <https://github.com/pybind/pybind11/pull/402>`_. 156 157 2. NumPy array ``dtype`` array descriptors are now first-class citizens and 158 are exposed via a new class ``py::dtype``. 159 160 3. Structured dtypes can be registered using the ``PYBIND11_NUMPY_DTYPE()`` 161 macro. Special ``array`` constructors accepting dtype objects were also 162 added. 163 164 One potential caveat involving this change: format descriptor strings 165 should now be accessed via ``format_descriptor::format()`` (however, for 166 compatibility purposes, the old syntax ``format_descriptor::value`` will 167 still work for non-structured data types). `#308 168 <https://github.com/pybind/pybind11/pull/308>`_. 169 170 4. Further improvements to support structured dtypes throughout the system. 171 `#472 <https://github.com/pybind/pybind11/pull/472>`_, 172 `#474 <https://github.com/pybind/pybind11/pull/474>`_, 173 `#459 <https://github.com/pybind/pybind11/pull/459>`_, 174 `#453 <https://github.com/pybind/pybind11/pull/453>`_, 175 `#452 <https://github.com/pybind/pybind11/pull/452>`_, and 176 `#505 <https://github.com/pybind/pybind11/pull/505>`_. 177 178 5. Fast access operators. `#497 <https://github.com/pybind/pybind11/pull/497>`_. 179 180 6. Constructors for arrays whose storage is owned by another object. 181 `#440 <https://github.com/pybind/pybind11/pull/440>`_. 182 183 7. Added constructors for ``array`` and ``array_t`` explicitly accepting shape 184 and strides; if strides are not provided, they are deduced assuming 185 C-contiguity. Also added simplified constructors for 1-dimensional case. 186 187 8. Added buffer/NumPy support for ``char[N]`` and ``std::array<char, N>`` types. 188 189 9. Added ``memoryview`` wrapper type which is constructible from ``buffer_info``. 190 191* Eigen: many additional conversions and support for non-contiguous 192 arrays/slices. 193 `#427 <https://github.com/pybind/pybind11/pull/427>`_, 194 `#315 <https://github.com/pybind/pybind11/pull/315>`_, 195 `#316 <https://github.com/pybind/pybind11/pull/316>`_, 196 `#312 <https://github.com/pybind/pybind11/pull/312>`_, and 197 `#267 <https://github.com/pybind/pybind11/pull/267>`_ 198 199* Incompatible changes in ``class_<...>::class_()``: 200 201 1. Declarations of types that provide access via the buffer protocol must 202 now include the ``py::buffer_protocol()`` annotation as an argument to 203 the ``class_`` constructor. 204 205 2. Declarations of types that require a custom metaclass (i.e. all classes 206 which include static properties via commands such as 207 ``def_readwrite_static()``) must now include the ``py::metaclass()`` 208 annotation as an argument to the ``class_`` constructor. 209 210 These two changes were necessary to make type definitions in pybind11 211 future-proof, and to support PyPy via its cpyext mechanism. `#527 212 <https://github.com/pybind/pybind11/pull/527>`_. 213 214 215 3. This version of pybind11 uses a redesigned mechnism for instantiating 216 trempoline classes that are used to override virtual methods from within 217 Python. This led to the following user-visible syntax change: instead of 218 219 .. code-block:: cpp 220 221 py::class_<TrampolineClass>("MyClass") 222 .alias<MyClass>() 223 .... 224 225 write 226 227 .. code-block:: cpp 228 229 py::class_<MyClass, TrampolineClass>("MyClass") 230 .... 231 232 Importantly, both the original and the trampoline class are now 233 specified as an arguments (in arbitrary order) to the ``py::class_`` 234 template, and the ``alias<..>()`` call is gone. The new scheme has zero 235 overhead in cases when Python doesn't override any functions of the 236 underlying C++ class. `rev. 86d825 237 <https://github.com/pybind/pybind11/commit/86d825>`_. 238
|
21* Added ``eval`` and ``eval_file`` functions for evaluating expressions and
| 239* Added ``eval`` and ``eval_file`` functions for evaluating expressions and
|
22 statements from a string or file 23* eigen.h type converter fixed for non-contiguous arrays (e.g. slices) 24* Print more informative error messages when ``make_tuple()`` or ``cast()`` fail 25* ``std::enable_shared_from_this<>`` now also works for ``const`` values 26* A return value policy can now be passed to ``handle::operator()`` 27* ``make_iterator()`` improvements for better compatibility with various types 28 (now uses prefix increment operator); it now also accepts iterators with 29 different begin/end types as long as they are equality comparable. 30* ``arg()`` now accepts a wider range of argument types for default values 31* Added ``py::repr()`` function which is equivalent to Python's builtin ``repr()``. 32* Added support for registering structured dtypes via ``PYBIND11_NUMPY_DTYPE()`` macro. 33* Added ``PYBIND11_STR_TYPE`` macro which maps to the ``builtins.str`` type. 34* Added a simplified ``buffer_info`` constructor for 1-dimensional buffers. 35* Format descriptor strings should now be accessed via ``format_descriptor::format()`` 36 (for compatibility purposes, the old syntax ``format_descriptor::value`` will still 37 work for non-structured data types). 38* Added a class wrapping NumPy array descriptors: ``dtype``. 39* Added buffer/NumPy support for ``char[N]`` and ``std::array<char, N>`` types. 40* ``array`` gained new constructors accepting dtype objects. 41* Added constructors for ``array`` and ``array_t`` explicitly accepting shape and 42 strides; if strides are not provided, they are deduced assuming C-contiguity. 43 Also added simplified constructors for 1-dimensional case. 44* Added constructors for ``str`` from ``bytes`` and for ``bytes`` from ``str``. 45 This will do the UTF-8 decoding/encoding as required. 46* Added constructors for ``str`` and ``bytes`` from zero-terminated char pointers, 47 and from char pointers and length. 48* Added ``memoryview`` wrapper type which is constructible from ``buffer_info``. 49* New syntax to call a Python function from C++ using keyword arguments and unpacking, 50 e.g. ``foo(1, 2, "z"_a=3)`` or ``bar(1, *args, "z"_a=3, **kwargs)``. 51* Added ``py::print()`` function which replicates Python's API and writes to Python's 52 ``sys.stdout`` by default (as opposed to C's ``stdout`` like ``std::cout``). 53* Added ``py::dict`` keyword constructor:``auto d = dict("number"_a=42, "name"_a="World");`` 54* Added ``py::str::format()`` method and ``_s`` literal: 55 ``py::str s = "1 + 2 = {}"_s.format(3);`` 56* Attribute and item accessors now have a more complete interface which makes it possible 57 to chain attributes ``obj.attr("a")[key].attr("b").attr("method")(1, 2, 3)```. 58* Added built-in support for ``std::shared_ptr`` holder type. There is no more need 59 to do it manually via ``PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>)``. 60* Default return values policy changes: non-static properties now use ``reference_internal`` 61 and static properties use ``reference`` (previous default was ``automatic``, i.e. ``copy``). 62* Support for ``std::experimental::optional<T>`` and ``std::optional<T>`` (C++17). 63* Various minor improvements of library internals (no user-visible changes)
| 240 statements from a string or file. `rev. 0d3fc3 241 <https://github.com/pybind/pybind11/commit/0d3fc3>`_.
|
64
| 242
|
| 243* pybind11 can now create types with a modifiable dictionary. 244 `#437 <https://github.com/pybind/pybind11/pull/437>`_ and 245 `#444 <https://github.com/pybind/pybind11/pull/444>`_. 246 247* Support for translation of arbitrary C++ exceptions to Python counterparts. 248 `#296 <https://github.com/pybind/pybind11/pull/296>`_ and 249 `#273 <https://github.com/pybind/pybind11/pull/273>`_. 250 251* Report full backtraces through mixed C++/Python code, better reporting for 252 import errors, fixed GIL management in exception processing. 253 `#537 <https://github.com/pybind/pybind11/pull/537>`_, 254 `#494 <https://github.com/pybind/pybind11/pull/494>`_, 255 `rev. e72d95 <https://github.com/pybind/pybind11/commit/e72d95>`_, and 256 `rev. 099d6e <https://github.com/pybind/pybind11/commit/099d6e>`_. 257 258* Support for bit-level operations, comparisons, and serialization of C++ 259 enumerations. `#503 <https://github.com/pybind/pybind11/pull/503>`_, 260 `#508 <https://github.com/pybind/pybind11/pull/508>`_, 261 `#380 <https://github.com/pybind/pybind11/pull/380>`_, 262 `#309 <https://github.com/pybind/pybind11/pull/309>`_. 263 `#311 <https://github.com/pybind/pybind11/pull/311>`_. 264 265* The ``class_`` constructor now accepts its template arguments in any order. 266 `#385 <https://github.com/pybind/pybind11/pull/385>`_. 267 268* Attribute and item accessors now have a more complete interface which makes 269 it possible to chain attributes as in 270 ``obj.attr("a")[key].attr("b").attr("method")(1, 2, 3)``. `#425 271 <https://github.com/pybind/pybind11/pull/425>`_. 272 273* Major redesign of the default and conversion constructors in ``pytypes.h``. 274 `#464 <https://github.com/pybind/pybind11/pull/464>`_. 275 276* Added built-in support for ``std::shared_ptr`` holder type. It is no longer 277 necessary to to include a declaration of the form 278 ``PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>)`` (though continuing to 279 do so won't cause an error). 280 `#454 <https://github.com/pybind/pybind11/pull/454>`_. 281 282* New ``py::overload_cast`` casting operator to select among multiple possible 283 overloads of a function. An example: 284 285 .. code-block:: cpp 286 287 py::class_<Pet>(m, "Pet") 288 .def("set", py::overload_cast<int>(&Pet::set), "Set the pet's age") 289 .def("set", py::overload_cast<const std::string &>(&Pet::set), "Set the pet's name"); 290 291 This feature only works on C++14-capable compilers. 292 `#541 <https://github.com/pybind/pybind11/pull/541>`_. 293 294* C++ types are automatically cast to Python types, e.g. when assigning 295 them as an attribute. For instance, the following is now legal: 296 297 .. code-block:: cpp 298 299 py::module m = /* ... */ 300 m.attr("constant") = 123; 301 302 (Previously, a ``py::cast`` call was necessary to avoid a compilation error.) 303 `#551 <https://github.com/pybind/pybind11/pull/551>`_. 304 305* Redesigned ``pytest``-based test suite. `#321 <https://github.com/pybind/pybind11/pull/321>`_. 306 307* Instance tracking to detect reference leaks in test suite. `#324 <https://github.com/pybind/pybind11/pull/324>`_ 308 309* pybind11 can now distinguish between multiple different instances that are 310 located at the same memory address, but which have different types. 311 `#329 <https://github.com/pybind/pybind11/pull/329>`_. 312 313* Improved logic in ``move`` return value policy. 314 `#510 <https://github.com/pybind/pybind11/pull/510>`_, 315 `#297 <https://github.com/pybind/pybind11/pull/297>`_. 316 317* Generalized unpacking API to permit calling Python functions from C++ using 318 notation such as ``foo(a1, a2, *args, "ka"_a=1, "kb"_a=2, **kwargs)``. `#372 <https://github.com/pybind/pybind11/pull/372>`_. 319 320* ``py::print()`` function whose behavior matches that of the native Python 321 ``print()`` function. `#372 <https://github.com/pybind/pybind11/pull/372>`_. 322 323* Added ``py::dict`` keyword constructor:``auto d = dict("number"_a=42, 324 "name"_a="World");``. `#372 <https://github.com/pybind/pybind11/pull/372>`_. 325 326* Added ``py::str::format()`` method and ``_s`` literal: ``py::str s = "1 + 2 327 = {}"_s.format(3);``. `#372 <https://github.com/pybind/pybind11/pull/372>`_. 328 329* Added ``py::repr()`` function which is equivalent to Python's builtin 330 ``repr()``. `#333 <https://github.com/pybind/pybind11/pull/333>`_. 331 332* Improved construction and destruction logic for holder types. It is now 333 possible to reference instances with smart pointer holder types without 334 constructing the holder if desired. The ``PYBIND11_DECLARE_HOLDER_TYPE`` 335 macro now accepts an optional second parameter to indicate whether the holder 336 type uses intrusive reference counting. 337 `#533 <https://github.com/pybind/pybind11/pull/533>`_ and 338 `#561 <https://github.com/pybind/pybind11/pull/561>`_. 339 340* Mapping a stateless C++ function to Python and back is now "for free" (i.e. 341 no extra indirections or argument conversion overheads). `rev. 954b79 342 <https://github.com/pybind/pybind11/commit/954b79>`_. 343 344* Bindings for ``std::valarray<T>``. 345 `#545 <https://github.com/pybind/pybind11/pull/545>`_. 346 347* Improved support for C++17 capable compilers. 348 `#562 <https://github.com/pybind/pybind11/pull/562>`_. 349 350* Bindings for ``std::optional<t>``. 351 `#475 <https://github.com/pybind/pybind11/pull/475>`_, 352 `#476 <https://github.com/pybind/pybind11/pull/476>`_, 353 `#479 <https://github.com/pybind/pybind11/pull/479>`_, 354 `#499 <https://github.com/pybind/pybind11/pull/499>`_, and 355 `#501 <https://github.com/pybind/pybind11/pull/501>`_. 356 357* ``stl_bind.h``: general improvements and support for ``std::map`` and 358 ``std::unordered_map``. 359 `#490 <https://github.com/pybind/pybind11/pull/490>`_, 360 `#282 <https://github.com/pybind/pybind11/pull/282>`_, 361 `#235 <https://github.com/pybind/pybind11/pull/235>`_. 362 363* The ``std::tuple``, ``std::pair``, ``std::list``, and ``std::vector`` type 364 casters now accept any Python sequence type as input. `rev. 107285 365 <https://github.com/pybind/pybind11/commit/107285>`_. 366 367* Improved CMake Python detection on multi-architecture Linux. 368 `#532 <https://github.com/pybind/pybind11/pull/532>`_. 369 370* Infrastructure to selectively disable or enable parts of the automatically 371 generated docstrings. `#486 <https://github.com/pybind/pybind11/pull/486>`_. 372 373* ``reference`` and ``reference_internal`` are now the default return value 374 properties for static and non-static properties, respectively. `#473 375 <https://github.com/pybind/pybind11/pull/473>`_. (the previous defaults 376 were ``automatic``). `#473 <https://github.com/pybind/pybind11/pull/473>`_. 377 378* Support for ``std::unique_ptr`` with non-default deleters or no deleter at 379 all (``py::nodelete``). `#384 <https://github.com/pybind/pybind11/pull/384>`_. 380 381* Deprecated ``handle::call()`` method. The new syntax to call Python 382 functions is simply ``handle()``. It can also be invoked explicitly via 383 ``handle::operator<X>()``, where ``X`` is an optional return value policy. 384 385* Print more informative error messages when ``make_tuple()`` or ``cast()`` 386 fail. `#262 <https://github.com/pybind/pybind11/pull/262>`_. 387 388* Creation of holder types for classes deriving from 389 ``std::enable_shared_from_this<>`` now also works for ``const`` values. 390 `#260 <https://github.com/pybind/pybind11/pull/260>`_. 391 392* ``make_iterator()`` improvements for better compatibility with various 393 types (now uses prefix increment operator); it now also accepts iterators 394 with different begin/end types as long as they are equality comparable. 395 `#247 <https://github.com/pybind/pybind11/pull/247>`_. 396 397* ``arg()`` now accepts a wider range of argument types for default values. 398 `#244 <https://github.com/pybind/pybind11/pull/244>`_. 399 400* Support ``keep_alive`` where the nurse object may be ``None``. `#341 401 <https://github.com/pybind/pybind11/pull/341>`_. 402 403* Added constructors for ``str`` and ``bytes`` from zero-terminated char 404 pointers, and from char pointers and length. Added constructors for ``str`` 405 from ``bytes`` and for ``bytes`` from ``str``, which will perform UTF-8 406 decoding/encoding as required. 407 408* Many other improvements of library internals without user-visible changes 409 410
|
651.8.1 (July 12, 2016) 66---------------------- 67* Fixed a rare but potentially very severe issue when the garbage collector ran 68 during pybind11 type creation. 69 701.8.0 (June 14, 2016) 71---------------------- 72* Redesigned CMake build system which exports a convenient
--- 150 unchanged lines hidden --- | 4111.8.1 (July 12, 2016) 412---------------------- 413* Fixed a rare but potentially very severe issue when the garbage collector ran 414 during pybind11 type creation. 415 4161.8.0 (June 14, 2016) 417---------------------- 418* Redesigned CMake build system which exports a convenient
--- 150 unchanged lines hidden --- |