Re: [Cython] Cython paper in Computing in Science & Engineering

2011-04-07 Thread René Rex
Hello

> Agreed. Perhaps you could post the desired BibTeX citation text for
> the official version and a link to the official version right next to
> the preprint?

BibTeX entry for your convecience:

@article{bradshaw2010cython,
  title={{CYTHON: THE BEST OF BOTH WORLDS}},
  author={Bradshaw, R. and Citro, C. and Seljebotn, D.S.},
  journal={CiSE 2011 Special Python Issue},
  pages={25},
  year={2010}
}

- René
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] Cython paper in Computing in Science & Engineering

2011-04-07 Thread Stefan Behnel

René Rex, 07.04.2011 09:12:

Agreed. Perhaps you could post the desired BibTeX citation text for
the official version and a link to the official version right next to
the preprint?


BibTeX entry for your convecience:

@article{bradshaw2010cython,
   title={{CYTHON: THE BEST OF BOTH WORLDS}},
   author={Bradshaw, R. and Citro, C. and Seljebotn, D.S.},
   journal={CiSE 2011 Special Python Issue},
   pages={25},
   year={2010}
}


Looks rather incomplete to me.

Stefan
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] Cython paper in Computing in Science & Engineering

2011-04-07 Thread René Rex
> Looks rather incomplete to me.

Your are right. I got the wrong document. It is from the sage website
and has the same title...
http://sage.math.washington.edu/tmp/stein-cise-comments-may22.pdf#page=29

This should be the correct entry:

@article{behnel2010cython,
  title={{Cython: The best of both worlds}},
  author={Behnel, S. and Bradshaw, R. and Citro, C. and Dalcin, L. and
Seljebotn, D.S. and Smith, K.},
  journal={Computing in Science and Engineering},
  issn={1521-9615},
  year={2010},
  publisher={IEEE Computer Society}
}

- René
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] Cython paper in Computing in Science & Engineering

2011-04-07 Thread Stefan Behnel

Dag Sverre Seljebotn, 07.04.2011 07:54:

On 04/07/2011 02:12 AM, Robert Bradshaw wrote:

On Wed, Apr 6, 2011 at 4:40 PM, Zak Stone wrote:

Researchers: Please consider citing this paper if Cython helps your
research in non-trivial ways.

Is this the canonical citation reference for Cython now? If so, can
this be
mentioned on the Cython webpage somewhere that is prominent enough to be
found?

On a related note, would it be possible to post a preprint somewhere
that isn't behind a paywall? If that's allowed, I would be delighted
to share the preprint with friends to introduce them to Cython.

Yes, I think we can post the pre-print, though I'm opposed to making
this the "canonical citation" just because of this paywall.


Is this for ideological or practical reasons?


Both.



This is probably the only paper in a "real" journal for some time, and
citations are going to boost the authors' citation counts. Nobody would
actually look up the citation anyway simply to learn about Cython, they'd
just Google it.


Depends on the reference. If it's just cited as "you know, Cython", people 
will either look for "Cython" directly and be happy, or they may look up 
the paper, see that it's paid, and keep searching, either for the paper or 
for the project. If it's cited as "in that paper, you can read about doing 
X with Cython", then people will try even harder to get at the paper. In 
either case, chances are that they need to invest more time because of the 
reference, compared to a plain link in a footnote. So citing this article 
is likely to be an inconvenience for interested readers of papers that cite it.




So unless we're trying to hide the existence of the paper,
I think we should make it the default citation until there's something better.


We should then at least get a PDF preprint version ready that contains the 
relevant metadata and put the exact same file up on everyone's homepage (so 
that search engines don't get confused and can simply hash-compare them).




Next time we've got anything to share in a paper, let's do it here:

http://www.openresearchcomputation.com/


Looks good to me (even though PyCon 2011 isn't really an "upcoming 
conference" ;).




Posting the pre-print is a matter of making the necesarry references within
it and formatting it.

http://www.sherpa.ac.uk/romeo/search.php?jrule=ISSN&search=1521-9615


I'll fix it and post a link later today.


Great, thanks!

Stefan
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] Cython paper in Computing in Science & Engineering

2011-04-07 Thread Robert Bradshaw
On Wed, Apr 6, 2011 at 10:54 PM, Dag Sverre Seljebotn
 wrote:
> On 04/07/2011 02:12 AM, Robert Bradshaw wrote:
>>
>> On Wed, Apr 6, 2011 at 4:40 PM, Zak Stone  wrote:
>
> Researchers: Please consider citing this paper if Cython helps your
> research in non-trivial ways.

 Is this the canonical citation reference for Cython now?  If so, can
 this be
 mentioned on the Cython webpage somewhere that is prominent enough to be
 found?
