[Numpy-discussion] New project : Spyke python-to-C compiler
Travis E. Oliphant
oliphant at enthought.com
Mon Apr 7 00:19:58 EDT 2008
What will be the licensing of this project? Do you know yet?
I have a couple of comments because I've been thinking along these lines.
> What is Spyke?
> In many performance critical projects, it is often necessary to
> rewrite parts of the application in C. However writing C wrappers can
> be time consuming. Spyke offers an alternative approach. You add
> annotations to your Python code as strings. These strings are
> discarded by the Python
> interpreter but these are interpreted as types by Spyke compiler to
> convert to C.
>
> Example :
>
> "int -> int"
> def f(x): return 2*x
>
> In this case the Spyke compiler will consider the string "int -> int"
> as a decalration that the function accepts int as parameter and
> returns int. Spyke will then generate a C function and a wrapper
> function.
What about the use of decorators in this case?
Also, it would be great to be able to create ufuncs (and general numpy
funcs) using this approach. A decorator would work well here as well.
> Where is Spyke?
> Spyke will be available as a binary only release in a couple of weeks.
> I intend to make it open source after a few months.
>
I'd like to encourage you to make it available as open source as early
as possible. I think you are likely to get help in ways you didn't
expect. People are used to reading code, so even an alpha project can
get help early. In fact given that you are looking for help. I
think this may be the best way to get it.
If you need help getting set up in terms of hosting it somewhere, I can
help you do that.
> Spyke is written in Python and Java and should be platform independant.
> I do intend to make the source open in a few months. Right now its
> undergoing very rapid development and has negligible amounts of
> documentation so the source code right now is pretty useless to anyone
> else anyway.
>
> c) Strings as type declarations : Do you think I should use decorators
> instead at least for function type declarations?
>
I think you should use decorators. That way you can work towards
having the compiler "embedded" in the decorator and happen seamlessly
without invoking a separte "program" (it just happens when the module is
loaded -- a.l.a weave).
Best regards,
-Travis Oliphant
More information about the NumPy-Discussion
mailing list