Commit Graph

427 Commits

Author SHA1 Message Date
Wenzel Jakob
9bb97c1b96 docs: added a general note about macro usage 2016-06-03 11:19:50 +02:00
Wenzel Jakob
99279f7107 docs: switched lexer for python console snippets to 'pycon' 2016-06-03 11:19:50 +02:00
Wenzel Jakob
38d8b8cfe2 don't allow registering a class twice (fixes #218) 2016-05-31 09:53:28 +02:00
Wenzel Jakob
1503d2fb50 Merge pull request #207 from dean0x7d/cmake
Simplify CMake build using add_subdirectory
2016-05-29 12:29:36 +02:00
Dean Moldovan
24ddf4b3f1 Update CMake build documentation 2016-05-27 00:11:52 +02:00
Wenzel Jakob
2c76c693f6 minor update to release process 2016-05-26 16:50:15 +02:00
Wenzel Jakob
6e2e0e9821 Merge pull request #214 from yungyuc/yyc-docver
Update document version to the next release 1.8
2016-05-26 16:48:28 +02:00
Yung-Yu Chen
2240ce2adf Update document version to the next release 1.8 2016-05-26 22:32:41 +08:00
Wenzel Jakob
86d825f330 Redesigned virtual call mechanism and user-facing syntax (breaking change!)
Sergey Lyskov pointed out that the trampoline mechanism used to override
virtual methods from within Python caused unnecessary overheads when
instantiating the original (i.e. non-extended) class.

This commit removes this inefficiency, but some syntax changes were
needed to achieve this. Projects using this features will need to make a
few changes:

In particular, the example below shows the old syntax to instantiate a
class with a trampoline:

class_<TrampolineClass>("MyClass")
    .alias<MyClass>()
    ....

This is what should be used now:

class_<MyClass, std::unique_ptr<MyClass, TrampolineClass>("MyClass")
    ....