>>>
>>> On a related note, would it be possible to post a preprint somewhere
>>> that isn't behind a paywall? If that's allowed, I would be delighted
>>> to share the preprint with friends to introduce them to Cython.
>>
>> Yes, I think we can post the pre-print, though I'm opposed to making
>> this the "canonical citation" just because of this paywall.
>
> Is this for ideological or practical reasons?

Both.

Actually, opposed is probably too strong of a word here. I'm
disinclined, but there isn't really a better option. Currently, people
usually just cite the website, for whatever that's worth.
http://scholar.google.com/scholar?q=cython

> This is probably the only paper in a "real" journal for some time, and
> citations are going to boost the authors' citation counts. Nobody would
> actually look up the citation anyway simply to learn about Cython, they'd
> just Google it. So unless we're trying to hide the existence of the paper, I
> think we should make it the default citation until there's something better.
>
> Next time we've got anything to share in a paper, let's do it here:
>
> http://www.openresearchcomputation.com/
>
> Although that wasn't around when we started writing the paper.

Or at least look into this more carefully. Some of CiSE's papers are
open access, I (naively) thought ours wouldn't be hard to get to
either. It is a nice paper though and I think it'll hit a nice
audience (who primarily won't even be aware that they're paying
through it indirectly through university overhead and monolithic
library subscriptions).

> Posting the pre-print is a matter of making the necesarry references within
> it and formatting it.
>
> http://www.sherpa.ac.uk/romeo/search.php?jrule=ISSN&search=1521-9615
> 
>
> I'll fix it and post a link later today.

Thanks.

- Robert
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


[Cython] CiSE Cython paper: Preprint up

2011-04-07 Thread Dag Sverre Seljebotn

I should have put up this right away, sorry:

http://folk.uio.no/dagss/cython_cise.pdf

It is actually post-review, so it contains most things but some 
stylistic improvements and layout. Not sure about posting this on 
cython.org, but we could perhaps link to my webpage 
(http://folk.uio.no/dagss/) and say it is there...


The repo is here: https://github.com/dagss/cython-cise-postprint

If only the world could move to open access a bit quicker...

Dag Sverre
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] Cython paper in Computing in Science & Engineering

2011-04-07 Thread Dag Sverre Seljebotn

On 04/07/2011 10:00 AM, Stefan Behnel wrote:

Dag Sverre Seljebotn, 07.04.2011 07:54:

On 04/07/2011 02:12 AM, Robert Bradshaw wrote:

On Wed, Apr 6, 2011 at 4:40 PM, Zak Stone wrote:

Researchers: Please consider citing this paper if Cython helps your
research in non-trivial ways.

Is this the canonical citation reference for Cython now? If so, can
this be
mentioned on the Cython webpage somewhere that is prominent enough 
to be

found?

On a related note, would it be possible to post a preprint somewhere
that isn't behind a paywall? If that's allowed, I would be delighted
to share the preprint with friends to introduce them to Cython.

Yes, I think we can post the pre-print, though I'm opposed to making
this the "canonical citation" just because of this paywall.


Is this for ideological or practical reasons?


Both.



This is probably the only paper in a "real" journal for some time, and
citations are going to boost the authors' citation counts. Nobody would
actually look up the citation anyway simply to learn about Cython, 
they'd

just Google it.


Depends on the reference. If it's just cited as "you know, Cython", 
people will either look for "Cython" directly and be happy, or they 
may look up the paper, see that it's paid, and keep searching, either 
for the paper or for the project. If it's cited as "in that paper, you 
can read about doing X with Cython", then people will try even harder 
to get at the paper. In either case, chances are that they need to 
invest more time because of the reference, compared to a plain link in 
a footnote. So citing this article is likely to be an inconvenience 
for interested readers of papers that cite it.


I guess this depends on the paper and reader in question then. Myself 
I'd never bother with the paper but go right to the website. Citing is 
just "paying the authors of the software through improving their 
citation stats". Then again my field is unfortunately very much 
pyramid-scheme-inflicted.


I definitely think we should encourage giving a footnote as well.

How about just presenting the situation as it is in a "Citing Cython" 
section, and leave the decision up to who's citing Cython? ("If you 
don't like to cite a paywall paper, a website reference is OK. At any 
rate, please link to the website in a footnote the first time you 
mention Cython.")


Really, I hate the current situation as much as you do. But I see moving 
the world towards open access as the task of those whose already got a 
bit up the food chain; I'm just at the start of my PhD. (And it should 
be obvious I'm arguing with my own interests in mind here.)


Dag Sverre
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] [cython-users] CiSE Cython paper: Preprint up

2011-04-07 Thread Stefan Behnel

Dag Sverre Seljebotn, 07.04.2011 10:08:

The repo is here: https://github.com/dagss/cython-cise-postprint


To include metadata, you can change the hyperref setup near the top as follows:

