PyDev of the Week: Sybren Stüvel

This week we welcome Sybren Stüvel (@sastuvel) as our PyDev of the Week! Sybren is a core maintainer of the Python-RSA package and also works on Blender.

You can see what else Sybren is up to over on his website or by checking out his GitHub profile.

Let’s spend some time getting to know Sybren!

Can you tell us a little about yourself (hobbies, education, etc):

My hobbies range from portrait & panorama photography to drumming in a band to electronics & random nerdy stuff. And of course spending time with my wife & our two cats.

As for education, I did my BSc in Computer Science at the Universy of Amsterdam, and then my MSc in Game & Media Technology (also CS) at Utrecht University, both in The Netherlands. For my final MSc project I worked on an animation system that would take a corpus of mocap data of someone walking, which it would then use to generate an animated, walking character that would step exactly on footstep positions you could place in the virtual world. It would even do side-stepping & walking backwards!

I liked the work there at that particular department so much, that I looked for a way to stick around. That’s how I ended up doing a PhD there, where I created a crowd simulation & animation system for very dense groups of people. Something we have to get used to again, after all the social distancing! The crowd simulation system was built as an add-on for Blender; I was using its game engine. I needed more detailed information about collisions during the simulation than Blender could provide me, and that’s why I submitted my first patch. A short time later I got my own commit access, and I’ve been able to call myself “Blender developer” ever since.

Why did you start using Python?

As part of my BSc we had a course “Algorithms & Complexity”, for which we had to implement the RSA encryption algorithm as a homework assignment. I’ve dabbled a bit in Python before, and I knew that its integers were arbitrarily-sized. No mucking about with some BigInteger library or anything, just simple math. On top of that, it had a built-in “X to the power of Y, modulo Z” function, which is pretty much all you need to do the core RSA operations. That’s when I really started using the language.

I wasn’t quite satisfied doing RSA encryption just with numbers. I know that encryption is a very mathematical topic, but to me it would only get that personal “cool factor” when I would actually be able to encrypt & decrypt some text. And of course it would be even better to be able to cooperate with other tools, like OpenSSL. That’s when I started reading up on some standards, and implementing them. This was the birth of the Python-RSA library, which is now downloaded about 4 million times per day.

The library was small and insignificant but did work. At the same time, Google released their App Engine platform, on which anybody could host Python code without having to have their own server. A big restriction was that it was not allowed to use any binary library — and all the available encryption libraries were binaries. For good reason, because it’s both faster and more secure (it’s possible to create algorithms with fixed timing in C, but super hard to impossible in Python). But, since my library was pretty much the only one that could do RSA in pure Python, and well documented, people flocked to it.

What other programming languages do you know and which is your favorite?

I use Go and C/C++ on a daily basis.

What projects are you working on now?

Last Monday we released a project I’ve been working on since the start of this year: Flamenco 3.0. It’s “render farm” software — in other words, you can use one or more machines to work together to render an animation with Blender. It’s a complete rewrite of the previous incarnation, making it easier to deploy & use. And it’s also easier than ever to customise.

It may not be a nice thing to say at a PyDev of the Week interview, but where in the previous version a lot of the code was made in Python, in this version almost all of it is replaced with Go. This allowed us to build statically-linked, binary executables that are trivially easy to get running. Just double-click and you’re done. With Python we would have been able to leverage a lot more super useful libraries & frameworks, and I’m sure we would be done faster if we were building some in-house product that could be as complex as we want (like Docker containers for everything, RabbitMQ for communication, Redis for caches, and a whole lot of other pre-built components). Flamenco is different, though, as it’s supposed to be used by a wide range of people, from individuals at home to studios like Blender Studio. The focus was not on the comfort of the developer, but on the comfort of the user.

Now that Flamenco has been released, there’s of course a new challenge. I’ll be leading a project to design & build a new rigging & animation system for Blender. I’m super excited to have this opportunity!

Which Python libraries are your favorite (core or 3rd party)?

I was over the moon with the choice with Python 3 to distinguish “bytes” from “characters”. With my last name being non-ASCII (Stüvel) I’ve seen too many issues arising from developers being oblivious about character encoding.

Apart from that, I think my favourite library is pathlib. It just makes so much sense to have a Path as a separate type, and not simply as a string. I wish more languages used this approach.

Do you use Python with Blender? If so, what do you use Python for?

Python is a major part of Blender. It is used for constructing the user interface, for various higher-level operations, and for add-ons. The add-on ecosystem of Blender is one of its major strengths, and there are people doing the most amazing things with it, from a full retopology tool that includes HTML rendering for custom user interfaces, to crowd simulation systems that can simulate traffic. Granted, the latter uses Rust for the simulation itself for performance reasons 😉

What are some lessons you learned while working on the Python-RSA project?

It’s scary. I’m blown away by the sheer number of downloads per day, and it’s super intimidating to have an influence on so many systems out there. Also, as so many, I made the mistake of dreaming up a way to do something besides standardised, well-documented algorithms, and immediately shot myself in the foot.

Thanks for doing the interview, Sybren!