PyDev of the Week: Paul Sokolovsky

Amazon Products

This week we welcome Paul Sokolovsky as our PyDev of the Week! Paul is the creator of Pycopy, which is described as “a minimalist and memory-efficient Python implementation for constrained systems, microcontrollers, and just everything”. You can check out more of his contributions to open source on Github. Let’s take a few moments to get to know Paul better!

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

I have Computer Science as my first masters, and later got another masters in Linguistics – when I was a CS student I was interested in Natural Language Processing subfield of AI, and wanted to get a formal degree to work in that areas, perhaps in academia, but that never panned out, I got sucked up into the IT industry, a common story ;-).

Hobbies – well, nothing special, I like to travel, and even if a plane carries me far away, I like to get on my feet and explore like humans did it for millennia. Though if there’s a motorbike for rent, I like to ride it to a more distant mountain before climbing it. My latest interest is history. Like, everyone took history lessons in school and might have their “favorite” history of a particular country at particular timeframe, but trying to grasp history of mankind across the mentioned millennia is a different matter.

Why did you start using Python?

Oh, as many students, at that age I drooled over Lisp and Scheme programming languages. I did a few projects in them, and while they were definitely great and I could grok them, it occurred to me that I wasn’t not sure about the rest of world. Programming is inherently social activity. And besides the power of those languages, their drawbacks were also evident, and while I was able to surmount them, other people might be not just unable, but even unwilling to do that.

So, I started my quest of the best-in-compromise programming languages, sifting thru dozens of both mainstream and obscure languages of that time. I stopped when I found Python. I think of it as “Lisp for real world”. Those were the times of Python 1.5.1…

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

Based on the above, it shouldn’t come as surprise that Python is my favorite languages. I know a bunch of scripting languages – Perl, PHP, Java, JavaScript, Lisp, Scheme, and more “systemish” ones like C and C++. I definitely watch the space and keep an eye on Go, Rust which approaching upstream and niche contenders like Nim, Zig, whatever. I don’t rush into using them – again, I passed that stage of language-hopping when I was a student.

What projects are you working on now?

My biggest project currently is Pycopy, which is a lightweight and minimalist implementation of Python, with a library and software ecosystem around it. While I loved Python all along, that was one of problems I’ve seem with it – it’s too big, so I couldn’t use it everywhere I wanted, like small embedded devices like routers or WiFi access points (that kind would be nowadays called “IoT devices”). I had to leave Python and try to involve with smaller languages like Lua, but I failed to acquire Stockholm syndrome for them, and always came back to Python, and thus zero progress with some interesting projects requiring small and cheap devices, like Smart Home.

That’s why when I heard about MicroPython Kickstarter campaign and read some technical descriptions which were very solid, I got instantly hooked and pledged to its author to open up source soon after the conclusion of the very successful campaign, instead of at the time of shipping the devices – all to allow open-source cooperation. I’ve
contributed to MicroPython for around 4 years since, having written some 30% of the codebase. Sadly, going forward, I felt that the ideas of minimalism with which we started are being betrayed, while conflict of interest was growing between a contributor doing a work in his own free time, based on beliefs and ideals, vs a small business which needs to satisfy its customers to stay afloat and generate profit. So, we parted our ways.

That’s how Pycopy came to be. Unlike MicroPython, which came to concentrate on “microcontrollers” (a mistake repeated after another small Python implementation, PyMite, which in my opinion came is its downfall), Pycopy wants to be a full-stack language for “everything”. The ideals is to use one language on your desktop/laptop, in the cloud if you use that, on mobile devices if you care to run your software on them, and all the way down to microcontrollers, though while cool, it still remains a relatively niche case, with small, but Linux-based devices often more accessible and cost-effective.

So, beyond the core interpreter with minimal set of modules, the Pycopy project offers standard library, which strives to be compatible with CPython, while still remaining small, a web micro-framework, database drivers, SDL (graphics library) bindings, FFMPEG (video/audio library) bindings, recently being developed binding for LLVM, which is compiler backend to easily develop accelerator JIT engines, as something which Python community direly needs, to counter those simpleton claims that “Python is slow” – and many other things. It’s really cool, you should check it out. It’s definitely something I wanted to develop whole my life, and I’m glad I’ll be content with having done that when I grow old ;-).

One important thing is that all the above isn’t done in some formal plan or to reimplement everything what “big” Python has. It’s all done based on demand/interest from myself and contributors. Like, I got interested in playing with video surveillance and that’s why I implemented FFMPEG bindings to access video from a camera (instead of
streaming it into to an unknown party’s cloud). I find this as recent, maybe niche, but definitely a trend – to come to up with human-scale computing – instead of corporate-scale or industry-scale – something, which a mere human can understand as a whole, modify for one’s own needs, and extend. That’s exactly the idea behind the Pycopy project! And don’t get me wrong – we need corporate-scale or industry-scale projects too, that’s what I do at my day job. But in my own free time, which generally belongs to my family and fellow humans with which I share common interests, I’d rather do something human-size.

Any other Python projects caught your attention recently?

One great project I spotted too late last August is PPCI, Pure PythonCompiler Infrastructure by Windel Bouwman. “Too late” as I usually watch project spaces of interest to me, for example I’m aware of 3-4 C language compilers implemented in Python. But PPCI is a true gem, living to its promise of being not just a small adhoc compiler, but the entire compiler infrastructure from parsing down to “almost industrial grade” optimization and codegeneration. And with all that, it’s largely a result of one man’s work in his own free time, which again shows the power Python brings. All in all, it’s a kind of project I always dreamed to work on, but never was brave enough to start. I now try to carve out time to contribute to it, and envision it to become a go-to project for all people interested in compilers and optimization.

Second project is a recent find. As an intro, it by now should be clear that I don’t just develop my own project, but keep an eye on the wide community progress. In my opinion, it’s the base of open-source idea that duplication of effort should be avoided, but if it happens, an author of such a project should have a clear answer for both themselves and users/contributors of why the duplication happens. So, I already mentioned PyMite as a “spiritual successor” of MicroPython/Pycopy.

Another similar project was TinyPy. Both of these projects implemented just a small subset of the language, so in effect they were Python-like languages and barely could run any real Python code. That’s why I jumped on MicroPython bandwagon, which promised (and delivered) almost complete compatibility with Python language (but not libraries, though users could add those themselves). Despite that, TinyPy is really cool project, e.g. it implements bytecode compiler in Python itself (something which I’m doing now for Pycopy too). The more interesting was to find out that some guy decided to revive the old TinyPy and build a new project Called TPython++ based on it. To me personally it looks like an adhoc attempt to marry it with a game engine, but I can’t know it all. If anything, it shows how vibrant, wide-reaching the Python community is.

Thanks for doing the interview, Paul!

The post PyDev of the Week: Paul Sokolovsky appeared first on The Mouse Vs. The Python.

Related posts

Leave a Comment