"""
\RequirePackage[colorlinks,breaklinks,pdftex,
linkcolor=InnerLinkColor,filecolor=OuterLinkColor,
menucolor=OuterLinkColor,urlcolor=OuterLinkColor,
citecolor=InnerLinkColor,

pdfauthor={Stefan Behnel, Robert Bradshaw, Craig Citro, Lisandro 
Dalcin, Dag Sverre Seljebotn, Kurt Smith},

pdftitle={Cython: The best of both worlds},
pdfkeywords={Cython language, Cython programming, NumPy}

]{hyperref}
"""

Any more keywords to add?

There's also pdfsubject (and pdfcreator and pdfproducer), but that doesn't 
really apply here.


Stefan
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] Cython paper in Computing in Science & Engineering

2011-04-07 Thread Robert Bradshaw
On Thu, Apr 7, 2011 at 1:33 AM, Dag Sverre Seljebotn
 wrote:
> On 04/07/2011 10:00 AM, Stefan Behnel wrote:
>>
>> Dag Sverre Seljebotn, 07.04.2011 07:54:
>>>
>>> On 04/07/2011 02:12 AM, Robert Bradshaw wrote:

 On Wed, Apr 6, 2011 at 4:40 PM, Zak Stone wrote:
>>>
>>> Researchers: Please consider citing this paper if Cython helps your
>>> research in non-trivial ways.
>>
>> Is this the canonical citation reference for Cython now? If so, can
>> this be
>> mentioned on the Cython webpage somewhere that is prominent enough to
>> be
>> found?
>
> On a related note, would it be possible to post a preprint somewhere
> that isn't behind a paywall? If that's allowed, I would be delighted
> to share the preprint with friends to introduce them to Cython.

 Yes, I think we can post the pre-print, though I'm opposed to making
 this the "canonical citation" just because of this paywall.
>>>
>>> Is this for ideological or practical reasons?
>>
>> Both.
>>
>>
>>> This is probably the only paper in a "real" journal for some time, and
>>> citations are going to boost the authors' citation counts. Nobody would
>>> actually look up the citation anyway simply to learn about Cython, they'd
>>> just Google it.
>>
>> Depends on the reference. If it's just cited as "you know, Cython", people
>> will either look for "Cython" directly and be happy, or they may look up the
>> paper, see that it's paid, and keep searching, either for the paper or for
>> the project. If it's cited as "in that paper, you can read about doing X
>> with Cython", then people will try even harder to get at the paper. In
>> either case, chances are that they need to invest more time because of the
>> reference, compared to a plain link in a footnote. So citing this article is
>> likely to be an inconvenience for interested readers of papers that cite it.
>
> I guess this depends on the paper and reader in question then. Myself I'd
> never bother with the paper but go right to the website. Citing is just
> "paying the authors of the software through improving their citation stats".
> Then again my field is unfortunately very much pyramid-scheme-inflicted.
>
> I definitely think we should encourage giving a footnote as well.
>
> How about just presenting the situation as it is in a "Citing Cython"
> section, and leave the decision up to who's citing Cython? ("If you don't
> like to cite a paywall paper, a website reference is OK. At any rate, please
> link to the website in a footnote the first time you mention Cython.")

Of course eventually it'd be nice if people just wrote "we coded this
up in Cython" and a reference felt as out of place there as if they
had provided a reference for Fortran or C :-). We're a long way from
there though.

> Really, I hate the current situation as much as you do. But I see moving the
> world towards open access as the task of those whose already got a bit up
> the food chain; I'm just at the start of my PhD. (And it should be obvious
> I'm arguing with my own interests in mind here.)
>
> Dag Sverre
> ___
> cython-devel mailing list
> cython-devel@python.org
> http://mail.python.org/mailman/listinfo/cython-devel
>
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] Cython paper in Computing in Science & Engineering

2011-04-07 Thread Dag Sverre Seljebotn

On 04/07/2011 10:01 AM, Robert Bradshaw wrote:

On Wed, Apr 6, 2011 at 10:54 PM, Dag Sverre Seljebotn
  wrote:

On 04/07/2011 02:12 AM, Robert Bradshaw wrote:

On Wed, Apr 6, 2011 at 4:40 PM, Zak Stonewrote:

Researchers: Please consider citing this paper if Cython helps your
research in non-trivial ways.

Is this the canonical citation reference for Cython now?  If so, can
this be
mentioned on the Cython webpage somewhere that is prominent enough to be
found?

On a related note, would it be possible to post a preprint somewhere
that isn't behind a paywall? If that's allowed, I would be delighted
to share the preprint with friends to introduce them to Cython.

Yes, I think we can post the pre-print, though I'm opposed to making
this the "canonical citation" just because of this paywall.

Is this for ideological or practical reasons?

Both.

Actually, opposed is probably too strong of a word here. I'm
disinclined, but there isn't really a better option. Currently, people
usually just cite the website, for whatever that's worth.
http://scholar.google.com/scholar?q=cython


And I don't think that's worth very much. To me it's really looking like 
CiSE citation or no citation at all.



Next time we've got anything to share in a paper, let's do it here:

