librelist archives

« back to archive

building Cython extensions

building Cython extensions

From:
Gour-Gadadhara Dasa
Date:
2011-04-19 @ 20:27
Hello!

Two days ago I decided to do multi-platform project using
Python+Cython+PyQt instead of using D.

When D was considered, I was researching about appropriate build
system...eliminated SCons due to bad performance and ended with Waf
and CMake, and thought to use CMake due to CPack and its ability to
provide binary packages for Windows & MAC.

Today I've inquired what the Cython folk use a build system and there
I found out about Bento.

Congratulations!!

It looks very promising and I like many things - being partly inspired
by Cabal since before D I was in Haskell community. :-)

Bento has support for Windows installer & MAC packages on its TODO
list which clearly eliminates the need for CMake.

Now, by reading the docs and from the info I got on Cython list "Waf
can work as a backend for bento.", I wonder how much is missing in
Bento to be able to server as builder for Cython extensions?

In that case, we could focus and use just one build tool serving
multi-platform GUI project. It sounds as dream-land. :-)


Sincerely,
Gour

-- 
“In the material world, conceptions of good and bad are
all mental speculations…” (Sri Caitanya Mahaprabhu)

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810

Re: [bento] building Cython extensions

From:
David Cournapeau
Date:
2011-04-20 @ 05:31
Hello Gour,

On Wed, Apr 20, 2011 at 5:27 AM, Gour-Gadadhara Dasa <gour@atmarama.net> wrote:

> Hello!
>
> Two days ago I decided to do multi-platform project using
> Python+Cython+PyQt instead of using D.
>
> When D was considered, I was researching about appropriate build
> system...eliminated SCons due to bad performance and ended with Waf
> and CMake, and thought to use CMake due to CPack and its ability to
> provide binary packages for Windows & MAC.
>
> Today I've inquired what the Cython folk use a build system and there
> I found out about Bento.
>
> Congratulations!!
>
> It looks very promising and I like many things - being partly inspired
> by Cabal since before D I was in Haskell community. :-)

Yes, the bento.info file format is strongly inspired by cabal (I would
actually have used it if it had a formal grammar).

> Bento has support for Windows installer & MAC packages on its TODO
> list which clearly eliminates the need for CMake.

Both .exe and .mpkg installers have a preliminary implementation, but
they are not mature yet - I would not distribute the produced
installers to users who are unwilling to debug installation issues
ATM.

>
> Now, by reading the docs and from the info I got on Cython list "Waf
> can work as a backend for bento.", I wonder how much is missing in
> Bento to be able to server as builder for Cython extensions?

Not much - actually, if you are willing to create/use a waf cython
tool, it should be possible now. There is no documentation yet on that
part because bento - build tool interaction is being developed as we
speak, but you can have an
idea where this is going here:
https://github.com/cournape/numpy/blob/bento_waf_build. This is an
experimental build of numpy with bento+waf.

cheers,

David

Re: [bento] building Cython extensions

From:
Gour-Gadadhara Dasa
Date:
2011-04-20 @ 06:33
On Wed, 20 Apr 2011 14:31:01 +0900
David Cournapeau <cournape@gmail.com> wrote:

> Yes, the bento.info file format is strongly inspired by cabal (I would
> actually have used it if it had a formal grammar).

Still, I like it due to its simplicity.

> Both .exe and .mpkg installers have a preliminary implementation, but
> they are not mature yet - I would not distribute the produced
> installers to users who are unwilling to debug installation issues
> ATM.

We're just starting with our project, so hopefully can help a bit with
testing.

> Not much - actually, if you are willing to create/use a waf cython
> tool, it should be possible now. There is no documentation yet on that
> part because bento - build tool interaction is being developed as we
> speak, 

Well, I'm thinking more along the line to be able to use Bento to do
complete work. Maybe I'm wrong but I read that "Bento is an
alternative to distutils-based packaging tools such as distutils,
setuptools or distribute." and I saw in Cython docs how to to build
Cython extensions using disutils.

However, I was advised against it (on the Cython list where I heard
about Bento) and wonder if it is reasonable to expect to build those
extensions just by using Bentoo?

Armed with support for .exe & .mpkg installers, it means that's all
what we would need and can forget about learning weird CMake dsl and
using (not so simple) Waf.

IOW, I'm thinking about Bento as Python' Cabal which is able to build
decent projects out-of-the-box without venturing in other-tools' land.



Sincerely,
Gour

-- 
“In the material world, conceptions of good and bad are
all mental speculations…” (Sri Caitanya Mahaprabhu)

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810

Re: [bento] building Cython extensions

