PyDev of the Week: Matthäus Chajdas

This week we welcome Matthäus Chajdas (@NIV_Anteru) as our PyDev of the week! Matthäus is a core developer of Pygments, a generic syntax highlighter that is used in many websites, wikis, and more! Matthäus also works on Liara, a static site generator.

You can find out what else Matthäus is doing by checking out his website. Let’s spend some time to get to know Matthäus better!

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

I’m an architect at Advanced Micro Devices, better known as AMD, living in Munich and working on soft- and hardware. I had a relatively straightforward path to the “tech industry”: I studied computer science in Erlangen, got a Ph.D. in computer science in Munich, and went to work in the field. Over the years I’ve picked up a few things about hardware development which put me into my current position. Working on the boundary between hardware and software has been quite interesting, especially as hardware has none of the properties you typically enjoy as a programmer: Hardware takes years to “compile” and you can’t change it once shipped, so dealing with that has been quite an experience.

Outside of work, and when not giving lectures at some university, I enjoy taking a walk, bike, or, on days the weather doesn’t play along, read a book. Anything to let the mind wander around a bit!

Why did you start using Python?

That’s a really good question. I’ve been browsing a bit through my archives in the hope that I could find my very first project, but the earliest I can find is a tool to generate OpenGL bindings by doing some text and XML processing. I do recall using Python before that for what you’d call “command line tools” these days — i.e. simple things like transcoding all FLAC to MP3 — because I was (and still am) terrible at using Bash and .BAT.

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

I’ve been using a lot of languages over time — mostly C++, but also C#, Go, TypeScript, and recently I’ve also tried Rust. It’s really hard to pick a favorite though as a lot depends on the goals and the ecosystem/frameworks you can use. I really like C++ and I’ve certainly put my 10.000 hours into it, and given I’m still not annoyed I’d pick C++ as the favorite “non-Python” language.

However, there’s really not much overlap in the projects where I’d pick C++, so there’s no risk that I’ll stop using Python anytime soon. Long-term I hope that Python will provide a way to produce “ahead of time” compiled binaries which will allow Python to be a viable alternative in performance/energy-sensitive areas.

What projects are you working on now?

In my spare time, I mostly work on Pygments and occasionally on my static blog generator, Liara. There are also a bunch of “unsorted” projects I hack on for (home) automation, small services, and so on, but none of this is a focused project effort. You can find some of them scattered all over my GitHub account but there’s really nothing remotely as noteworthy as Pygments 🙂

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

That’s a really hard question as I’ve used many excellent libraries over the years. If I had to name a few favorites, I’d go with the following set: For web development, Django, which I’ve used a lot over the years and it never let me down, as well as Flask which I used for many smaller projects. On the database side, which for some reason I always end up having to work with, it’s SQLAlchemy: It saved me countless hours when I needed to persist some data in a database. For any kind of data science project, it’ll be the trinity of NumPy, Pandas and Matplotlib. I don’t know how I would have gotten any research done in the past few years without them.

Finally, I’d like to “honorably mention” Jupyter and the associated ecosystem. It’s been great to see the widespread use of Jupyter notebooks and their integration into editors like Visual Studio Code. In recent years, I’ve moved increasingly away from prototyping things in Python scripts and went to Jupyter directly, oftentimes ending up shipping the notebook as the final product.

There’s also plenty to like in the standard library; I’ll just point out two modules that I end up using in nearly every project: argparse and itertools.

How did you get started with the Pygments package?

That’s a fun story. I was rewriting my blog to use Liara, and I really wanted to use Pygments to syntax highlight some HLSL (a programming language used in graphics.) Unfortunately, the Pygments project was dormant at the time and nobody was merging a PR to add HLSL, so I figured I’ll give it a shot and fork it if nobody else wants to do things. Right about then Georg contacted me and asked if I would mind maintaining the parent project instead, and the rest is history!

What are the top 3 things you have learned while working on Pygments?

  • Regex are hard
  • You can never test enough
  • You do get used to having several hundred thousands projects depend on you not messing up every time you hit the release button

Is there anything else you’d like to say?

Something dear to my heart: Be performance conscious! Energy is the limiting factor today and even more so in the future. As a developer, you need to be aware of how to profile & optimize as we can’t afford inefficient applications. Our software can end up being used by hundreds of thousands of people and every second of life & CPU time is valuable!

Thanks for doing the interview, Matthäus!