http://www.openresearchcomputation.com/

Although that wasn't around when we started writing the paper.

Or at least look into this more carefully. Some of CiSE's papers are
open access, I (naively) thought ours wouldn't be hard to get to
either. It is a nice paper though and I think it'll hit a nice
audience (who primarily won't even be aware that they're paying
through it indirectly through university overhead and monolithic
library subscriptions).


I did the same mistake, because I couldn't see the paywall myself. At 
the time I actually had a hard time finding an internet connection that 
wouldn't transparently serve me the PDFs. And once I learned I figured 
it was a bit too late to back out.


I've learned a lot since then.

DS
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] [cython-users] CiSE Cython paper: Preprint up

2011-04-07 Thread René Rex
> Any more keywords to add?

What about "Python"? ;)

- René
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] [cython-users] CiSE Cython paper: Preprint up

2011-04-07 Thread Dag Sverre Seljebotn

On 04/07/2011 11:37 AM, René Rex wrote:

Any more keywords to add?

What about "Python"? ;)



Done and done. Thanks for the patches.

DS
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] Cython paper in Computing in Science & Engineering

2011-04-07 Thread Dag Sverre Seljebotn

On 04/07/2011 10:01 AM, Robert Bradshaw wrote:

On Wed, Apr 6, 2011 at 10:54 PM, Dag Sverre Seljebotn
  wrote:

On 04/07/2011 02:12 AM, Robert Bradshaw wrote:

On Wed, Apr 6, 2011 at 4:40 PM, Zak Stonewrote:

Researchers: Please consider citing this paper if Cython helps your
research in non-trivial ways.

Is this the canonical citation reference for Cython now?  If so, can
this be
mentioned on the Cython webpage somewhere that is prominent enough to be
found?

On a related note, would it be possible to post a preprint somewhere
that isn't behind a paywall? If that's allowed, I would be delighted
to share the preprint with friends to introduce them to Cython.

Yes, I think we can post the pre-print, though I'm opposed to making
this the "canonical citation" just because of this paywall.

Is this for ideological or practical reasons?

Both.

Actually, opposed is probably too strong of a word here. I'm
disinclined, but there isn't really a better option. Currently, people
usually just cite the website, for whatever that's worth.
http://scholar.google.com/scholar?q=cython


OK, I wrote this:

http://wiki.cython.org/FAQ#HowdoIciteCythoninanacademicpaper.3F

If any of you can think of something better that that, just do it -- I 
won't start an edit war :-)



Dag Sverre
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


[Cython] Hudson pyregr testing takes too long

2011-04-07 Thread Stefan Behnel

Hi,

I just noticed that the CPython pyregr tests have jumped up from ~14 
minutes for a run to ~4 hours when we added generator support.


https://sage.math.washington.edu:8091/hudson/view/cython-devel/job/cython-devel-tests-pyregr-py26-c/buildTimeTrend

I currently have no idea why that is (well, it's likely because we compile 
more tests now, but Vitja's branch ran the tests in ~30 minutes). It would 
be great if someone could find the time to analyse this problem. The 
current run time makes it basically impossible to keep these tests enabled.


Stefan
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] Hudson pyregr testing takes too long

2011-04-07 Thread Stefan Behnel

Stefan Behnel, 07.04.2011 13:46:

I just noticed that the CPython pyregr tests have jumped up from ~14
minutes for a run to ~4 hours when we added generator support.

https://sage.math.washington.edu:8091/hudson/view/cython-devel/job/cython-devel-tests-pyregr-py26-c/buildTimeTrend


I currently have no idea why that is (well, it's likely because we compile
more tests now, but Vitja's branch ran the tests in ~30 minutes). It would
be great if someone could find the time to analyse this problem. The
current run time makes it basically impossible to keep these tests enabled.


Ok, it looks like this is mostly an issue with the Py2.6 tests. The Py2.7 
tests take 30-45 minutes, which is very long, but not completely out of 
bounds. I've disabled the Py2.6 pyregr tests for now.


Stefan
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] cython broken

2011-04-07 Thread Haoyu Bai
On Thu, Apr 7, 2011 at 1:22 PM, Haoyu Bai  wrote:
> On Thu, Apr 7, 2011 at 1:14 AM, Lisandro Dalcin  wrote:
>> Since the commit below, Cython fails to compile itself. That fix
>> requires further work and definitely more tests. If that is impossible
>> right now, I would ask the guilty parties to revert the change and
>> continue working on this the bug tracker and repo clones. Please try
>> to keep cython-dev repo clean.
>>
>>
>
> I'm investigating this. For now, please revert this. Meanwhile, I'll
> try to get it fixed.
>

I just started a pull request that fix the current compiling fail:

https://github.com/cython/cython/pull/21

Thanks!

-- 
Haoyu BAI
School of Computing,
National University of Singapore.
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