From:
David Cournapeau
Date:
2011-04-20 @ 13:02
On Wed, Apr 20, 2011 at 3:33 PM, Gour-Gadadhara Dasa <gour@atmarama.net> wrote:
> On Wed, 20 Apr 2011 14:31:01 +0900
> David Cournapeau <cournape@gmail.com> wrote:
>
>> Yes, the bento.info file format is strongly inspired by cabal (I would
>> actually have used it if it had a formal grammar).
>
> Still, I like it due to its simplicity.
>
>> Both .exe and .mpkg installers have a preliminary implementation, but
>> they are not mature yet - I would not distribute the produced
>> installers to users who are unwilling to debug installation issues
>> ATM.
>
> We're just starting with our project, so hopefully can help a bit with
> testing.
>
>> Not much - actually, if you are willing to create/use a waf cython
>> tool, it should be possible now. There is no documentation yet on that
>> part because bento - build tool interaction is being developed as we
>> speak,
>
> Well, I'm thinking more along the line to be able to use Bento to do
> complete work. Maybe I'm wrong but I read that "Bento is an
> alternative to distutils-based packaging tools such as distutils,
> setuptools or distribute." and I saw in Cython docs how to to build
> Cython extensions using disutils.

What I mean is that bento is designed such as to have multiple build
backends: there is a default one, but you can decide to use waf
instead *inside* bento. In you know how to add a cython tool to waf,
then your work is almost done for cython support for bento.

As you can see here:

https://github.com/cournape/Bento/blob/master/examples/simples/single_extension_waf/bscript,
very little is needed to build your extensions with waf within bento.

The point of using waf here is to benefit from all the features from
waf (multi platform support, automatic dependency handling, etc...).
Redoing all that work does not make much sense. For small packages,
there is a default build tool, called yaku, but it is rather primitive
(and completely undocumented).

Whatever build tool you choose to use, you still use the exact same
bento.info file, and you still have windows/max installers, etc... as
the same code is used independently of the build backend.

cheers,

David

Re: [bento] building Cython extensions

From:
Gour-Gadadhara Dasa
Date:
2011-04-20 @ 14:00
On Wed, 20 Apr 2011 22:02:35 +0900
David Cournapeau <cournape@gmail.com> wrote:

> What I mean is that bento is designed such as to have multiple build
> backends: there is a default one, but you can decide to use waf
> instead *inside* bento. In you know how to add a cython tool to waf,
> then your work is almost done for cython support for bento.

Ahh...that helps/clarifies a lot.

> The point of using waf here is to benefit from all the features from
> waf (multi platform support, automatic dependency handling, etc...).

This sounds smart.

> Redoing all that work does not make much sense. For small packages,
> there is a default build tool, called yaku, but it is rather primitive
> (and completely undocumented).

Heh...that was missing part. I was totally unaware of yaku. :-)

> Whatever build tool you choose to use, you still use the exact same
> bento.info file, and you still have windows/max installers, etc... as
> the same code is used independently of the build backend.

Best of both worlds and we can safely ignore venturing into
CMake-land.

Thank you very much for clarifying.


Sincerely,
Gour

-- 
“In the material world, conceptions of good and bad are
all mental speculations…” (Sri Caitanya Mahaprabhu)

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810

Re: [bento] building Cython extensions

From:
David Cournapeau
Date:
2011-04-21 @ 02:05
On Wed, Apr 20, 2011 at 11:00 PM, Gour-Gadadhara Dasa <gour@atmarama.net> wrote:

>
> Heh...that was missing part. I was totally unaware of yaku. :-)

Yes, and maybe it should stay that way :) Yaku existence is mostly an
historical artefact (when I started yaku, using waf as a library was
not as easy as it is now, for example). The more I think about it, the
more I think going the waf route by default is the best (the multiple
backend will always stay there, though).

cheers,

David

Re: [bento] building Cython extensions

From:
Gour-Gadadhara Dasa
Date:
2011-04-21 @ 05:19
On Thu, 21 Apr 2011 11:05:36 +0900
David Cournapeau <cournape@gmail.com> wrote:

> Yes, and maybe it should stay that way :) Yaku existence is mostly an
> historical artefact (when I started yaku, using waf as a library was
> not as easy as it is now, for example). The more I think about it, the
> more I think going the waf route by default is the best (the multiple
> backend will always stay there, though).

Indeed. Bento+Waf look as dream-combo. ;)


Sincerely,
Gour

-- 
“In the material world, conceptions of good and bad are
all mental speculations…” (Sri Caitanya Mahaprabhu)

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810