This week we welcome Mark Dufour as our PyDev of the Week! Mark is the creator of Shedskin, which “is an experimental compiler, that can translate pure, but implicitly statically typed Python (3.8+) programs into optimized C++”.
Let’s spend a few minutes getting to know Mark better!
Can you tell us a little about yourself (hobbies, education, etc):
I’m a 44-year old software-engineer living near Delft University, the Netherlands, where I studied Computer Science in a distant past. My current day job is to work on software for processing satellite data.
Besides tinkering on Shedskin and the occasional other Python project, I like to read Japanese books, play Othello (a wonderful boardgame!), play with 3d printers and wireless VR, and follow SpaceX and Tesla news.
Why did you start using Python?
I grew up in the 80’s and 90’s, playing lots of video games and programming in various languages. I wrote a wolfenstein-3d clone completely in assembler, because I thought that’s what you had to do for performance. And then my mind was blown when I discovered that its successor, DOOM, was written almost entirely in C!
When discovering Python (I think in 2001) I immediately realized that that history was repeating itself. This higher-level language, Python, was fast enough for most of your code, and if needed you could always write performance-critical parts in a lower-level language (now C).
Of course with libraries such as Numpy and Numba, and infinitely faster computers these days, falling back to a lower-level language is becoming less and less worth the effort.
What other programming languages do you know and which is your favorite?
I honestly feel like there are too many programming languages out there, just like there are too many GNU/Linux distributions, leading to the fragmentation of already limited FOSS community resources.
In my view, we as a Python community should strive for Python to be a ‘lingua franca’ that can be used by anyone in just about every context. A major (perceived) problem with Python has always been its technically suboptimal performance, so that is something we should be improving rather than just accepting Python as slow.. 🙂
What projects are you working on now?
I recently spent several months finally porting Shedskin to Python 3, something that was long overdue, but that never happened because I knew beforehand this would be very painful. In the end, it ‘only’ required a patch of 50k lines but fortunately most of it turned out to be pretty straightforward.
I’m currently preparing a new release, which should add support for basic f-strings, relative imports and hopefully make it easier to use for Windows users.
I’ve also recently been working on an experimental “omnidirectional treadmill” for use in VR. Because VR is so much more immersive when you can walk around naturally.
For the longest time, I’ve also been toying with the idea to re-implement DOOM in pure Python, and using Shedskin that should make it pretty efficient as well. I recently discovered a github project that almost implements it, but it does not apply textures yet.
Which Python libraries are your favorite (core or 3rd party)?
The one that I have been most excited about recently is for sure PyScript. As I talked about above, Python also needs to be available (and performant) in the browser arena 🙂
Another library that I really enjoyed recently is Cupy, which provides an almost numpy-compatible API for doing computations on a GPU.
How did you get involved with the Shed Skin project?
After discovering Python, I became more and more intrigued with the idea of a fast Python implementation. Since for algorithm-type code (where performance is often most important), I almost never use actually dynamic types, I figured it should be technically possible to run such code much, much faster in many cases.
Since Psyco, an early JIT compiler, already existed, I ended up doing my Master’s Thesis on static type inference for ‘restricted’ Python programs instead, since that seemed like a very cool topic. I open sourced the result as Shedskin and kept improving its features and type inference engine to a level where it now typical that a suitable program of many hundreds of lines compiles after a few tweaks.
One of the many Shedskin ‘example’ programs is actually a working Commodore-64 emulator, consisting of several thousands of lines of code.
There have been many contributions from others along the line, but one of the most important ones was the ability to generate extension modules. So you can only compile part of your code, while the ‘main program’ remains unrestricted (for example, GUI code).
What are some of the challenges that you’ve overcome during the Shed Skin project or FOSS development in general?
The transition to Python 3 almost terminated the project for sure. Fortunately I finally found the resolve to sit down and just port to it (but only after realizing that Shedskin was being removed from distributions together with Python 2.. :P).
Is there anything else you’d like to say?
To anyone trying out a FOSS project for the first time, please consider leaving some feedback at the project site, especially if something didn’t work as expected. This is much more appreciated than you may realize, and helps motivate project maintainers to actually put in more (spare!) time in the project.. =)
Thanks for doing the interview, Mark!