[Cython] [GSoC] Python backend for Cython using PyPy's FFI

2011-04-07 Thread Romain Guillebert
Hi

I proposed the Summer of Code project regarding the Python backend for
Cython.

As I said in my proposal this would translate Cython code to Python +
FFI code (I don't know yet if it will use ctypes or something specific
to PyPy). PyPy's ctypes is now really fast and this will allow people to
port their Cython code to PyPy.

For the moment I've been mostly in touch with the PyPy people and they
seem happy with my proposal.

Of course I'm available for questions.

Cheers
Romain
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] [GSoC] Python backend for Cython using PyPy's FFI

2011-04-07 Thread Dag Sverre Seljebotn

On 04/07/2011 05:01 PM, Romain Guillebert wrote:

Hi

I proposed the Summer of Code project regarding the Python backend for
Cython.

As I said in my proposal this would translate Cython code to Python +
FFI code (I don't know yet if it will use ctypes or something specific
to PyPy). PyPy's ctypes is now really fast and this will allow people to
port their Cython code to PyPy.

For the moment I've been mostly in touch with the PyPy people and they
seem happy with my proposal.

Of course I'm available for questions.


Disclaimer: I haven't read the proposal (don't have access yet but will 
soon). So perhaps the below is redundant.


This seems similar to Carl Witty's port of Cython to .NET/IronPython. An 
important insight from that project is that Cython code does NOT specify 
an ABI, only an API which requires a C compiler to make sense. That is; 
many wrapped C libraries have plenty of macros, we only require partial 
definition of struct, we only require approximate typedef's, and so on.


In the .NET port, the consequence was that rather than the original idea 
of generating C# code (with FFI specifications) was dropped, and one 
instead went with C++/CLR (which is a proper C++ compiler that really 
understands the C side on an API level, in addition to giving access to 
the .NET runtime).


There are two ways around this:

 a) In addition to Python code, generate C code that can take (the 
friendlest) APIs and probe for the ABIs (such as, for instance, getting 
the offset of each struct field from the base pointer). Of course, this 
must really be rerun for each platform/build of the wrapped library.


Essentially, you'd use Cython to generate C code that, in a target 
build, would generate Python code...


 b) Create a subset of the Cython language ("RCython" :-)), where you 
require explicit ABIs (essentially this means either disallowing "cdef 
extern from ...", or creating some new form of it). Most Cython 
extensions I know about would not work with this though, so there would 
need to be porting in each case. Ideally one should then have a similar 
mode for Cython+CPython so that one can debug with CPython as well.



Dag Sverre
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] [GSoC] Python backend for Cython using PyPy's FFI

2011-04-07 Thread Carl Witty
On Thu, Apr 7, 2011 at 9:06 AM, Dag Sverre Seljebotn
 wrote:
> On 04/07/2011 05:01 PM, Romain Guillebert wrote:
>>
>> Hi
>>
>> I proposed the Summer of Code project regarding the Python backend for
>> Cython.
>>
>> As I said in my proposal this would translate Cython code to Python +
>> FFI code (I don't know yet if it will use ctypes or something specific
>> to PyPy). PyPy's ctypes is now really fast and this will allow people to
>> port their Cython code to PyPy.
>>
>> For the moment I've been mostly in touch with the PyPy people and they
>> seem happy with my proposal.
>>
>> Of course I'm available for questions.
>
> Disclaimer: I haven't read the proposal (don't have access yet but will
> soon). So perhaps the below is redundant.
>
> This seems similar to Carl Witty's port of Cython to .NET/IronPython. An
> important insight from that project is that Cython code does NOT specify an
> ABI, only an API which requires a C compiler to make sense. That is; many
> wrapped C libraries have plenty of macros, we only require partial
> definition of struct, we only require approximate typedef's, and so on.
>
> In the .NET port, the consequence was that rather than the original idea of
> generating C# code (with FFI specifications) was dropped, and one instead
> went with C++/CLR (which is a proper C++ compiler that really understands
> the C side on an API level, in addition to giving access to the .NET
> runtime).
>
> There are two ways around this:
>
>  a) In addition to Python code, generate C code that can take (the
> friendlest) APIs and probe for the ABIs (such as, for instance, getting the
> offset of each struct field from the base pointer). Of course, this must
> really be rerun for each platform/build of the wrapped library.
>
> Essentially, you'd use Cython to generate C code that, in a target build,
> would generate Python code...
>
>  b) Create a subset of the Cython language ("RCython" :-)), where you
> require explicit ABIs (essentially this means either disallowing "cdef
> extern from ...", or creating some new form of it). Most Cython extensions I
> know about would not work with this though, so there would need to be
> porting in each case. Ideally one should then have a similar mode for
> Cython+CPython so that one can debug with CPython as well.

Note that a) is not sufficient in general -- it doesn't handle macros
that expand into code, like errno and putc().  There's another option
I considered,

