PyDev of the Week: Franek Magiera

This week we welcome Franek Magiera as our PyDev of the Week! Franek is a core developer of the Python programming language.

If you’d like to see what else Franek has been working on, you can check out Franek’s GitHub profile. Now let’s spend a few moments getting to know Franeky better!

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

I am interested in a lot of different things – playing the guitar, chess, science, computers, mountain hiking and sports. I used to be a competitive powerlifter, but now I am more into climbing and endurance sports – running and road cycling especially.

I got my bachelor’s in Automatic Control and Robotics and my master’s in Computer Science. My engineering and master’s theses are about applications of genetic programming, which was quite interesting to me when I was a student – I even co-authored a paper on genetic programming applications in dimensionality reduction. For a while I was considering a career in research, but ended up as a Java software developer.

Why did you start using Python?

When I was a student, most of my courses featured MATLAB. It is a very powerful tool and I liked working with it, but I didn’t like that when my student license would end, I wouldn’t be able to use it for my personal projects. I was also worried that there weren’t many job offers that required MATLAB knowledge.

I had heard that some of the older students were using Python and that it was quite similar to MATLAB, but it was open source and there were quite a few job offers that listed Python knowledge as one of the requirements. Also I had heard that a lot of people use it for machine learning, which I was interested in at the time. So that’s when I decided to learn Python and picked it up for one of my university projects.

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

I’ve played around with quite a lot of different programming languages. In high school I was using Pascal. In university, I was coding in C, C++ and MATLAB. Then, I’ve learnt Python and I’ve been heavily relying on it for my personal projects ever since.

I have also spent some time programming in Scala for a couple of MOOCs and in Scheme when going through SICP. I went through the Tour of Go on two separate occasions, but have never used the language for anything else.

I’ve used JavaScript and TypeScript during my internships and now at work I’m using Java exclusively. Recently, I’ve become interested in and started learning Rust.

That’s quite a range of different programming languages, but I think nowadays I’m somewhat productive only in Python and Java, since those are the two I use most often.

As for my favorite – it’s really hard to decide, but I think that’s Python. It’s the one I feel most comfortable with and the community around it is great. For what it’s worth, I’ve also had a lot of fun programming in Rust, Scala, TypeScript, Scheme and C.

What projects are you working on now?

Unfortunately, I haven’t been doing much programming and OSS development in my free time lately. Whenever I find the time and motivation to do that, I am trying to finish certain aspects of PEP 692. I also try to contribute to urllib3 from time to time, but it’s been a while since I’ve done that.

I’ve mentioned earlier that I started learning Rust – I’m spending some of my free time on writing a LISP interpreter in Rust as a way to learn the language.

I have a couple of other ideas for side projects, but it’s been hard for me to get round to actually work on them. The vast majority of my programming time is devoted to the stuff I do at work.

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

I love numpy, pandas, matplotlib and seaborn combo for data analysis. I also liked working with DEAP when doing my research at university. As for core – typing module is my favorite.

How did you get into doing core Python development?

I just wanted to start by saying I haven’t done a lot of core Python development apart from the very small changes related to PEP 692. Anyway, here’s how I got there.

After one of my internships I got a job offer, but wanted to get my master’s degree before starting full time employment. That meant I had still one more year as a student that I wanted to enjoy before starting work full time. Then, everything got locked down due to the pandemic, which meant I had a lot of free time that I had to spend at home. Almost all of my friends were already working in industry and I was feeling like they are learning much more than I was. At the same time, no one wanted to hire me knowing that I’d leave for another job in a year. So, I decided I’d start contributing to open source projects to gain some experience and learn new things.

I started going through GitHub looking for interesting projects. That’s how I found urllib3. I’ve done a few simple PRs that got merged. Then I started working on adding type hints to the codebase. It was then when I learnt that there is no way to precisely type hint functions that use `**kwargs` – an annotation on `**kwargs` would mean that all of the keyword arguments are of that type, which in real life is rarely the case. I’ve seen an issue regarding that on mypy’s GitHub page that seemed to gain a lot of interest and has been opened for quite some time and I thought – why don’t I try fixing that?

The problem was, I knew nothing about interpreters, compilers or type checkers – it was not part of an Automatic Control and Robotics curriculum and my master’s in Computer Science was focused on data analysis. So I started reading Crafting Interpreters by Bob Nystrom to learn more about all that stuff. After that, I more or less understood how mypy was supposed to work and I could go through the codebase and understand what certain parts were responsible for. I’ve created a simple PR that probably got a lot of stuff wrong, but it worked for the cases I was interested in. I got a response from the maintainers, that the best way to move with this feature forward would be to propose a PEP. This was around the time I started full time employment, so my free time became more limited, but I still wanted to continue working on that.

I created a topic about the problem on Python’s dev mailing list. I got invited to a typing meetup where I proposed an approach to solve that problem and mostly got positive feedback. After that, I started working on the PEP, which with my chaotic approach took me around half a year to write. Then, there was a review process by the community and the Steering Council. In the end, the PEP got accepted and that’s how I ended up doing the small changes in cpython codebase.

What is your favorite obscure Python library and why?

It’s pygraphviz because it made drawing really nice graphs easy when I needed them.

Is there anything else you’d like to say?

I just wanted to say thanks for letting me be part of the series. Python’s community is very welcoming and supportive. I probably wouldn’t have gotten as far in my open source journey if it wasn’t for the help from all the people I’ve met on my path and I’m really grateful for that.

Thanks for doing the interview, Franek!