Development history¶
Contributors¶
Thanks to all the people that have contributed patches, bug reports and suggestions:
- My wife - Yulia
- John Pallister
- Matthias Baas
- Allen Bierbaum
- Lakin Wecker
- Georgiy Dernovoy
- Gottfried Ganssauge
- Andy Miller
- Martin Preisler
- Meghana Haridev
- Julian Scheid
- Oliver Schweitzer
- Hernán Ordiales
- Bernd Fritzke
- Andrei Vermel
- Carsten( spom.spom )
- Pertti Kellomäki
- Benoît Leveau
- Nikolaus Rath
- Alan Birtles
- Minh-Tri Pham
- Aron Xu
- Mark Moll
Version 1.7¶
- Update due to changes in pygccxml 1.8.0.
- Performance improvements.
- Small documentation fixes.
Version 1.6¶
- Reorganize documentation, switch to readthedocs theme.
- Misc. small fixes.
Version 1.1¶
- Added support for Python 3.
- Added support for pygccxml 1.7 and castxml.
- Switched to setuptools instead of distutils.
Version 1.0.1 (unreleased)¶
The bug related to exposing free operators was fixed. Many thanks to Andrei Vermel.
Few bugs were fixed for 64Bit platform. Many thanks to Carsten.
ctypes
backend was introduced - Py++ is able to generate Python code, which usesctypes
package to call functions in DLLs or shared libraries.Massive refactoring, which preserve backward compatibility to previous releases, was done.
Indexing Suite V2 introduces few backward compatibility changes. The indexing suite became “headers only” library and doesn’t requier Boost.Python library patching. See “C++ containers support” document for more information.
Support for std::hash_map<…> and std::hash_set<…> containers was added.
The bug related to transformed virtual function was fixed. Many thanks to Pertti Kellomäki.
Thanks to Benoît Leveau, the “Function Transformation” documentation is much better now.
The following transformers were added:
inout_static_array
input_static_matrix
output_static_matrix
inout_static_matrix
Many thanks to Benoît Leveau.
Numerous bugs in “ctypes code generator” were fixed. Many thanks to Nikolaus Rath.
Thanks to Alan Birtles, for fixing a small issue on cygwin.
Thanks to Minh-Tri Pham, for reporting bug and providing patch for “from_address” transformer, on 64 bit platforms.
Thanks to Aron Xu, for pointing out that it is better to use “os.name”, instead of “sys.platform” for platform specific logic
Thanks to Scott Sturdivant, for reporting the bug, related to bit fields code generation. The bug was fixed.
Version 1.0¶
The algorithm, which calculates what member functions should be redefined in derived class wrappers, was improved. Many thanks to Julian Scheid for the bug fix.
The change explanation.
struct A{ virtual void foo() {} }; class B: public A{ };
Previous version of Py++ didn’t generate wrapper for class
B
, even thoughB
inheritsA
’s virtual function. Now if you have the following Python code:class C(B): def __init__( self ): B.__init__(self) def foo(self): print "C.foo"
then when
foo
is invoked on this instance on the C++ side of things, the Python code won’t be executed as the wrapper was missing.Warning! There is a possibility that your generated code will not work! Keep reading.
If you use “function transformation” functionality, than it is possible the generated code will NOT work. Consider the following example:
struct A{ virtual void foo(int& i) {/*do smth*/} }; class B: public A{ virtual void foo(int& i) {/*do smth else*/} };
The Py++ code:
from pyplusplus import module_builder from pyplusplus import function_transformers as FT mb = module_builder_t( ... ) foo = mb.member_functions( 'foo' ) foo.add_transformation( FT.output(0) )
The generated code, for class
B
, is:namespace bp = boost::python; struct B_wrapper : B, bp::wrapper< B > { virtual void foo( int & i ) const { ... } static boost::python::tuple default_foo( ::B const & inst ) { ... } virtual void foo( int & i ) const { ... } static boost::python::object default_foo( ::A const & inst ) { ... } }; ... bp::class_< B_wrapper, bp::bases< A > >( "B" ) .def( "foo", (boost::python::tuple (*)( ::B const & ))( &B_wrapper::default_foo ) ) .def( "foo", (boost::python::object (*)( ::A const & ))( &B_wrapper::default_foo ) );
As you can see, after applying the transformation both functions have same signature. Do you know what function will be called in some situation? I do - the wrong one :-(.
Unfortunately, there is no easy work around or some trick that you can use, which will not break the existing code. I see few solutions to the problem:
change the alias of the functions
from pyplusplus import module_builder from pyplusplus import function_transformers as FT mb = module_builder_t( ... ) foo = mb.member_functions( '::A::foo' ).add_transformation( FT.output(0), alias="foo_a" ) foo = mb.member_functions( '::B::foo' ).add_transformation( FT.output(0), alias="foo_b" )
use
inout
transformation - it preserves a function signaturePy++ can introduce a configuration, that will preserve the previous behaviour. I think this is a wrong way to go and doing the API changes is the ‘right’ longer term solution.
If you absolutely need to preserve API backward compatible, contact me and I will introduce such configuration option.
Sorry for inconvenience.
Few bugs, related to Indexing Suite 2, were fixed. Many thanks to Oliver Schweitzer for reporting them.
New and highly experimental feature was introduced - Boost.Python and ctypes integration.
Support for boost::python::make_constructor functionality was added.
Support for unions and unnamed classes was added.
Doxygen documentation extractor was improved. Many thanks to Hernán Ordiales.
Py++ documentation was improved. Many thanks to Bernd Fritzke.
Version 0.9.5¶
- Bug fixes:
- Py++ will not expose free operators, if at least one of the classes, it works on, is not exposed. Many thanks to Meghana Haridev for reporting the bug.
- Added ability to completely disable warnings reporting.
- All logging is now done to
stderr
instead ofstdout
. - Generated code improvements:
default_call_policies
is not generatedreturn_internal_reference
call policies - default arguments are not generated- STD containers are generated without default arguments. For example instead
of
std::vector< int, std::allocator< int > >
, in many cases Py++ will generatestd::vector< int >
.
- create_with_signature algorithm was improved. Py++ will generate correct code in one more use case.
- Added ability to exclude declarations from being exposed, if they will cause compilation to fail.
- Starting from this version, Py++ provides a complete solution for multi-module development.
- Classes, which expose C arrays will be registered only once.
- Starting from this version, Py++ supports a code generation with different encodings.
- There is a new strategy to split code into files. It is IDE friendly. Be sure to read the updated documentation.
Version 0.9.0¶
- Bug fixes:
- Declaration of virtual functions that have an exception specification with an empty throw was fixed. Now the exception specification is generated properly. Many thanks to Martin Preisler for reporting the bug.
- Added exposing of copy constructor,
operator=
andoperator<<
.operator=
is exposed under “assign” nameoperator<<
is exposed under “__str__” name
- Added new call policies:
- Added an initial support for multi-module development. Now you can mark your
declarations as
already_exposed
and Py++ will do the rest. For more information read multi-module development guide.
- input_c_buffer - new functions transformation, which allows one to pass a Python sequence to function, instead of pair of arguments: pointer to buffer and size.
- Added ability to control generated “include” directives. Now you can ask Py++ to include a header file, when it generates code for some declaration. For more information refers to inserting code guide.
- Code generation improvements: system header files ( Boost.Python or Py++ defined ) will be included from the generated files only in case the generated code depends on them.
- Performance improvements: Py++ runs 1.5 - 2 times faster, than the previous one.
- Added ability to add code before overridden and default function calls. For more information refer to member function API documentation.
- Py++ will generate documentation for automatically constructed properties. For more information refer to properties guide.
- Added iteration functionality to Boost.Python Indexing Suite V2
std::map
andstd::multimap
containers.
Version 0.8.5¶
- Added Function Transformation feature.
- “Py++” introduces new functionality, which allows you to control messages and warnings: how to disable warnings?.
- Added new algorithm, which controls the registration order of the functions. See registration order document
- New “Py++” defined return_pointee_value call policy was introduced.
- Support for opaque types was added. Read more about this feature here.
- It is possible to configure “Py++” to generate faster ( compilation time ) code for indexing suite version 2. See API documentation.
- The algorithm, which finds all class properties was improved. It provides user with a better way to control properties creation. A property that would hide another exposed declaration will not be registered\created.
- Work around for “custom smart pointer as member variable” Boost.Python bug was introduced.
- Bugs fixes and documentation improvement.
Version 0.8.2¶
- Interface changes:
module_builder.module_builder_t.build_code_creator
method: argumentcreate_casting_constructor
was removed and deprecation warning was introduced.
- Performance improvements. In some cases you can get x10 performance boost. Many thanks to Allen Bierbaum! Saving and reusing results of different pygccxml algorithms and type traits functions achieved this.
- Convenience API for registering exception translator was introduced.
- Py++ can generate code that uses
BOOST_PYTHON_FUNCTION_OVERLOADS
andBOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS
macros. - Treatment to previously generated and no more in-use files was added. By default Py++ will delete these files, but of course you can redefine this behaviour.
- Generated code changes:
default_call_policies
should not be generated any more.- For functions that have
return_value_policy< return_opaque_pointer >
call policy, Py++ will automatically generateBOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID
macro. Thank you very much for Gottfried Ganssauge for this idea.
- Support for Boost.Python properties was introduced. Py++ implements small algorithm, that will automatically discover properties, base on naming conventions.
decl_wrappers.class_t
has new function:is_wrapper_needed
. This function explains why Py++ creates class wrapper for exposed class.- Python type traits module was introduce. Today it contains only single function:
is_immutable
- returnsTrue
if exposed type is Python immutable type
Version 0.8.1¶
- Georgiy Dernovoy contributed a patch, which allows Py++ GUI to save\load last used header file.
- Py++ improved a lot functionality related to providing feedback to user:
- every package has its own logger
- only important user messages are written to
stdout
- user messages are clear
- Support for Boost.Python indexing suite version 2 was implemented.
- Every code creator class took
parent
argument in__init__
method. This argument was removed.adopt_creator
andremove_creator
will setunset reference to parent. - Generated code for member and free functions was changed. This changed was introduced to fix compilation errors on msvc 7.1 compiler.
- Py++ generates “stable” code. If header files were not changed, Py++ will not change any file.
- Support for huge classes was added. Py++ is able to split registration code for the class to multiple cpp files.
- User code could be added almost anywhere, without use of low level API.
- Generated source files include only header files you passes as an argument to module builder.
- Bug fixes.
- Documentation was improved.
Project name changed¶
In this version the project has been renamed from “pyplusplus” to “Py++”. There were few reasons to this:
- I like “Py++” more then “pyplusplus”.
- “Py++” was the original name of the project: http://mail.python.org/pipermail/c++-sig/2005-July/009280.html
- Users always changed the name of the projects. I saw at least 6 different names.
Version 0.8.0¶
- Py++ “user guide” functionality has been improved. Now Py++
can answer few questions:
- why this declaration could not be exported
- why this function could not be overridden from Python
- Py++ can suggest an alias for exported classes.
- Small redesign has been done - now it is much easier to understand and maintain code creators, which creates code for C++ functions.
- Exception specification is taken into account, when Py++ exports member functions.
- Member variables, that are pointers exported correctly.
- Added experimental support for
vector_indexing_suite
. - Bug fixes.
Version 0.7.0¶
Many thanks to Matthias Baas and Allen Bierbaum! They contributed so much to Py++, especially Matthias:
- New high-level API: Py++ has simple and powerful API
- Documentation: Matthias and Allen added a lot of documentation strings
- Bug fixes and performance improvements
New GUI features:
Attention - non backward compatible change.
module_creator.creator_t.__init__
method has been changed.decls
argument could be interpreted as- list of all declaration to be exported
- list of top-level declarations.
creator_t
should export all declarations recursively.
In order to clarify the use of
decls
argument new argumentrecursive
has been added. By default new value ofrecursive
isFalse
.Guide for users/upgraders: if use are exporting all declaration without filtering, you should set
recursive
argument toTrue
. If you usepygccxml.declarations.filtering.*
functions, you have nothing to do.Sorry for the inconvenience :-(.
Better split of extension module to files. From now the following declarations will have dedicated file:
- named enumerations, defined within namespace
- unnamed enumerations and global variables
- free functions
This functionality will keep the number of instantiated templates within one file,
main.cpp
, to be very low. Also it is possible to implement solution, wheremain.cpp
file does not contain templates instantiations at all.Only constant casting operators could be used with
implicitly_convertible
. This bug has been fixed.Bug exporting non copyable class has been fixed.
Small bug fix - from now file with identical content will not be overwritten.
Boost.Python
optional
is now supported and used when a constructor has a a default argument.Py++ now generates correct code for hierarchy of abstract classes:
struct abstract1{ virtual void do_smth() = 0; } struct abstract2 : public abstract1{ virtual void do_smth_else() = 0; } struct concrete : public abstract2{ virtual void do_smth(){}; virtual void do_smth_else(){}; }
Logging functionality has been added
New packages
module_builder
,decl_wrappers
and_logging_
has been added.…
Version 0.6.0¶
Code repository has been introduced. This repository contains classes and functions that will help users to export different C++ classes and declarations. Right now this repository contains two classes:
- array_1_t
- const_array_1_t
Those classes helps to export static, single dimension arrays.
Code generation has been improved.
Code generation speed has been improved.
If you have Niall Douglas void* patch, then you can enjoy from automatically set call policies.
Bit fields can be accessed from Python
Creating custom code creator example has been added.
Comparison to Pyste has been wrote.
Using this version it is possible to export most of TnFOX Python bindings.
Version 0.5.1¶
- operator() is now supported.
- Special casting operators are renamed( __int__, __str__, … ).
- Few bug fixes