c) Given the API specification in the Cython file, generate C code
that wraps that API with a known ABI.  So for:

cdef extern from "":
int errno

you would generate a C file something like:

#include 

void _write_errno(int newval) {
  errno = newval;
}

int _read_errno() {
  return errno;
}

and for

cdef extern from "":
ctypedef int ino_t

cdef extern from "":
cdef struct stat:
ino_t st_ino

you would generate (in part):

#include 
#include 

long long _read_struct_stat_st_ino(struct stat *ptr) {
return ptr->st_ino;
}

void _write_struct_stat_st_ino(struct stat *ptr, long long newval) {
ptr->st_ino = newval;
}

(Of course, you'd want to add more name mangling to these examples.)

Note that I use "long long" for st_ino even though the Cython code
claimed that st_ino was int; that's because Cython generates code that
would work even if st_ino were "long long", and probably some modules
would break if you used the types declared in Cython.

Also, you could combine a), b), and c).  For example, use a) to
determine struct sizes, type sizes, and field offsets; use b) when
you're not worried about macros; and use c) (perhaps triggered by a
new annotation in the Cython source) when you want to handle arbitrary
API's that may be implemented with macros.

Carl
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] [GSoC] Python backend for Cython using PyPy's FFI

2011-04-07 Thread Carl Witty
On Thu, Apr 7, 2011 at 9:06 AM, Dag Sverre Seljebotn
 wrote:
> This seems similar to Carl Witty's port of Cython to .NET/IronPython. An
> important insight from that project is that Cython code does NOT specify an
> ABI, only an API which requires a C compiler to make sense. That is; many
> wrapped C libraries have plenty of macros, we only require partial
> definition of struct, we only require approximate typedef's, and so on.
>
> In the .NET port, the consequence was that rather than the original idea of
> generating C# code (with FFI specifications) was dropped, and one instead
> went with C++/CLR (which is a proper C++ compiler that really understands
> the C side on an API level, in addition to giving access to the .NET
> runtime).

Let me just add that a way to deal with the API vs. ABI issue would be
useful for other potential Cython targets as well, such as IronPython
using C# and Jython.  (A C# port for IronPython would be more valuable
than my C++/CLI port because it would work under Mono -- Mono doesn't
have a C++/CLI compiler and probably never will.)

Carl
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] [GSoC] Python backend for Cython using PyPy's FFI

2011-04-07 Thread Romain
Hi again

PyPy has functions to parse C headers to get macros and constants so I could
create C functions to wrap the macros and probably inline constants in the
Python part of the wrapper. This doesn't solve the problem of ifdefs but
this is a start.

Cheers
Romain

2011/4/7 Carl Witty 

> On Thu, Apr 7, 2011 at 9:06 AM, Dag Sverre Seljebotn
>  wrote:
> > This seems similar to Carl Witty's port of Cython to .NET/IronPython. An
> > important insight from that project is that Cython code does NOT specify
> an
> > ABI, only an API which requires a C compiler to make sense. That is; many
> > wrapped C libraries have plenty of macros, we only require partial
> > definition of struct, we only require approximate typedef's, and so on.
> >
> > In the .NET port, the consequence was that rather than the original idea
> of
> > generating C# code (with FFI specifications) was dropped, and one instead
> > went with C++/CLR (which is a proper C++ compiler that really understands
> > the C side on an API level, in addition to giving access to the .NET
> > runtime).
>
> Let me just add that a way to deal with the API vs. ABI issue would be
> useful for other potential Cython targets as well, such as IronPython
> using C# and Jython.  (A C# port for IronPython would be more valuable
> than my C++/CLI port because it would work under Mono -- Mono doesn't
> have a C++/CLI compiler and probably never will.)
>
> Carl
>
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] GSoC Proposal - Reimplement C modules in CPython's standard library in Cython.

2011-04-07 Thread Arthur de Souza Ribeiro
I've submitted to google the link is:
http://www.google-melange.com/gsoc/proposal/review/google/gsoc2011/arthur_sr/1#

It
would be really important if you could give me a feedback to my proposal...

Thank you

Best Regards

Arthur

2011/4/7 Arthur de Souza Ribeiro 

> I've wrote a proposal to the project: Reimplement C modules in CPython's
> standard library in Cython.
>
> I'd be glad if you could take a look a it and give me your feedback.
>
> the link for the proposal is: http://wiki.cython.org/arthursribeiro
>
> Thank you.
>
> Best Regards
>
> Arthur
>
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] [GSoC] Python backend for Cython using PyPy's FFI

2011-04-07 Thread Stefan Behnel

[fixed up the citation order]

Romain, 07.04.2011 22:36:

2011/4/7 Carl Witty


On Thu, Apr 7, 2011 at 9:06 AM, Dag Sverre Seljebotn wrote:

This seems similar to Carl Witty's port of Cython to .NET/IronPython. An
important insight from that project is that Cython code does NOT specify

an

ABI, only an API which requires a C compiler to make sense. That is; many
wrapped C libraries have plenty of macros, we only require partial
definition of struct, we only require approximate typedef's, and so on.

In the .NET port, the consequence was that rather than the original idea

of

generating C# code (with FFI specifications) was dropped, and one instead
went with C++/CLR (which is a proper C++ compiler that really understands
the C side on an API level, in addition to giving access to the .NET
runtime).


Let me just add that a way to deal with the API vs. ABI issue would be
useful for other potential Cython targets as well, such as IronPython
using C# and Jython.  (A C# port for IronPython would be more valuable
than my C++/CLI port because it would work under Mono -- Mono doesn't
have a C++/CLI compiler and probably never will.)


PyPy has functions to parse C headers to get macros and constants so I could
create C functions to wrap the macros and probably inline constants in the
Python part of the wrapper. This doesn't solve the problem of ifdefs but
this is a start.


Yes, I think this is the only way this can be handled. In the worst case, 
you'd have to additionally fire up a real C preprocessor and let it parse 
the referenced header files in order to get at the platform specific 
declarations, which should then usually be good enough to figure out the ABI.


Stefan
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] GSoC Proposal - Reimplement C modules in CPython's standard library in Cython.

2011-04-07 Thread Robert Bradshaw
On Thu, Apr 7, 2011 at 2:31 PM, Arthur de Souza Ribeiro
 wrote:
> I've submitted to google the link
> is: http://www.google-melange.com/gsoc/proposal/review/google/gsoc2011/arthur_sr/1#
> It would be really important if you could give me a feedback to my
> proposal...
> Thank you
> Best Regards
> Arthur

Some quick points:

- Python ships with extensive regression tests--use (and possibly
augment) those to test your work rather than writing your own.
- Three modules for a whole summer seems a bit weak, especially for
someone who already knows Cython. Target at least one module/week
seems like a good pace; some will be quickies, others might take 40+
hours. And I guarantee you'll get better and faster with practice.
- Now that generators are supported, it could also be interesting to
look at compiling all the non-C modules and fixing exposed bugs if
any, but that might be out of scope.

What I'd like to see is an implementation of a single simple but not
entirely trivial (e.g. not math) module, passing regression tests with
comprable if not better speed than the current C version (though I
think it'd probably make sense to start out with the Python version
and optimize that). E.g. http://docs.python.org/library/json.html
looks like a good candidate. That should only take 8 hours or so,
maybe two days at most, given your background. I'm not expecting
anything before the application deadline, but if you could whip
something like this out in the next week to point to that would help
your application out immensely. In fact, one of the Python
foundation's requirements is that students submit a patch before being
accepted, and this would knock out that requirement and give you a
chance to prove yourself. Create an account on https://github.com and
commit your code into a new repository there.

Hope that helps.

- Robert


> 2011/4/7 Arthur de Souza Ribeiro 
>>
>> I've wrote a proposal to the project: Reimplement C modules in CPython's
>> standard library in Cython.
>> I'd be glad if you could take a look a it and give me your feedback.
>> the link for the proposal is: http://wiki.cython.org/arthursribeiro
>> Thank you.
>> Best Regards
>> Arthur
>
> ___
> cython-devel mailing list
> cython-devel@python.org
> http://mail.python.org/mailman/listinfo/cython-devel
>
>
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] GSoC Proposal - Reimplement C modules in CPython's standard library in Cython.

2011-04-07 Thread Arthur de Souza Ribeiro
2011/4/7 Robert Bradshaw 

> On Thu, Apr 7, 2011 at 2:31 PM, Arthur de Souza Ribeiro
>  wrote:
> > I've submitted to google the link
> > is:
> http://www.google-melange.com/gsoc/proposal/review/google/gsoc2011/arthur_sr/1#
> > It would be really important if you could give me a feedback to my
> > proposal...
> > Thank you
> > Best Regards
> > Arthur
>
> Some quick points:
>
> - Python ships with extensive regression tests--use (and possibly
> augment) those to test your work rather than writing your own.
>

Thank you for that information Robert, I didn't realize this.


> - Three modules for a whole summer seems a bit weak, especially for
> someone who already knows Cython. Target at least one module/week
> seems like a good pace; some will be quickies, others might take 40+
> hours. And I guarantee you'll get better and faster with practice.


I'm going to refactor this Robert, as soon as I  remake my project's roadmap
I'll send to you again.


> - Now that generators are supported, it could also be interesting to
> look at compiling all the non-C modules and fixing exposed bugs if
> any, but that might be out of scope.
>

I will try to take a look at this after implementing some cython code to a
the module you suggested.


