PyDev of the Week: Miroslav Šedivý

This week we welcome Miroslav Šedivý as our PyDev of the Week! Miro has been a speaker at several different Python conferences. You can also catch up with Miro on his website or by checking out Miro’s GitHub Profile.

Miroslav Šedivý

Let’s take some time to get to know Miro better!

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

My name is Miroslav Šedivý, but most people call me Miro, which allows them to avoid typing some letters they do not have on their keyboard. I was born in Czechoslovakia (yes, I am over 30 now), studied computer sciences in France and Germany, and now I am living in Austria.

Computers and programming were the hobbies that became my occupation. Another hobby, which is difficult to combine professionally with the first one, is human languages. As a Central European fascinated by travel, I speak a bunch of languages and enjoy using them every day.

Apart from this, I love spending time with my family, hiking, biking, fixing OpenStreetMap, camping, and woodworking.

You can find me at https://mas.to/@eumiro and occasionally at some Python events.

Why did you start using Python?

After I have developed a quite complex power forecasting system for wind turbines in Perl using PDL (Perl equivalent to NumPy), my colleagues started using Python for new projects. It was around 2008, in the age of Python 2.5 with some rumors of Python 3. I got myself a book called “Perl to Python Migration” and tried to wrap my head around the new concepts.

The worst thing I remember from my beginnings was the necessity to “import re” each time I wanted to work with regular expressions. In Perl it was second nature to do almost anything with regular expressions. Not it Python. And this is beautiful about different languages: the way of thinking in them. Just like in French one does not simply count to seventy, nor in Czech say “one beer” (“one” is actually a synonym for “beer”), in Python one, can use other tools to dissect strings.

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

There were some BASIC and Pascal somewhere in the past century, but now my number one is Python, accompanied by Shell. I remember some Perl, Java, C, and PHP from more or less serious projects in the past, and I have played with Go and Rust.

The choice of language usually depends on the task. I also do not use English to speak about food and cuisine, or Polish to comment a Python code review. I am using Python only for stuff it fits well. Luckily, it fits most of the stuff I am working on.

What projects are you working on now?

Apart from my work, I have some sleeping projects at https://github.com/eumiro, which are currently waiting for another burst of enthusiasm or external input. A day has only 24±1 hours, but I wish it had more.

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

From standard lib, I am always happy if I can reach into the itertools module and simplify my code. Migration to Python 3 brings pathlib, which is a complete game changer when working with file system. I am also happy to see some gaps closing between the different modules, so you do not have to import anything else to obtain Unix timestamp of a datetime object, for instance.

There are plenty of wonderful third-party libraries I have worked with. The most important and complex one is probably pandas.

How did you end up contributing to open source projects?

At my first Python conference EuroPython 2015 in Bilbao, I met Francesc Alted from the PyTables team and as an active user of the library I had a long discussion with him at the end, we even did a sprint and with his help, I removed one obsolete exception-raiser from the codebase that was bugging me since some time.

Later I occasionally contributed to some projects I was using, but then around Christmas 2020 I had quite a lot of free time and I discovered outdated CI/CD configurations in dozens of Python projects, so I started systematically helping them to fix the pipelines and also to modernize their code. This is where one of my talks “There Are Python 2 Relics In Your Code!” were born. Python 2 hacks like `int(math.floor(x))` work in Python 3 but they do not make sense in modern code and should be refactored.

What are the top three things you’ve learned as a contributor?

Make small steps. Even smaller. If you think you’ve done a great bunch of work and submit a huge PR, the maintainers will have a very difficult time reviewing it and any rebase in an active project will probably stop their interest in your contribution.

Maintainers are humans with jobs paying their bills. Respect their time and energy and do not expect they’re here only for you.

Comment on the project. Show how you’re using it in your own work to make the maintainers feel their endeavor matters.

Is there anything else you’d like to say?

Please do not use backslashes to deliberately break lines. If there’s some line length limit (whether it is 78, 80, 88, 100, or 120), it makes your code more readable. There’s virtually always a possibility to reformat your code to respect this limit and avoid horizontal scrolling in editor. Every such formatting allows you to break the line at a suitable position. Breaking lines with backslashes tells the reader “you have to join these lines in your head into a very long one to understand it.”

Finally, I’d like to thank Mike for his engagement and the whole Python community for collaborating on such a marvelous set of products and the whole ecosystem around it. So happy to be a part of it!

Thanks for doing the interview, Miro!