Importantly, the trampoline class is now specified as the *third*
argument to the class_ template, and the alias<..>() call is gone. The
second argument with the unique pointer is simply the default holder
type used by pybind11.
2016-05-26 13:36:24 +02:00
Wenzel Jakob
1e3be73a52 PYBIND11_OVERLOAD_NAME and PYBIND11_OVERLOAD_PURE_NAME (fixes #205) 2016-05-24 23:42:14 +02:00
Wenzel Jakob
bd986fe57e add comment about macro issues (fixes #203) 2016-05-21 10:48:30 +02:00
Wenzel Jakob
b47a9de035 ability to prevent force casts in numpy arguments 2016-05-19 16:02:09 +02:00
Nils Werner
f7048f25b1 Fixed typo in NumPy example which prevented compilation 2016-05-19 11:17:17 +02:00
Wenzel Jakob
3f200fab22 don't implicitly convert doubles to ints 2016-05-17 15:35:29 +02:00
Wenzel Jakob
a439ccaa0e minor FAQ edits, referenced cppimport project 2016-05-17 10:47:52 +02:00
Sergey Lyskov
a95bde1ea5 Adding documentation for value_error. Fixing various formatting issues. Removing redundant binding for C++ style methods. Adding bindings for iterator and slicing protocol. Extending examples. 2016-05-15 20:46:07 +02:00
Wenzel Jakob
178c8a899d nicer type_caster::load() calling conventions 2016-05-15 20:23:27 +02:00
Wenzel Jakob
ace7b4386e switched to conda-forge, updated release process docs 2016-05-10 13:09:33 +01:00
Wenzel Jakob
9e0a0568fe transparent conversion of dense and sparse Eigen types 2016-05-05 21:44:29 +02:00
Wenzel Jakob
9ac5bc5531 fix captialization issue in CMakeLists.txt 2016-05-05 16:27:13 +02:00
Wenzel Jakob
e762853bba nicer example on instantiating Eigen matrices 2016-05-05 11:07:54 +02:00
Wenzel Jakob
f1032df891 only do numpy contiguous C/Fortran array conversion when explicitly requested 2016-05-05 10:00:00 +02:00
Wenzel Jakob
876eeab4ca redesigned format_descriptor<> and npy_format_descriptor<>
This somewhat heavyweight solution will avoid size_t/long long/long/int
mismatches on various platforms once and for all. The previous template
overloads could e.g. not handle size_t on Darwin.

One gotcha: the 'format_descriptor<T>::value()' syntax changed to just
'format_descriptor<T>::value'
2016-05-04 22:36:57 +02:00
Wenzel Jakob
c62360d994 minor FAQ updates 2016-05-03 14:32:47 +02:00
Wenzel Jakob
163ac2ef53 changelog updates 2016-05-03 14:16:18 +02:00
Wenzel Jakob
bdd11030c2 minor cmake improvements on windows 2016-05-01 13:11:54 +02:00
Wenzel Jakob
8e93df825e minor clarification regarding keep_alive; fixed some typos 2016-05-01 02:36:58 +02:00
Wenzel Jakob
81e0975b82 clarified pickle version requirements (fixes #186) 2016-04-30 23:16:31 +02:00
Wenzel Jakob
c4d7ccd8b0 started working on v1.8 2016-04-30 22:00:44 +02:00
Wenzel Jakob
e70b2abb6d preparing for v1.7 release 2016-04-30 22:00:24 +02:00
Wenzel Jakob
dd7ec34d50 documentation updates 2016-04-29 10:06:24 +02:00
Wenzel Jakob
06f56ee1e9 opaque type redesign 2016-04-28 17:49:46 +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
1ac22e35e3 changelog updates 2016-04-25 23:25:40 +02:00
Wenzel Jakob
f7b5874ca3 new move value policy 2016-04-25 23:04:27 +02:00
Wenzel Jakob
0871228f42 opaque<> clarifications 2016-04-22 16:52:15 +02:00
Wenzel Jakob
54b6fdd43d starting work on the v1.6 release 2016-04-21 12:29:17 +02:00
Wenzel Jakob
bb79d7bdc0 preparing for version 1.5 release 2016-04-21 12:23:20 +02:00
Wenzel Jakob
dbe43ffcce completed implicit type casters for reference_wrapper 2016-04-21 12:21:14 +02:00
Wenzel Jakob
c79dbe425d FAQ improvements 2016-04-18 10:53:38 +02:00
Wenzel Jakob
b2b44a9af8 fix for virtual dispatch on newly created threads 2016-04-15 17:59:53 +02:00
Wenzel Jakob
8bd31c71e4 New automatic return value policy for cat() and make_tuple(), fixed an ambiguity issue 2016-04-14 15:00:30 +02:00
Wenzel Jakob
2e03a5857c added comment about cmake issues (#99) 2016-04-14 11:27:15 +02:00
Wenzel Jakob
b282595bba convenience wrapper for constructing iterators (fixes #142) 2016-04-14 00:23:37 +02:00
Wenzel Jakob
ef7a9b9a3f added info about autogenerated Sphinx docs (fixes #112) 2016-04-13 18:41:59 +02:00
Wenzel Jakob
d7efa4ff7b return best representation of polymorphic types (fixes #105) 2016-04-13 13:51:33 +02:00
Wenzel Jakob
d40885a1e6 clarified pickling docs 2016-04-13 13:30:05 +02:00
Wenzel Jakob
3d0e6fff25 typos 2016-04-13 11:48:10 +02:00
Wenzel Jakob
1c329aab5a pickling support (fixes #144) 2016-04-13 02:58:56 +02:00
Wenzel Jakob
2c5d560640 changelog update 2016-04-11 18:46:11 +02:00
Wenzel Jakob
50ed3614de added a faq entry about import issues 2016-04-11 17:38:25 +02:00
Wenzel Jakob
90d2f5e2fc added a comment about symbol visibility 2016-04-11 14:30:11 +02:00
Wenzel Jakob
978e376e57 documentation improvements 2016-04-07 18:00:41 +02:00
Wenzel Jakob
1e1f3675cd added limitations section 2016-04-07 10:31:01 +02:00
Wenzel Jakob
33c2a0494f minor documentation update 2016-04-07 09:06:49 +02:00
Wenzel Jakob
95dc0695b7 starting work on version 1.5 2016-04-07 08:59:15 +02:00
Wenzel Jakob
0e6ca5916e version 1.4 2016-04-07 08:49:37 +02:00
Wenzel Jakob
3411673fbf updated changelog 2016-04-06 17:55:41 +02:00
Wenzel Jakob
9f0dfce84b returning unique pointers is now allowed 2016-04-06 17:38:18 +02:00
Wenzel Jakob
76eb607d4e completed type table 2016-03-21 17:53:39 +01:00
Wenzel Jakob
eda978e003 support for opaque types 2016-03-15 15:07:55 +01: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
Wenzel Jakob
4e455dde0b updated changelog, added build directory to gitignore file 2016-03-09 16:50:40 +01:00
Wenzel Jakob
14cefbf473 minor fix for conda release process 2016-03-09 09:56:37 +01:00
Sylvain Corlay
e6464ad843 Update release instructions 2016-03-08 19:37:24 -05:00
Wenzel Jakob
81dfd2c51f Working type casters for wide strings and wide characters 2016-03-08 20:48:07 +01:00
Wenzel Jakob
504f7553e3 starting to work on next version 2016-03-08 18:12:24 +01:00
Wenzel Jakob
d2385e8fc6 ready for version 1.3 2016-03-08 18:09:50 +01:00
Wenzel Jakob
8d862b37b4 documentation updates (clarified cross-module dependencies, added contributors, improved CSS) 2016-03-06 13:37:22 +01:00
Wenzel Jakob
c769fce280 note about nullptr default args 2016-03-03 12:03:30 +01:00
Wenzel Jakob
4f972c0039 Revert of the revert of the python package with version information
This reverts commit bee8f16dbb.
2016-03-01 10:37:37 +01:00
Wenzel Jakob
cf2b87aa5e changelog update 2016-02-22 17:32:44 +01:00
Wenzel Jakob
bee8f16dbb removed 'pybind11' package which ultimately served no purpose 2016-02-22 17:29:30 +01:00
Wenzel Jakob
240e4044aa added note about supported compiler versions 2016-02-20 21:01:47 +01:00
Wenzel Jakob
0880294924 support unordered set/map data structures (fixes #100) 2016-02-13 00:22:26 +01:00
Wenzel Jakob
8ed2808239 pybind11, version 1.2 2016-02-07 17:32:37 +01:00
Wenzel Jakob
43b6a23a89 minor comment about binding static methods 2016-02-07 17:24:41 +01:00
Wenzel Jakob
10c74c6f34 transparent std::array conversion (fixes #97) 2016-02-07 16:36:51 +01:00
Wenzel Jakob
c91551b33b improved python detection in CMakeLists.txt (fixes #98) 2016-02-07 15:57:14 +01:00
Wenzel Jakob
de3ad07899 documentation on exporting constants (closes #92) 2016-02-02 11:38:21 +01:00
Sylvain Corlay
97dc81057f Add version info and release instructions for pybind11 2016-02-01 10:23:52 -05:00
Wenzel Jakob
cd4e6ae3f0 updated changelog 2016-01-29 11:48:40 +01:00
Wenzel Jakob
518cf721d9 improve cmake windows debug configuration (fixes #77) 2016-01-21 19:17:58 +01:00
Wenzel Jakob
d4db8bc4bf minor cmake doc improvements 2016-01-20 01:26:44 +01:00
Wenzel Jakob
61587164ed example on manually vectorizing numpy code (closes #27) 2016-01-18 22:38:52 +01:00
Wenzel Jakob
48548ea4a5 general cleanup of the codebase
- new pybind11::base<> attribute to indicate a subclass relationship
- unified infrastructure for parsing variadic arguments in class_ and cpp_function
- use 'handle' and 'object' more consistently everywhere
2016-01-17 22:31:15 +01:00
Wenzel Jakob
1ae77fe4d3 added a changelog file and version defines 2016-01-17 22:31:15 +01:00
Wenzel Jakob
678d787ca4 do more work with classes from pytypes.h (especially for STL container casting) 2016-01-17 22:31:15 +01:00
Wenzel Jakob
b2c2c79240 improved handling of shared/smart pointers
Previously, pybind11 required classes using std::shared_ptr<> to derive
from std::enable_shared_from_this<> (or compilation failures would ensue).

Everything now also works for classes that don't do this, assuming that
some basic rules are followed (e.g. never passing "raw" pointers of
instances manged by shared pointers). The safer
std::enable_shared_from_this<> approach continues to be supported.
2016-01-17 22:31:15 +01:00
Wenzel Jakob
5f218b3f2c keep_alive call policy (analogous to Boost.Python's with_custodian_and_ward, fixes #62) 2016-01-17 22:31:15 +01:00
Wenzel Jakob
27e8e1066b added new type pybind11::bytes, cleanup of various macros (fixes #49) 2016-01-17 22:31:15 +01:00
Wenzel Jakob
2dfbadee5d documentation on using multiple extension modules 2016-01-17 22:31:15 +01:00
Wenzel Jakob
6eb11da94a Very minor documentation fixes, updated logo 2016-01-17 22:31:15 +01:00
Wenzel Jakob
66c9a40213 Much more efficient generation of function signatures, updated docs
This modification taps into some newer C++14 features (if present) to
generate function signatures considerably more efficiently at compile
time rather than at run time.

With this change, pybind11 binaries are now *2.1 times* smaller compared
to the Boost.Python baseline in the benchmark. Compilation times get a
nice improvement as well.

Visual Studio 2015 unfortunately doesn't implement 'constexpr' well
enough yet to support this change and uses a runtime fallback.
2016-01-17 22:31:15 +01:00
Wenzel Jakob
2ac5044a05 moved processing of cpp_function arguments out of dispatch code
The cpp_function class accepts a variadic argument, which was formerly
processed twice -- once at registration time, and once in the dispatch
lambda function. This is not only unnecessarily slow but also leads to
code bloat since it adds to the object code generated for every bound
function. This change removes the second pass at dispatch time.

One noteworthy change of this commit is that default arguments are now
constructed (and converted to Python objects) right at declaration time.
Consider the following example:

py::class_<MyClass>("MyClass")
    .def("myFunction", py::arg("arg") = SomeType(123));

In this case, the change means that pybind11 must already be set up to
deal with values of the type 'SomeType', or an exception will be thrown.
Another change is that the "preview" of the default argument in the
function signature is generated using the __repr__ special method. If
it is not available in this type, the signature may not be very helpful,
i.e.:

|  myFunction(...)
|      Signature : (MyClass, arg : SomeType = <SomeType object at 0x101b7b080>) -> None

One workaround (other than defining SomeType.__repr__) is to specify the
human-readable preview of the default argument manually using the more
cumbersome arg_t notation:

py::class_<MyClass>("MyClass")
    .def("myFunction", py::arg_t<SomeType>("arg", SomeType(123), "SomeType(123)"));
2016-01-17 22:31:15 +01:00
Wenzel Jakob
caa9d44cc7 cmake: robustified search for python 2016-01-17 22:31:15 +01:00
Ivan Smirnov
4f88edde14 Add an include in cmake.rst 2016-01-17 16:42:11 +00:00
Wenzel Jakob
f08a3f0622 Merge pull request #52 from tmiasko/const-correctness
Make handle and related classes const correct.
2016-01-10 21:34:55 +01:00
Tomasz Miąsko
ca77130be8 Use object class to hold partially converted python objects.
Using object class to hold converted object automatically deallocates
object if an exception is thrown or scope is left before constructing
complete Python object.

Additionally added method object::release() that allows to release
ownership of python object without decreasing its reference count.
2016-01-02 21:07:18 +01:00
Tomasz Miąsko
875df5528d Make handle and related classes const correct.
This gives handle classes a typical pointer semantics with respects to
constness.
2015-12-28 08:11:16 +01:00
Tomasz Miąsko
cc39b2f37f Add const modifier to handle::cast. 2015-12-26 19:01:28 +01:00
Jared Casper
6be9e2fff5 Fix typo in STL docs. 2015-12-15 15:56:14 -08:00
Wenzel Jakob
5ef1219030 smart pointer clarifications 2015-12-15 17:07:35 +01:00
Wenzel Jakob
61d67f0462 a few more documentation improvements 2015-12-14 12:53:06 +01:00
Wenzel Jakob
44db04f580 clarification regarding STL container support 2015-12-14 12:40:45 +01:00
Wenzel Jakob
a4caa85fc6 added missing namespace declaration 2015-12-14 12:39:02 +01:00
John Travers
f7e430292a Add ldflags to compile command
On my system (Mac OS with custom Python installation) I had to add the ldflags argument to python-config to get things working.
2015-12-12 22:58:23 +01:00
Wenzel Jakob
bda3b67dc5 add extra documentation CSS on RTD 2015-12-07 18:29:17 +01:00
Wenzel Jakob
f1532bd31c updated cmake snippet in documentation 2015-12-07 18:24:43 +01:00
Wenzel Jakob
ecdd868956 documentation on using the gil 2015-12-07 18:17:58 +01:00
Wenzel Jakob
40584ce8c5 fixed another typo 2015-12-04 23:58:23 +01:00
Wenzel Jakob
6e213c9ca0 improved shared pointer support (fixes #14) 2015-11-24 23:18:32 +01:00
Wenzel Jakob
a4175d6ea3 added warning about wrapping wrapped functions 2015-11-17 08:30:34 +01:00
Wenzel Jakob
436b731891 added note about cast operations 2015-10-20 01:04:30 +02:00
Wenzel Jakob
5cd3311c6c added benchmark 2015-10-20 00:59:59 +02:00
Wenzel Jakob
0fb8528edf factored out some common functionality to a non-templated parent class 2015-10-19 23:53:22 +02:00
Wenzel Jakob
b1b714023a consistent macro naming throughout the project 2015-10-18 16:48:30 +02:00
Wenzel Jakob
041a8656af minor documentation theme changes 2015-10-18 16:44:12 +02:00
Wenzel Jakob
1853b65ff1 a bit more documentation on reference counting wrappers 2015-10-18 15:38:50 +02:00
Wenzel Jakob
7641c1dd11 minor doc update 2015-10-18 15:08:57 +02:00
Wenzel Jakob
10e62e168b fixed missing semicolon in documentation 2015-10-15 22:46:07 +02:00
Wenzel Jakob
8f4eb00690 last breaking change: be consistent about the project name 2015-10-15 18:23:56 +02:00
Wenzel Jakob
9329669683 remainder of documentation 2015-10-13 23:21:54 +02:00
Wenzel Jakob
28f98aa298 took a stab at some documentation 2015-10-13 03:16:44 +02:00