>
> What I'd like to see is an implementation of a single simple but not
> entirely trivial (e.g. not math) module, passing regression tests with
> comprable if not better speed than the current C version (though I
> think it'd probably make sense to start out with the Python version
> and optimize that). E.g. http://docs.python.org/library/json.html
> looks like a good candidate. That should only take 8 hours or so,
> maybe two days at most, given your background. I'm not expecting
> anything before the application deadline, but if you could whip
> something like this out in the next week to point to that would help
> your application out immensely. In fact, one of the Python
> foundation's requirements is that students submit a patch before being
> accepted, and this would knock out that requirement and give you a
> chance to prove yourself. Create an account on https://github.com and
> commit your code into a new repository there.
>
>
I will start the implementation of json module right now. I created my
github account and as soon as I have code implemented I will send repository
link.

Thanks for all the points you listed, I will work on all of them and send an
e-mail.

Best Regards.

[]s

Arthur


Hope that helps.
>
> - Robert
>
>
> > 2011/4/7 Arthur de Souza Ribeiro 
> >>
> >> I've wrote a proposal to the project: Reimplement C modules in CPython's
> >> standard library in Cython.
> >> I'd be glad if you could take a look a it and give me your feedback.
> >> the link for the proposal is: http://wiki.cython.org/arthursribeiro
> >> Thank you.
> >> Best Regards
> >> Arthur
> >
> > ___
> > cython-devel mailing list
> > cython-devel@python.org
> > http://mail.python.org/mailman/listinfo/cython-devel
> >
> >
>
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] GSoC Proposal - Reimplement C modules in CPython's standard library in Cython.

2011-04-07 Thread Arthur de Souza Ribeiro
I've made some changes to my proposal, as you said, I changed the number of
modules I'm going to reimplement, I jumped from three to twelve modules,
what modules are these and when I want to implement is described at:

http://www.google-melange.com/gsoc/proposal/review/google/gsoc2011/arthur_sr/1#


and

http://wiki.cython.org/arthursribeiro

If you could take another look I
would appreciate a lot.

Best Regards.

[]s

Arthur

2011/4/7 Arthur de Souza Ribeiro 

>
>
> 2011/4/7 Robert Bradshaw 
>
>> On Thu, Apr 7, 2011 at 2:31 PM, Arthur de Souza Ribeiro
>>  wrote:
>> > I've submitted to google the link
>> > is:
>> http://www.google-melange.com/gsoc/proposal/review/google/gsoc2011/arthur_sr/1#
>> > It would be really important if you could give me a feedback to my
>> > proposal...
>> > Thank you
>> > Best Regards
>> > Arthur
>>
>> Some quick points:
>>
>> - Python ships with extensive regression tests--use (and possibly
>> augment) those to test your work rather than writing your own.
>>
>
> Thank you for that information Robert, I didn't realize this.
>
>
>> - Three modules for a whole summer seems a bit weak, especially for
>> someone who already knows Cython. Target at least one module/week
>> seems like a good pace; some will be quickies, others might take 40+
>> hours. And I guarantee you'll get better and faster with practice.
>
>
> I'm going to refactor this Robert, as soon as I  remake my project's
> roadmap I'll send to you again.
>
>
>> - Now that generators are supported, it could also be interesting to
>> look at compiling all the non-C modules and fixing exposed bugs if
>> any, but that might be out of scope.
>>
>
> I will try to take a look at this after implementing some cython code to a
> the module you suggested.
>
>
>>
>> What I'd like to see is an implementation of a single simple but not
>> entirely trivial (e.g. not math) module, passing regression tests with
>> comprable if not better speed than the current C version (though I
>> think it'd probably make sense to start out with the Python version
>> and optimize that). E.g. http://docs.python.org/library/json.html
>> looks like a good candidate. That should only take 8 hours or so,
>> maybe two days at most, given your background. I'm not expecting
>> anything before the application deadline, but if you could whip
>> something like this out in the next week to point to that would help
>> your application out immensely. In fact, one of the Python
>> foundation's requirements is that students submit a patch before being
>> accepted, and this would knock out that requirement and give you a
>> chance to prove yourself. Create an account on https://github.com and
>> commit your code into a new repository there.
>>
>>
> I will start the implementation of json module right now. I created my
> github account and as soon as I have code implemented I will send repository
> link.
>
> Thanks for all the points you listed, I will work on all of them and send
> an e-mail.
>
> Best Regards.
>
> []s
>
> Arthur
>
>
> Hope that helps.
>>
>> - Robert
>>
>>
>> > 2011/4/7 Arthur de Souza Ribeiro 
>> >>
>> >> I've wrote a proposal to the project: Reimplement C modules in
>> CPython's
>> >> standard library in Cython.
>> >> I'd be glad if you could take a look a it and give me your feedback.
>> >> the link for the proposal is: http://wiki.cython.org/arthursribeiro
>> >> Thank you.
>> >> Best Regards
>> >> Arthur
>> >
>> > ___
>> > cython-devel mailing list
>> > cython-devel@python.org
>> > http://mail.python.org/mailman/listinfo/cython-devel
>> >
>> >
>>
>
>
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel