pygccxml-development Mailing List for C++ Python language bindings (Page 24)
Brought to you by:
mbaas,
roman_yakovenko
You can subscribe to this list here.
2006 |
Jan
|
Feb
(6) |
Mar
(160) |
Apr
(96) |
May
(152) |
Jun
(72) |
Jul
(99) |
Aug
(189) |
Sep
(161) |
Oct
(110) |
Nov
(9) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(13) |
Feb
(48) |
Mar
(35) |
Apr
(7) |
May
(37) |
Jun
(8) |
Jul
(15) |
Aug
(8) |
Sep
(2) |
Oct
(1) |
Nov
(2) |
Dec
(38) |
2008 |
Jan
(11) |
Feb
(29) |
Mar
(17) |
Apr
(3) |
May
|
Jun
(64) |
Jul
(49) |
Aug
(51) |
Sep
(18) |
Oct
(22) |
Nov
(9) |
Dec
(9) |
2009 |
Jan
(28) |
Feb
(15) |
Mar
(2) |
Apr
(11) |
May
(6) |
Jun
(2) |
Jul
(3) |
Aug
(34) |
Sep
(5) |
Oct
(7) |
Nov
(13) |
Dec
(14) |
2010 |
Jan
(39) |
Feb
(3) |
Mar
(3) |
Apr
(14) |
May
(11) |
Jun
(8) |
Jul
(9) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
(7) |
Apr
|
May
|
Jun
(3) |
Jul
(3) |
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2016 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
2021 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(1) |
Nov
|
Dec
|
From: Allen B. <al...@vr...> - 2007-08-21 18:15:53
|
Roman Yakovenko wrote: > On 8/21/07, Allen Bierbaum <al...@vr...> wrote: >> Thanks to Roman's most recent changes, the performance problem I was >> running into has been removed. >> >> My new timings are: >> >> Code generation complete. took: 219.872961044 >> ... >> module builder init: 115.682010889 >> ... >> build creators: 11.5951149464 >> write module: 67.6457870007 >> >> The summary is that Roman has succeeded in making Py++ ~25x faster >> overall for my test case and he has made the building of creators run >> ~170x faster. I for one am very happy with that increase. :) > > Nice numbers! > >> Thanks a million Roman. This single set of changes will save me hours >> and hours of waiting. > > Enjoy :-) > > P.S. pstats module have interactive mode - very very helpful. > Do you have a link to some documentation about this mode? -Allen |
From: Roman Y. <rom...@gm...> - 2007-08-21 17:34:39
|
On 8/21/07, Allen Bierbaum <al...@vr...> wrote: > Thanks to Roman's most recent changes, the performance problem I was > running into has been removed. > > My new timings are: > > Code generation complete. took: 219.872961044 > ... > module builder init: 115.682010889 > ... > build creators: 11.5951149464 > write module: 67.6457870007 > > The summary is that Roman has succeeded in making Py++ ~25x faster > overall for my test case and he has made the building of creators run > ~170x faster. I for one am very happy with that increase. :) Nice numbers! > Thanks a million Roman. This single set of changes will save me hours > and hours of waiting. Enjoy :-) P.S. pstats module have interactive mode - very very helpful. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Allen B. <al...@vr...> - 2007-08-21 17:12:37
|
Thanks to Roman's most recent changes, the performance problem I was running into has been removed. My new timings are: Code generation complete. took: 219.872961044 ... module builder init: 115.682010889 ... build creators: 11.5951149464 write module: 67.6457870007 The summary is that Roman has succeeded in making Py++ ~25x faster overall for my test case and he has made the building of creators run ~170x faster. I for one am very happy with that increase. :) Thanks a million Roman. This single set of changes will save me hours and hours of waiting. -Allen Allen Bierbaum wrote: > One of the big projects I use Py++ with seems to be suffering from > performance issues. I used to be able to generate the bindings in > approximately 10 minutes, now it is taking a little over 80 minutes. > > I have been so happy with Py++ as of late that I haven't even been > paying attention to the changes going into Py++ so I don't know what may > be causing the slow down. :) > > I did collect some timing information though in the hopes that someone > smarter then me may be able to spot some corners of Py++ that could be > optimized. > > During my run I output basic timings of: > > Code generation complete. took: 5099.32698894 > ... > module builder init: 253.73842907 > ... > build creators: 1991.69337511 > write module: 2821.93180895 > > I ran the whole thing through the cProfile module to see where python > was spending it's time. The raw data is available at: > https://realityforge.vrsource.org/twiki/pub/PyOpenSG/TempArea/gen_bindings.prof.bz2 > > A report summarizing the results (sorted by time spent exclusively > within the method) is available here: > https://realityforge.vrsource.org/twiki/pub/PyOpenSG/TempArea/stats.txt > > Hopefully this will provide enough information to give some insight into > what is going on. Please let me know if there is any more information I > can provide. > > Thanks, > Allen > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > pygccxml-development mailing list > pyg...@li... > https://lists.sourceforge.net/lists/listinfo/pygccxml-development > |
From: Roman Y. <rom...@gm...> - 2007-08-03 20:07:30
|
On 8/2/07, Allen Bierbaum <al...@vr...> wrote: > > :-(. I will try to find out what happened. Can you provide the > > versions you are using? > > Is is the latest version of Py++ with Python 2.5 and Ubuntu 7.04. The > previous work was done with Python 2.4 and FC6. I actually wanted to know the version\revisions of Py++ the previous and the current one. I studied the profile file you post and didn't find something suspicious. > > Also I must admit that something strange is going on. I am testing > > Py++ on Python-Ogre project and I didn't see x8 performance > > deterioration ( hope this is the right word to use). > > > > Do you run same version of script? > > In the meantime the script has been extended to use some of the more > advanced Py++ functionality in places. I could probably back some of > these changes out if we need to see the performance of an old version of > Py++. > > That said, nothing significant has changed in the binding generation > script (just adding a couple transforms to a few classes). The other > thing of note is that the amount of time spent in the script is about > the same as before. The internal code of Py++ is where the increase is > occuring. Here is a list of changes for two months in Py++ and pygccxml projects: * adding support for GCC-XML attributes - it has performance penalty but you cannot even measure it * adding unicode support - this one potenitally could cause performance issues, but I didn't find them when I tested the code. May be you can try to use previous version of the function, without unicode support to verify this? * Py++ is able to save md5 sum of every written file. It will reuse it later, which will allow to save time, by avoiding loading the files from disk. It is described here: http://pygccxml.svn.sourceforge.net/viewvc/pygccxml/pyplusplus_dev/docs/documentation/best_practices.rest?revision=1019&view=markup * warnings - the underlying mechanism of warning reporting has changed. I think that this changed doesn't influence the performance, but it worse to check. * improving "include" directive code generation - Py++ generates include directive only if the include is really needed. I don't see any other change that could somehow influence on performance. > > > >> I have been so happy with Py++ as of late that I haven't even been > >> paying attention to the changes going into Py++ so I don't know what may > >> be causing the slow down. :) > > > > May be unicode support? > > I guess this is possible. If this is it, then there is not much that > can be done to solve this part of it. The best that could be done is to > minimize the amount of comparisons performed by making some of the code > smarter or caching some values. What do you propose? > > > >> I did collect some timing information though in the hopes that someone > >> smarter then me may be able to spot some corners of Py++ that could be > >> optimized. > >> > >> During my run I output basic timings of: > >> > >> Code generation complete. took: 5099.32698894 > >> ... > >> module builder init: 253.73842907 > >> ... > >> build creators: 1991.69337511 > >> write module: 2821.93180895 > > Can you also provide the profile information for your previous version of Py++? > > That is quite a bit harder. The script doesn't work with older versions > of Py++ as far as I know. If this is something that you really really > need, I could try to find some time over the weekend. I definitely need to see the comparison. I hope I will be able to concentrate my attention on the part that changed. > I was hoping that you may just see something in the profile output that > would point to a corner case in Py++ that is causing the slowdown. I didn't see anything :-( > One other thing that may be useful is converting the cProfile (lsprof) > output into a calltree. This should show who is calling the various > methods and how often. This may help in pointing out some particularly > expensive method. You can use the script here: > http://ddaa.net/blog/python/lsprof-calltree to convert the data. I will try this. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Allen B. <al...@vr...> - 2007-08-02 13:48:02
|
Roman Yakovenko wrote: > On 8/2/07, Allen Bierbaum <al...@vr...> wrote: >> One of the big projects I use Py++ with seems to be suffering from >> performance issues. I used to be able to generate the bindings in >> approximately 10 minutes, now it is taking a little over 80 minutes. > > :-(. I will try to find out what happened. Can you provide the > versions you are using? Is is the latest version of Py++ with Python 2.5 and Ubuntu 7.04. The previous work was done with Python 2.4 and FC6. > Also I must admit that something strange is going on. I am testing > Py++ on Python-Ogre project and I didn't see x8 performance > deterioration ( hope this is the right word to use). > > Do you run same version of script? In the meantime the script has been extended to use some of the more advanced Py++ functionality in places. I could probably back some of these changes out if we need to see the performance of an old version of Py++. That said, nothing significant has changed in the binding generation script (just adding a couple transforms to a few classes). The other thing of note is that the amount of time spent in the script is about the same as before. The internal code of Py++ is where the increase is occuring. > >> I have been so happy with Py++ as of late that I haven't even been >> paying attention to the changes going into Py++ so I don't know what may >> be causing the slow down. :) > > May be unicode support? I guess this is possible. If this is it, then there is not much that can be done to solve this part of it. The best that could be done is to minimize the amount of comparisons performed by making some of the code smarter or caching some values. > >> I did collect some timing information though in the hopes that someone >> smarter then me may be able to spot some corners of Py++ that could be >> optimized. >> >> During my run I output basic timings of: >> >> Code generation complete. took: 5099.32698894 >> ... >> module builder init: 253.73842907 >> ... >> build creators: 1991.69337511 >> write module: 2821.93180895 >> >> I ran the whole thing through the cProfile module to see where python >> was spending it's time. The raw data is available at: >> https://realityforge.vrsource.org/twiki/pub/PyOpenSG/TempArea/gen_bindings.prof.bz2 >> >> A report summarizing the results (sorted by time spent exclusively >> within the method) is available here: >> https://realityforge.vrsource.org/twiki/pub/PyOpenSG/TempArea/stats.txt > > Can you also provide the profile information for your previous version of Py++? That is quite a bit harder. The script doesn't work with older versions of Py++ as far as I know. If this is something that you really really need, I could try to find some time over the weekend. I was hoping that you may just see something in the profile output that would point to a corner case in Py++ that is causing the slowdown. One other thing that may be useful is converting the cProfile (lsprof) output into a calltree. This should show who is calling the various methods and how often. This may help in pointing out some particularly expensive method. You can use the script here: http://ddaa.net/blog/python/lsprof-calltree to convert the data. -Allen |
From: Roman Y. <rom...@gm...> - 2007-08-02 05:40:33
|
On 8/2/07, Allen Bierbaum <al...@vr...> wrote: > One of the big projects I use Py++ with seems to be suffering from > performance issues. I used to be able to generate the bindings in > approximately 10 minutes, now it is taking a little over 80 minutes. :-(. I will try to find out what happened. Can you provide the versions you are using? Also I must admit that something strange is going on. I am testing Py++ on Python-Ogre project and I didn't see x8 performance deterioration ( hope this is the right word to use). Do you run same version of script? > I have been so happy with Py++ as of late that I haven't even been > paying attention to the changes going into Py++ so I don't know what may > be causing the slow down. :) May be unicode support? > I did collect some timing information though in the hopes that someone > smarter then me may be able to spot some corners of Py++ that could be > optimized. > > During my run I output basic timings of: > > Code generation complete. took: 5099.32698894 > ... > module builder init: 253.73842907 > ... > build creators: 1991.69337511 > write module: 2821.93180895 > > I ran the whole thing through the cProfile module to see where python > was spending it's time. The raw data is available at: > https://realityforge.vrsource.org/twiki/pub/PyOpenSG/TempArea/gen_bindings.prof.bz2 > > A report summarizing the results (sorted by time spent exclusively > within the method) is available here: > https://realityforge.vrsource.org/twiki/pub/PyOpenSG/TempArea/stats.txt Can you also provide the profile information for your previous version of Py++? -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Allen B. <al...@vr...> - 2007-08-01 21:39:19
|
One of the big projects I use Py++ with seems to be suffering from performance issues. I used to be able to generate the bindings in approximately 10 minutes, now it is taking a little over 80 minutes. I have been so happy with Py++ as of late that I haven't even been paying attention to the changes going into Py++ so I don't know what may be causing the slow down. :) I did collect some timing information though in the hopes that someone smarter then me may be able to spot some corners of Py++ that could be optimized. During my run I output basic timings of: Code generation complete. took: 5099.32698894 ... module builder init: 253.73842907 ... build creators: 1991.69337511 write module: 2821.93180895 I ran the whole thing through the cProfile module to see where python was spending it's time. The raw data is available at: https://realityforge.vrsource.org/twiki/pub/PyOpenSG/TempArea/gen_bindings.prof.bz2 A report summarizing the results (sorted by time spent exclusively within the method) is available here: https://realityforge.vrsource.org/twiki/pub/PyOpenSG/TempArea/stats.txt Hopefully this will provide enough information to give some insight into what is going on. Please let me know if there is any more information I can provide. Thanks, Allen |
From: Jonathan L. <jon...@wa...> - 2007-07-31 12:06:51
|
I've build the CVS version of gccxml a few month ago, and I still use it wi= th MSVC 8. I remember that it needed a small fix in GCCXML header for MSVC8= SP1. Try to install a win32 version of CMake and have a try ... If it don't work, I could send you my own version of gccxml. john. > Message du 30/07/07 19:51 > De : "Robert Dailey" <rcd...@gm...> > A : pyg...@li... > Copie =C3=A0 :=20 > Objet : [pygccxml-development] Problems with GCC_XML >=20 > Hi, >=20 > I'm currently learning how to use Py++ but I am not able to get very far.= I > can't even use GCC_XML because I only have /mingw/bin/gcc.exe and also ms= vc8 > (visual studio 2005). I've posted to the GCC_XML mailing list but I haven= 't > gotten a response back yet. Any have this problem before? Maybe you can g= ive > me some quick tips to fix the issue. >=20 > Thanks. > > > [ (pas de nom de fichier) (0.3 Ko) ] > [ (pas de nom de fichier) (0.2 Ko) ] |
From: Roger D. <rog...@da...> - 2007-07-30 20:03:33
|
Robert, As far as I understand, GCC_XML works by accessing GCC's internal representation of the parsed C++ source. This information is not available in a regular version of GCC. You need a patched version of GCC to get at this data. GCC_XML includes this patched version. I actually think running Linux in a virtual machine inside Windows is the easiest solution, but then again, I'm familiar with Linux :) Roger Robert Dailey wrote: > Roger, > > Thank you for the link. I'll try that one out and let you know how it goes. > As for using a virtual machine, it sounds like a lot of overhead. I'd rather > it just work with the available compilers. I think it's funny that it's > called ***GCC**xml, yet it doesn't work with the MINGW gcc.exe compiler. > I've been a bit locked into the windows world, I've not had any experience > with other operating systems. Perhaps that's the reason why I'm confused. In > any case, I definitely want a virtual machine to be an absolute last resort. > Thanks again for your reply. > > Take care. > > |
From: Robert D. <rcd...@gm...> - 2007-07-30 19:51:46
|
Roger, Thank you for the link. I'll try that one out and let you know how it goes. As for using a virtual machine, it sounds like a lot of overhead. I'd rather it just work with the available compilers. I think it's funny that it's called ***GCC**xml, yet it doesn't work with the MINGW gcc.exe compiler. I've been a bit locked into the windows world, I've not had any experience with other operating systems. Perhaps that's the reason why I'm confused. In any case, I definitely want a virtual machine to be an absolute last resort. Thanks again for your reply. Take care. On 7/30/07, Roger Dahl <rog...@da...> wrote: > > Robert, > > There's a Windows version of GCC_XML here: > > > http://sourceforge.net/project/showfiles.php?group_id=71702&package_id=146740 > > Maybe you can get that working with pygccxml. Also, have you considered > running Py++ on Linux? Just get one of the free Linux virtual machine images > and the free VMWare player. Mount your Windows disk in the Linux VM, run > Py++ in the Linux VM and point it to your sources in the Windows filesystem. > That's what I'm currently doing. > > Roger > > > Robert Dailey wrote: > > Hi, > > I'm currently learning how to use Py++ but I am not able to get very far. I > can't even use GCC_XML because I only have /mingw/bin/gcc.exe and also msvc8 > (visual studio 2005). I've posted to the GCC_XML mailing list but I haven't > gotten a response back yet. Any have this problem before? Maybe you can give > me some quick tips to fix the issue. > > Thanks. > > ------------------------------ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > > ------------------------------ > > _______________________________________________ > pygccxml-development mailing list > pyg...@li...https://lists.sourceforge.net/lists/listinfo/pygccxml-development > > > |
From: Roger D. <rog...@da...> - 2007-07-30 19:48:23
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> Robert,<br> <br> There's a Windows version of GCC_XML here: <br> <br> <a class="moz-txt-link-freetext" href="http://sourceforge.net/project/showfiles.php?group_id=71702&package_id=146740">http://sourceforge.net/project/showfiles.php?group_id=71702&package_id=146740</a><br> <br> Maybe you can get that working with pygccxml. Also, have you considered running Py++ on Linux? Just get one of the free Linux virtual machine images and the free VMWare player. Mount your Windows disk in the Linux VM, run Py++ in the Linux VM and point it to your sources in the Windows filesystem. That's what I'm currently doing.<br> <br> Roger<br> <br> <br> Robert Dailey wrote: <blockquote cite="mid:496...@ma..." type="cite"> <pre wrap="">Hi, I'm currently learning how to use Py++ but I am not able to get very far. I can't even use GCC_XML because I only have /mingw/bin/gcc.exe and also msvc8 (visual studio 2005). I've posted to the GCC_XML mailing list but I haven't gotten a response back yet. Any have this problem before? Maybe you can give me some quick tips to fix the issue. Thanks. </pre> <pre wrap=""> <hr size="4" width="90%"> ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> <a class="moz-txt-link-freetext" href="http://get.splunk.com/">http://get.splunk.com/</a></pre> <pre wrap=""> <hr size="4" width="90%"> _______________________________________________ pygccxml-development mailing list <a class="moz-txt-link-abbreviated" href="mailto:pyg...@li...">pyg...@li...</a> <a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/pygccxml-development">https://lists.sourceforge.net/lists/listinfo/pygccxml-development</a> </pre> </blockquote> <br> </body> </html> |
From: Robert D. <rcd...@gm...> - 2007-07-30 17:51:02
|
Hi, I'm currently learning how to use Py++ but I am not able to get very far. I can't even use GCC_XML because I only have /mingw/bin/gcc.exe and also msvc8 (visual studio 2005). I've posted to the GCC_XML mailing list but I haven't gotten a response back yet. Any have this problem before? Maybe you can give me some quick tips to fix the issue. Thanks. |
From: Roman Y. <rom...@gm...> - 2007-07-20 10:29:13
|
On 7/19/07, Roger Dahl <rd...@da...> wrote: > Hello Roman, > > Thank you for Py++. It's awesome. > > Also thank you for the links. I think all the information is there, but > unfortunately, I'm still floundering. I can't seem to knit it all > together to a solution. > > I guess what I am really trying to do is to tell Py++ that all member > variables and members that return a boost::optional need to be using > return_value_policy<return_by_value>. pseudo code, which is very closed to real one from pygccxml import declarations from pyplusplus import call_policies def is_optional( decl ): if isinstance( decl, declarations.variable_t ): t = decl.type return type.decl_string.startswith( '::boost::optional<' ) elif isinstance( decl, declarations.calldef_t ): return decl.return_type and decl.return_type.decl_string.startswith( .... ) vars = mb.variables( is_optional ) #do something with every variable funcs = mb.calldefs( is_optional ) funcs.call_policies = call_policies.return_value_policy( call_policies.return_by_value ) > > Here you can find information about adding "hand-written" code to the > > generated one > > http://language-binding.net/pyplusplus/documentation/inserting_code.html > > > > It looks like I would be able to use this to iterate over all classes > and all of their members and insert code kind of like in the "Insert > code to class wrapper" example, but would that be the best way to go? If > so, how do I iterate over class members and pick out only the ones of > boost::optional values? See the example of code I gave + be sure to read this part of documentation: http://language-binding.net/pygccxml/query_interface.html > > Properties: > > http://language-binding.net/pyplusplus/documentation/properties.html > > > > It looks like this describes mainly how to generate getter and setter > functions, while I'm trying to export public class members directly. > Since my class members are getting exposed automatically (though not in > the way that I need them to be), I don't think I will need to use the > add_properties algorithm? I guess you don't need it. > > You can still instruct Py++ to generate "add_property": > > http://language-binding.net/pyplusplus/documentation/apidocs/pyplusplus.decl_wrappers.variable_wrapper.variable_t-class.html#use_make_functions > > > > > > This is the one that I initially mentioned. It looked to me like maybe > this is the best way to go? But unfortunately, I can't find out how to > use it. The Py++ documentation seems to have a gap between the basic > tutorial section and the reference information. An example is the > variable_t page. It contains only sparse reference information on what > variable_t can be used for, but no information on how to actually use > it. Going two steps up the tree, I get to the decl_wrappers page which > says that these classes are used for configuring the code generator, but > nothing about how or where to do that. I think only someone already very > familiar with Py++ (and maybe also Python and this method of > automatically generating documentation from the source) would see where > variable_t fits into the big picture and (for instance) how to apply the > settings there to a specific type of class members. I think I don't completely understand you, except the fact that Py++ documentation should be much better and I agree with you. What section is missing? Where can I improve it? Can you propose something concrete? > So I'm still coming back to the question on how to tell Py++ to use > return_by_value for all boost::optional class members. I would much > appreciate any further help or pointers you might be able to provide. Hope, this time I've got you right. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Roger D. <rd...@da...> - 2007-07-19 19:08:12
|
Hello Roman, Thank you for Py++. It's awesome. Also thank you for the links. I think all the information is there, but unfortunately, I'm still floundering. I can't seem to knit it all together to a solution. I guess what I am really trying to do is to tell Py++ that all member variables and members that return a boost::optional need to be using return_value_policy<return_by_value>. Roman Yakovenko wrote: > Here is a relevant list of links: > Examples of exposing boost::optional class > http://mail.python.org/pipermail/c++-sig/2004-September/thread.html#8070 > http://mail.python.org/pipermail/c++-sig/2004-July/thread.html#7849 > These must be the discussions that lead to the development of the boost::optional wrapper code that I'm using, since that code is written by Ralf Grosse-Kunstleve. > You can tell Py++ that your class is already exposed: > http://language-binding.net/pyplusplus/documentation/multi_module_development.html > > I have only written wrappers by hand for a couple of boost::optional members. Those work (since I'm using .add_property and specifying the return_by_value policy). > Here you can find information about adding "hand-written" code to the > generated one > http://language-binding.net/pyplusplus/documentation/inserting_code.html > It looks like I would be able to use this to iterate over all classes and all of their members and insert code kind of like in the "Insert code to class wrapper" example, but would that be the best way to go? If so, how do I iterate over class members and pick out only the ones of boost::optional values? > Properties: > http://language-binding.net/pyplusplus/documentation/properties.html > It looks like this describes mainly how to generate getter and setter functions, while I'm trying to export public class members directly. Since my class members are getting exposed automatically (though not in the way that I need them to be), I don't think I will need to use the add_properties algorithm? > You can still instruct Py++ to generate "add_property": > http://language-binding.net/pyplusplus/documentation/apidocs/pyplusplus.decl_wrappers.variable_wrapper.variable_t-class.html#use_make_functions > > This is the one that I initially mentioned. It looked to me like maybe this is the best way to go? But unfortunately, I can't find out how to use it. The Py++ documentation seems to have a gap between the basic tutorial section and the reference information. An example is the variable_t page. It contains only sparse reference information on what variable_t can be used for, but no information on how to actually use it. Going two steps up the tree, I get to the decl_wrappers page which says that these classes are used for configuring the code generator, but nothing about how or where to do that. I think only someone already very familiar with Py++ (and maybe also Python and this method of automatically generating documentation from the source) would see where variable_t fits into the big picture and (for instance) how to apply the settings there to a specific type of class members. So I'm still coming back to the question on how to tell Py++ to use return_by_value for all boost::optional class members. I would much appreciate any further help or pointers you might be able to provide. Thank you again. Roger |
From: Roman Y. <rom...@gm...> - 2007-07-19 06:57:23
|
On 7/19/07, Roger Dahl <rd...@da...> wrote: > Hello everyone, > > I'm having trouble exporting boost::optional<wstring> member variables > and I was wondering if someone here might be able to help. I have > boost::optional to_python and from_python converters that I can manually > invoke like so: > > typedef return_value_policy<return_by_value> rbv; > typedef default_call_policies dcp; > ... > .add_property("membervar", make_getter(&myclass::membervar, rbv()), > make_setter(&myclass::membervar, dcp())) > > When I try to use Py++ to export this member variable, it generates code > like this: > > .def_readwrite("membervar", &myclass::membervar) > > I have hundreds of these boost::optional<wstring> member variables. Is > there a way to make Py++ generate code like the .add_property example? I > have searched in the documentation and have found the variable_wrapper > module. It looks like it might do the trick, but I can't tell how to use it. > > Any help would be much appreciated. Here is a relevant list of links: Examples of exposing boost::optional class http://mail.python.org/pipermail/c++-sig/2004-September/thread.html#8070 http://mail.python.org/pipermail/c++-sig/2004-July/thread.html#7849 You can tell Py++ that your class is already exposed: http://language-binding.net/pyplusplus/documentation/multi_module_development.html Here you can find information about adding "hand-written" code to the generated one http://language-binding.net/pyplusplus/documentation/inserting_code.html Properties: http://language-binding.net/pyplusplus/documentation/properties.html You can still instruct Py++ to generate "add_property": http://language-binding.net/pyplusplus/documentation/apidocs/pyplusplus.decl_wrappers.variable_wrapper.variable_t-class.html#use_make_functions HTH -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Roger D. <rd...@da...> - 2007-07-19 05:57:30
|
Hello everyone, I'm having trouble exporting boost::optional<wstring> member variables and I was wondering if someone here might be able to help. I have boost::optional to_python and from_python converters that I can manually invoke like so: typedef return_value_policy<return_by_value> rbv; typedef default_call_policies dcp; ... .add_property("membervar", make_getter(&myclass::membervar, rbv()), make_setter(&myclass::membervar, dcp())) When I try to use Py++ to export this member variable, it generates code like this: .def_readwrite("membervar", &myclass::membervar) I have hundreds of these boost::optional<wstring> member variables. Is there a way to make Py++ generate code like the .add_property example? I have searched in the documentation and have found the variable_wrapper module. It looks like it might do the trick, but I can't tell how to use it. Any help would be much appreciated. Thank you, Roger |
From: Roman Y. <rom...@gm...> - 2007-07-13 19:58:28
|
On 7/13/07, Simon Wimmer <wim...@go...> wrote: > Roman Yakovenko schrieb: > > On 7/13/07, Simon Wimmer <wim...@go...> wrote: > >> So I downloaded gccxml_windows_install.zip, unzipped and ran setup.py. > >> I get the following error: > >> Traceback (most recent call last): > >> File "C:\gccxml install\setup.py", line 6, in <module> > >> import config > >> File "C:\gccxml install\config.py", line 14, in <module> > >> class cmake: > >> File "C:\gccxml install\config.py", line 23, in cmake > >> cc = msvccompiler.MSVCCompiler() > >> File "C:\Python25\lib\distutils\msvccompiler.py", line 230, in > >> __init__ > >> self.__macros = MacroExpander(self.__version) > >> File "C:\Python25\lib\distutils\msvccompiler.py", line 112, in > >> __init__ > >> self.load_macros(version) > >> File "C:\Python25\lib\distutils\msvccompiler.py", line 137, in > >> load_macros > >> you can try compiling with MingW32, by passing "-c mingw32" to > >> setup.py.""") > >> DistutilsPlatformError: Python was built with Visual Studio 2003; > >> extensions must be built with a compiler than can generate > >> compatible binaries. > >> Visual Studio 2003 was not found on this system. If you have Cygwin > >> installed, > >> you can try compiling with MingW32, by passing "-c mingw32" to > >> setup.py. > >> What do I have to do? > > > > Well just follow instructions on this page: > > http://www.gccxml.org/HTML/Install.html > > > > You don't have to download GCCXML sources or CMake, just extract the > > tar files and you will them. > > > > The script tries to automate the instructions, but fails sometimes. > > > > Let me know if you need more help > > > So this means I unpack the zip for example to C:/gccxml . Then I unpack > the tars. Then I run the cmake gui. I choose C:/gccxml/gccxml-cvs for > source and C:/gccxml for build directory. After that I press configure > and now which generator should I choose? Somewhere you selected a directory to install gccxml in. This directory( or subdirectory ) contains gccxml.exe file. This is what you should use. The path to this file should be passed to Py++ module_builder_t class -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Roman Y. <rom...@gm...> - 2007-07-13 15:26:17
|
On 7/13/07, Simon Wimmer <wim...@go...> wrote: > So I downloaded gccxml_windows_install.zip, unzipped and ran setup.py. > I get the following error: > Traceback (most recent call last): > File "C:\gccxml install\setup.py", line 6, in <module> > import config > File "C:\gccxml install\config.py", line 14, in <module> > class cmake: > File "C:\gccxml install\config.py", line 23, in cmake > cc = msvccompiler.MSVCCompiler() > File "C:\Python25\lib\distutils\msvccompiler.py", line 230, in > __init__ > self.__macros = MacroExpander(self.__version) > File "C:\Python25\lib\distutils\msvccompiler.py", line 112, in > __init__ > self.load_macros(version) > File "C:\Python25\lib\distutils\msvccompiler.py", line 137, in > load_macros > you can try compiling with MingW32, by passing "-c mingw32" to > setup.py.""") > DistutilsPlatformError: Python was built with Visual Studio 2003; > extensions must be built with a compiler than can generate > compatible binaries. > Visual Studio 2003 was not found on this system. If you have Cygwin > installed, > you can try compiling with MingW32, by passing "-c mingw32" to setup.py. > What do I have to do? Well just follow instructions on this page: http://www.gccxml.org/HTML/Install.html You don't have to download GCCXML sources or CMake, just extract the tar files and you will them. The script tries to automate the instructions, but fails sometimes. Let me know if you need more help -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Simon W. <wim...@go...> - 2007-07-13 14:51:37
|
So I downloaded gccxml_windows_install.zip, unzipped and ran setup.py. I get the following error: Traceback (most recent call last): File "C:\gccxml install\setup.py", line 6, in <module> import config File "C:\gccxml install\config.py", line 14, in <module> class cmake: File "C:\gccxml install\config.py", line 23, in cmake cc = msvccompiler.MSVCCompiler() File "C:\Python25\lib\distutils\msvccompiler.py", line 230, in __init__ self.__macros = MacroExpander(self.__version) File "C:\Python25\lib\distutils\msvccompiler.py", line 112, in __init__ self.load_macros(version) File "C:\Python25\lib\distutils\msvccompiler.py", line 137, in load_macros you can try compiling with MingW32, by passing "-c mingw32" to setup.py.""") DistutilsPlatformError: Python was built with Visual Studio 2003; extensions must be built with a compiler than can generate compatible binaries. Visual Studio 2003 was not found on this system. If you have Cygwin installed, you can try compiling with MingW32, by passing "-c mingw32" to setup.py. What do I have to do? |
From: Julian S. <jul...@rs...> - 2007-07-09 08:00:25
|
Hello, many thanks for your quick reply. Roman Yakovenko wrote: > On 7/9/07, Julian Scheid <jul...@rs...> wrote: >> I've run into a problem with Py++ (both with 0.9.0 and with trunk) when >> trying to expose a class like this: >> >> class Foo >> { >> public: >> virtual void bar() {} >> private: >> Foo() {} >> }; > > What compiler do you use? I just checked this on MSVC 7.1 and it works > fine. > I attach the generated code. That was a bad example - it actually compiles for me, too. But the following won't compile on g++ 3.x (tested 3.4.2, 3.4.1 and 3.3.1) with "base `Foo' with only non-default constructor in class without a constructor". It works fine on g++ 4.0.2 though... so maybe it's not something that needs to be fixed after all. class Foo { public: virtual void foo() {} private: Foo(bool) {} }; I've attached the generated code as well. But it looks like it's sort of a non-issue after all, sorry if I wasted your time. >> In the long term, I guess the proper fix is to not create wrappers for >> final classes. > > There is no such definition in C++ as "final class". Private > constructor is "public" for a function or another class. ( friend ) True, but wouldn't the private constructor have to be "public" from the point of view of the deriving class? If you take a closed API that uses private constructors like this, for example, it effectively means that you can't subclass the class in question short of tinkering with the header. I guess at any rate it would be great if Py++ could add a (simple) way to explicitly disable wrapper generation for a given class. >> Is there a short-term workaround for this problem? > > Try this: I'll give that a try, thanks again for your help! Julian |
From: Roman Y. <rom...@gm...> - 2007-07-09 06:08:05
|
On 7/9/07, Julian Scheid <jul...@rs...> wrote: > Hello, > > I've run into a problem with Py++ (both with 0.9.0 and with trunk) when > trying to expose a class like this: > > class Foo > { > public: > virtual void bar() {} > private: > Foo() {} > }; > > Py++ will generate a wrapper for Foo (since it contains a virtual > function) when it shouldn't. Firstly, the generated code will not > compile because the wrapper is derived from Foo and Foo cannot be used > as a base class (Foo is final because it has no public or protected > constructors.) What compiler do you use? I just checked this on MSVC 7.1 and it works fine. I attach the generated code. > > And it doesn't make sense to generate a wrapper for Foo in the first > place because Foo is final, and so function bar() cannot be overridden > anyway. May be you are right, I should think about it. > In the long term, I guess the proper fix is to not create wrappers for > final classes. There is no such definition in C++ as "final class". Private constructor is "public" for a function or another class. ( friend ) > Is there a short-term workaround for this problem? Try this: from pygccxml import declarations mb.mem_fun('bar').virtuality = declarations.FUNCTION_VIRTUALITY_TYPES.NOT_VIRTUAL For me it generated next code: BOOST_PYTHON_MODULE(final_classes){ bp::class_< final_classes::Foo, boost::noncopyable >( "Foo", "documentation", bp::no_init ) .def( "bar" , &::final_classes::Foo::bar , "documentation" ); } Anyway I committed new test case "final_classes_tester.py". > I tried using finalize() from goodie_utils but that didn't work unfortunately. Basically this is the code contributed by other developers and I don't support it. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Julian S. <jul...@rs...> - 2007-07-09 04:58:19
|
Hello, I've run into a problem with Py++ (both with 0.9.0 and with trunk) when trying to expose a class like this: class Foo { public: virtual void bar() {} private: Foo() {} }; Py++ will generate a wrapper for Foo (since it contains a virtual function) when it shouldn't. Firstly, the generated code will not compile because the wrapper is derived from Foo and Foo cannot be used as a base class (Foo is final because it has no public or protected constructors.) And it doesn't make sense to generate a wrapper for Foo in the first place because Foo is final, and so function bar() cannot be overridden anyway. In the long term, I guess the proper fix is to not create wrappers for final classes. Is there a short-term workaround for this problem? I tried using finalize() from goodie_utils but that didn't work unfortunately. Thanks, Julian |
From: Roman Y. <rom...@gm...> - 2007-06-20 05:30:26
|
On 6/20/07, Miguel Lobo <ml...@gm...> wrote: > Hi list, > > The attached patch against current SVN adds support for the GCCXML attribute called "attributes". > > Please see section "C++ Meta-Information" in http://www.gccxml.org/HTML/Running.html for an explanation of the "attributes" functionality. > > I have tested this simple patch and it seems to work OK. > > Please let me know if you have any questions. Thanks. I committed your patch. I also extend it to work on function arguments and added new unit tests. Revision id is 1066. GCC-XML attributes looks like a "function invocation". I think you can use " pygccxml for "easy parsing": http://language-binding.net/pygccxml/apidocs/pygccxml.declarations.call_invocation-module.html -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Roman Y. <rom...@gm...> - 2007-06-05 04:27:36
|
On 6/4/07, Matthias Janes <mat...@gm...> wrote: > hi, > > I have a simple auto generated 'basictest2.cpp' and a 'basictest2.hpp'. when I try to build the Py++ code I get some warnings about need of call policy: as this is my first try I got a bit stuck > > Any help would be most appreciated: > > > ****CODE: basictest2.cpp > > #include "basictest2.hpp" > > namespace __basictest2__ { > > str *const_0; > > str *__name__; > > void __init() { > const_0 = new str("Basic Test OK"); > > __name__ = new str("basictest2"); > > } > > str *basictest2() { > > return const_0; > } > > } // module namespace > > __ END > > > ****CODE: basictest2.hpp > > #ifndef __BASICTEST2_HPP > #define __BASICTEST2_HPP > > #include "builtin.hpp" > > using namespace __shedskin__; > namespace __basictest2__ { > > extern str *const_0; > > extern str *__name__; > > > extern str * __name__; > void __init(); > str *basictest2(); > > } // module namespace > #endif > > __ END > > > > > > WARNING: extern __shedskin__::str * __basictest2__::basictest2() [free function] > > compilation error W1050: The function returns "__shedskin__::str *" > > type. You have to specify a call policies.Be sure to take a look on > > Py++ defined call policies: http://language- > > binding.net/pyplusplus/documentation/functions/call_policies.html#py- > > defined-call-policies In this case the right call policy to use is: http://boost.org/libs/python/doc/v2/reference_existing_object.html > WARNING: __basictest2__::const_0 [variable] > > compilation error W1035: Py++ can not expose static pointer member > > variables. This could be changed in future. Well, as the warning says Py++ cannot expose the variable to Python. The simple work around is to generate\write function, which will return pointer to that object and expose it. > WARNING: __shedskin__::str [class] > > execution error W1040: The declaration is unexposed, but there are > > other declarations, which refer to it. This could cause "no to_python > > converter found" run time error. Declarations: extern > > __shedskin__::str * __basictest2__::basictest2() [free function] > > __test__::x [variable] > You configured Py++ to not expose __shedskin__::str type. Py++ warns you about that. You should decide what you want: * to expose it as is * to create code that will automatically convert __shedskin__::str to Python string. HTH -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Roman Y. <rom...@gm...> - 2007-06-05 04:21:02
|
On 6/5/07, Allen Bierbaum <al...@vr...> wrote: > We have been running into a problem lately where py++ generates some > filenames that are so long they cause problems with some windows utilities. > > For example, one generated file was named: > > vector_less_boost_scope_shared_ptr_less_OSG_scope_SampleInfo_grate__comma__std_scope_allocator_less_boost_scope_shared_ptr_less_OSG_scope_SampleInfo_grate___grate___grate_.pypp.cpp > > Would it be possible to add a feature to py++ that would generate > shorter filenames? > For example maybe part of the filename could be > created by taking an md5 hash of the typename similar to how the > function transformer code generates a unique function name. Patch is welcome, really I am running out of time. Before you get down to the code be sure you read next two articles: http://language-binding.net/pyplusplus/documentation/how_to.html#py-generated-file-name-is-too-long http://language-binding.net/pyplusplus/documentation/hints.html#class-template-instantiation-alias They contain few quick work around. Also I think you will do your users happier, if you give much better name( alias ) to the class. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |