Wednesday, January 13, 2010

Shed Skin 0.3

After 5 years of work, I'm proud to announce Shed Skin 0.3, an experimental (but obviously restricted) Python-to-C++ compiler. Looking over the release notes, I'm convinced this must be the best release so far. I would like to thank especially Jeremie Roquet, for several major contributions to this release, and Thomas Spura, for reorganizing the codebase. Joris van Rantwijk provided the great new 'maximum weighted matching' example, and he and Mike Schrick sent in minor but useful patches.

For me, these are the highlights of the release:

- support for 'itertools', 'heapq' and 'csv', bringing the total set of (mostly) supported library modules to 20
- 4 new example/test programs, bringing the total to 44 examples, at over 10,000 lines in total (sloccount)
- improved type inference scalability (while greatly simplifying the code)
- support for 'map', 'filter' and 'reduce' (yes, finally, go wild.. :-))
- support for the 'with' statement
- support for the 'key' argument to 'sorted' (and 'list.sort')
- reduced the compiler core by about 100 lines (again)
- a distutils-based setup.py (talk about 'finally'!)
- several important optimizations (indexing, slicing, adding 1-length sequences)
- an unusually large number of bug fixes

Please go ahead and try it out, and start sending in those issues. I'm also always very happy to receive new example/test programs to play with, especially if type inference fails (or doesn't terminate) for them!

15 comments:

Nederhoed said...

Congratulations! I feel slightly ashamed for still not having compiled one of my programs with ShedSkin.

That's a nice resolution for 2010! I'll keep you posted. Cheers, RR

srepmub said...

how about a python puzzle..? :)

Roman Vorushin said...

Mark, great project, thank you very much for it!

It seems ShedSkin does almost the same as Cython, what is (planned) ShedSkin difference from Cython?

srepmub said...

thanks! afaik, cython relies on type declarations and other manual 'hints' to optimize programs. shed skin's goal is to statically compile restricted python code without any such manual hints.

René Dudfield said...

congrats!

ps. another difference to cython, is that shedskin can create standalone programs (and also cpython modules). Whereas cython does only cpython modules.

Steve said...

Congratulations! I have a bunch of programs that I should test this on. It's admirable the way you have involved others in this project, too - a genuine community intitiative.

Will you be at PyCon?

srepmub said...

no, I usually don't go to conferences.. perhaps I should!

Unknown said...

Very nice, I look forward to trying it soon!

I also like what you've added: "Block comments surrounded by #{ and #} are ignored by Shed Skin"

srepmub said...

oh, I didn't come up with this. it was a contribution by mike schrick. but I like it too.. :)

Joseph Coffey said...

Can Shedskin call out to python? I mean if I have some python code, which Shedskin cannot compile, and it still call it as python code?

Cython can do this - as a result you can write a mix of fast typed code and slow dynamic code if necessary, as well as access the larger python libraries.

srepmub said...

because of type inference constraints, shedskin will never allow you to mix static and dynamic code through anything other than the use of extension modules (shedskin -e, see the tutorial). sorry :)

srepmub said...

the doctest module is not supported, but I guess you could compile your code as an extension module (shedskin -e, see the tutorial), and somehow run the tests across that from CPython.

cholling said...

When I click on the link to the tutorial ("try it out" in this article) under Firefox it tries to open the html file as a MIDI.

Unknown said...

Hi I was very interested to read about shed skin.

I am thinking of starting a new project that will need to be compiled to an EXE on windows for both technical and political reasons.

The fact that Python is (officially) interpreted was holding that back.

But my question is = Is shed skin ready for the prime time?

srepmub said...

it depends on the type of program you'd like to compile.. please see the shedskin tutorial for more details.