Hi there, I have written a (C)Python extension using Boost::Python, and would like to get it working on PyPy. I came across [1], but that's probably a bit out of date, and the link given there discussing the status then[2] doesn't work any more. Is there an up-to-date status page? Or, does anyone know more? I don't currently have much time to invest in solving many residual issues myself, but I should do come spring / summer. [1] https://mail.python.org/pipermail/pypy-dev/2010-April/005816.html [2] http://paste.pocoo.org/show/203663/ Regards, Toby Smithe
On Thu, 2014-01-09 at 16:59 +0000, Toby St Clere Smithe wrote:
I have written a (C)Python extension using Boost::Python, and would like to get it working on PyPy. I came across [1], but that's probably a bit out of date, and the link given there discussing the status then[2] doesn't work any more. Is there an up-to-date status page? Or, does anyone know more?
Did you actually try it? I have found that cpyext has seen huge improvements in the last years. This summer, I've managed to compile some rather complex Cython-generated code with minor manual changes... -- Sincerely yours, Yury V. Zaytsev
Hi Yury, "Yury V. Zaytsev" <yury@shurup.com> writes:
Did you actually try it?
Hah, no! I wasn't that optimistic!
I have found that cpyext has seen huge improvements in the last years. This summer, I've managed to compile some rather complex Cython-generated code with minor manual changes...
This certainly sounds promising. I'll give it a go in the next couple of weeks, and report back (unless anyone else pipes up warning me not to). If I can get boost::python to build against PyPy, that will be very pleasing. Cheers, Toby
On Thu, Jan 9, 2014 at 8:05 PM, Toby St Clere Smithe <mail@tsmithe.net> wrote:
Hi Yury,
"Yury V. Zaytsev" <yury@shurup.com> writes:
Did you actually try it?
Hah, no! I wasn't that optimistic!
I have found that cpyext has seen huge improvements in the last years. This summer, I've managed to compile some rather complex Cython-generated code with minor manual changes...
This certainly sounds promising. I'll give it a go in the next couple of weeks, and report back (unless anyone else pipes up warning me not to). If I can get boost::python to build against PyPy, that will be very pleasing.
Cheers,
Toby
Hi I'm less optimistic. Boost::Python uses tons of internal stuff as far as I know. We really discourage people from using it, because it's a) slow b) prone to not behave exactly like CPython and c) be incomplete. Cheers, fijal
Hi fijal, Maciej Fijalkowski <fijall@gmail.com> writes:
I'm less optimistic. Boost::Python uses tons of internal stuff as far as I know. We really discourage people from using it, because it's a) slow b) prone to not behave exactly like CPython and c) be incomplete.
That's a shame, not least because boost::python is what my extension is written with. It's an elegant library, and exposes the Python API in a nice C++ idiom. The code I'm interfacing with uses a number of C++ features, and boost::python deals with these in a clean way. I'm thinking of attempting a Cython version, but I won't have time for that for at least 6 to 8 months, and it would be a shame to give up what I've got. But I suspect you have reason not to be optimistic: part of the appeal of boost::python is the way that it makes dealing with the differences between C++ and Python object semantics mostly transparent, but because CPython uses ref-counting garbage collection, and so then does the default boost::python object policy, it'll probably struggle with PyPy. Cheers, Toby
On Thu, 2014-01-09 at 22:29 +0200, Maciej Fijalkowski wrote: […]
I'm less optimistic. Boost::Python uses tons of internal stuff as far as I know. We really discourage people from using it, because it's a) slow b) prone to not behave exactly like CPython and c) be incomplete.
I am delving into PyD just now to get it working with CPython 3 as well as CPython 2. Can you point me towards the best way of trying to make this also work with PyPy and PyPy3? Thanks. -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder@ekiga.net 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Hi Russel, On Sun, Jan 19, 2014 at 6:28 PM, Russel Winder <russel@winder.org.uk> wrote:
I am delving into PyD just now to get it working with CPython 3 as well as CPython 2. Can you point me towards the best way of trying to make this also work with PyPy and PyPy3?
Sorry, you're not getting answers because your question is too vague. What is PyD, what kind of C or C++ code it is, ...? If it's C, we recommend CFFI. If it's C++, we don't have a one-size-fits-all story for that --- at all. If it's the kind of C++ code that can easily be embedded into a C interface, we generally recommend that you do that and then use CFFI as well. A bientôt, Armin.
2014/1/24 Armin Rigo <arigo@tunes.org>:
What is PyD
PYD (Put You Down) is a song by Justin Bieber, a singer especially popular with girls in the age bracket 10-14. https://www.youtube.com/watch?v=0Os-eKGQzpw Its lyrics use many words to describe the protagonist encouraging a lady to have sexual intercourse with him. Personally I doubt that those lyrics are appropriate for the afformentioned age bracket, but I shall not judge other cultures. Harald -- GHUM GmbH Harald Armin Massa Spielberger Straße 49 70435 Stuttgart 0173/9409607 Amtsgericht Stuttgart, HRB 734971
2014/1/24 Armin Rigo <arigo@tunes.org>:
[...] Sorry, you're not getting answers because your question is too vague. What is PyD, what kind of C or C++ code it is, ...? If it's C, we recommend CFFI. If it's C++, we don't have a one-size-fits-all story for that --- at all. If it's the kind of C++ code that can easily be embedded into a C interface, we generally recommend that you do that and then use CFFI as well.
Probably http://pyd.dsource.org/ is this about what You are asking. It's wrapper of python api for http://dlang.org/
Hi Piotr, On Fri, Jan 24, 2014 at 3:11 PM, Piotr Skamruk <piotr.skamruk@gmail.com> wrote:
Probably http://pyd.dsource.org/ is this about what You are asking. It's wrapper of python api for http://dlang.org/
I actually guessed that much from googling. What I'm asking is the kind of C++ code that it needs to interact with, which is not obvious just by staring at that page. Given time, I know I could probably explore pyd.dsource.org and dlang.org and find out myself, but I'm trying here to explain to the original author of this thread why his question remained unanswered --- because nobody here happens to be familiar with <insert favorite project name here>: there are just too many such projects out there. A bientôt, Armin.
Every tried Shiboken? My guess is that it'd work better with cpyext thatn Boost::Python, since there's less black magic in the background. On Thu, Jan 9, 2014 at 10:59 AM, Toby St Clere Smithe <mail@tsmithe.net>wrote:
Hi there,
I have written a (C)Python extension using Boost::Python, and would like to get it working on PyPy. I came across [1], but that's probably a bit out of date, and the link given there discussing the status then[2] doesn't work any more. Is there an up-to-date status page? Or, does anyone know more?
I don't currently have much time to invest in solving many residual issues myself, but I should do come spring / summer.
[1] https://mail.python.org/pipermail/pypy-dev/2010-April/005816.html [2] http://paste.pocoo.org/show/203663/
Regards,
Toby Smithe
_______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev
-- Ryan When your hammer is C++, everything begins to look like a thumb.
Ryan Gonzalez <rymg19@gmail.com> writes:
Every tried Shiboken? My guess is that it'd work better with cpyext thatn Boost::Python, since there's less black magic in the background.
No, I'd not heard of Shiboken, but it does look like an interesting project. As I wrote in my reply to fijal, I quite like boost::python, and as that's what my code is written in (and it took a while to write it!), that's what I'm interested in right now. Nonetheless, I am looking for alternatives (for a later version), so thanks. Best, Toby
Shiboken was written for the official Python Qt bindings(PySide). They actually were originally using Boost::Python, but they switched to Shiboken because the binaries were a lot smaller. Unfortunately, there isn't too much documentation. Here are some links: http://seanfisk.com/pyside-docs/shiboken/ - The docs for Shiboken itself http://seanfisk.com/pyside-docs/apiextractor/ - The docs for the typesystem files that describe the bindings to be made http://lynxline.com/superhybrids-part-2-now-qt-pyside/ http://qt-project.org/wiki/PySide_Binding_Generation_Tutorial http://qt-project.org/wiki/PySide_Shiboken_Tutorial - Short but a tad helpful https://qt.gitorious.org/pyside/shiboken/source/a527dd51e69b80c2d5be3a1d8cd6... - The tests. Folders that begin with "lib" are the C++ code that will be bound, the ones ending in "binding" are the actual bindings. Note that one of these is VERY long! https://qt.gitorious.org/pyside/pyside/source/d2a47ab8f27af7e74d34797464da85... - The best(and largest) example of all: PySide itself. On Thu, Jan 9, 2014 at 3:25 PM, Toby St Clere Smithe <mail@tsmithe.net>wrote:
Ryan Gonzalez <rymg19@gmail.com> writes:
Every tried Shiboken? My guess is that it'd work better with cpyext thatn Boost::Python, since there's less black magic in the background.
No, I'd not heard of Shiboken, but it does look like an interesting project. As I wrote in my reply to fijal, I quite like boost::python, and as that's what my code is written in (and it took a while to write it!), that's what I'm interested in right now. Nonetheless, I am looking for alternatives (for a later version), so thanks.
Best,
Toby
_______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev
-- Ryan When your hammer is C++, everything begins to look like a thumb.
Hi Ryan, Ryan Gonzalez <rymg19@gmail.com> writes:
Shiboken was written for the official Python Qt bindings(PySide). They actually were originally using Boost::Python, but they switched to Shiboken because the binaries were a lot smaller. Unfortunately, there isn't too much documentation. Here are some links:
http://seanfisk.com/pyside-docs/shiboken/ - The docs for Shiboken itself http://seanfisk.com/pyside-docs/apiextractor/ - The docs for the typesystem files that describe the bindings to be made http://lynxline.com/superhybrids-part-2-now-qt-pyside/ http://qt-project.org/wiki/PySide_Binding_Generation_Tutorial http://qt-project.org/wiki/PySide_Shiboken_Tutorial - Short but a tad helpful https://qt.gitorious.org/pyside/shiboken/source/a527dd51e69b80c2d5be3a1d8cd6... - The tests. Folders that begin with "lib" are the C++ code that will be bound, the ones ending in "binding" are the actual bindings. Note that one of these is VERY long! https://qt.gitorious.org/pyside/pyside/source/d2a47ab8f27af7e74d34797464da85... - The best(and largest) example of all: PySide itself.
Thanks! That's all very handy. I'll dive in :) Cheers, Toby
2014/1/9 Toby St Clere Smithe <mail@tsmithe.net>
Hi there,
I have written a (C)Python extension using Boost::Python, and would like to get it working on PyPy. I came across [1], but that's probably a bit out of date, and the link given there discussing the status then[2] doesn't work any more. Is there an up-to-date status page? Or, does anyone know more?
Hi, I just did it again, with Boost 1.55: - Apply the patch in https://bitbucket.org/pypy/pypy/src/default/pypy/module/cpyext/patches/boost... - EXCEPT the "using python" part, which should be something like: using python : 2.7 : $(PYPY_HOME)/bin/pypy : $(PYPY_HOME)/include : : : .pypy-22 ; Then I got the test in "libs/python/example/tutorial" work correctly. I get segfaults in other example, investigating.
I don't currently have much time to invest in solving many residual issues myself, but I should do come spring / summer.
[1] https://mail.python.org/pipermail/pypy-dev/2010-April/005816.html [2] http://paste.pocoo.org/show/203663/
Regards,
Toby Smithe
_______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev
-- Amaury Forgeot d'Arc
Hi Amaury, Thanks for responding. "Amaury Forgeot d'Arc" <amauryfa@gmail.com> writes:
I just did it again, with Boost 1.55:
- Apply the patch in
https://bitbucket.org/pypy/pypy/src/default/pypy/module/cpyext/patches/boost...
- EXCEPT the "using python" part, which should be something like:
using python : 2.7 : $(PYPY_HOME)/bin/pypy : $(PYPY_HOME)/include : : : .pypy-22 ;
Then I got the test in "libs/python/example/tutorial" work correctly. I get segfaults in other example, investigating.
This does indeed seem promising! Keep me posted :) I'll have a look when I get some free time over the next weeks. It would be very cool to get PyViennaCL[1] working on PyPy. [1] http://viennacl.sourceforge.net/ Cheers, Toby
participants (9)
-
Amaury Forgeot d'Arc
-
Armin Rigo
-
Maciej Fijalkowski
-
Massa, Harald Armin
-
Piotr Skamruk
-
Russel Winder
-
Ryan Gonzalez
-
Toby St Clere Smithe
-
Yury V. Zaytsev