PyDev of the Week: Anthony Sottile

This week we welcome Anthony Sottile (@codewithanthony) as our PyDev of the Week! Anthony is one of the maintainers for the tox and pytest packages. He is also on the “deadsnakes” PPA team, which backports Python for certain EOL Linux distros. While you can discover a little about Anthony on his website, you will probably learn more from his Github profile.

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

From a young age, I was always fascinated with computers. Some of my earliest programs were written to simplify (read: cheat) on homework. A word document containing a rudimentary quadratic-formula-solving gui interface using visual basic was copied to quite a few floppy disks. I eventually switched to web development as it was a much more accessible distribution mechanism.

I attended the University of Michigan (go blue!) originally studying biochemistry. I wanted to change the world through medicine and research but two years into the program I decided to switch to my stronger passion. And after an intense scramble to squeeze a four year program into two years I graduated with a computer science degree!

Most of my personal time is spent biking (which I meticulously track in a fancy spreadsheet — 4600 miles logged this year). Some of my other passions are hiking, cooking, running, ski racing, playing violin, and writing a bit of poetry (is this a dating site?). And of course I spend a significant portion of time building and contributing to open source software 🙂

My crowning achievement is becoming a Pokemon master — not only completing a living Pokedex but enduring _extreme_ tedium by capturing every single possible shiny Pokemon legitimately. It’s all been downhill since then.

Why did you start using Python?

The first time I was exposed to python was through employment at Yelp. Though I was hired as a JavaScript frontend developer, I quickly delved into full stack development as the curiosity got the best of me. Eventually, I built a web infrastructure and developer tooling team. Along the way, my completionist nature brought me to many corners of the language including metaprogramming, packaging, python 3 porting, RPython (pypy), C extensions and more! Being my current poison of choice, I decided I better know how it works!

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

At one point or another I would have considered myself an expert at JavaScript, C#, Java, C++, and C (and dabbled in many others). One thing that I’ve valued out of a programming language is the ability to have static guarantees _before_ runtime (usually in the form of a type checker). As such, I’m excited about the improvements in the type-checking space with python’s gradual typing approach! My favorite language (by syntax and features) that I’ve worked with is C# (though maybe that’s just due to how good Visual Studio is).

An honorable mention here is go. While there’s a few things that I think could be better (tabs, packaging, generics) — go has one killer feature that I wish every language had: code rewrite as a first class citizen. Not only is `go fmt` a testament to the success of the this principle (there’s only one way to format your code!) but it’s easy and encouraged to write tools which read and manipulate the code.

What projects are you working on now?

My passion project is pre-commit — a multi-language framework for managing git hooks (mostly linters and fixers). Along with maintaining the framework, I’ve built a few of my own fixers. Recently I’ve also been spending some time helping maintain tox and pytest. One of my newer projects all-repos, is a tool for managing microliths at scale, making searching and applying sweeping changes across repositories easy.

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

This was actually a quite interesting question for me — not wanting to take the science out of it I turned to all-repos to try and find the answer! Ok so the results aren’t exactly the most interesting (well of course you import `os` a lot!) but let’s dive into some outliers and my favorites. First on the list is pytest — of course it’s first, I think testing is incredibly important and what better tool to use than pytest! Of the standard library my favorite by far is `argparse` and since I tend to write lots of command line utilities it gets used a lot. Some honorable mentions in the favorites department are `sqlite3` (great for prototyping and surprisingly performant), `collections` (for `namedtuple`), `contextlib` (for `contextmanager`), and `typing` (which I’ve recently been getting into). A few that I use disproportionately more than most are `ast` and `tokenize` — I really like static analysis and tend to write a bunch of tools for it.

How did you become a part of the “deadsnakes” team (which I really appreciate, by the way)?

Perhaps my favorite part of open source is if you offer to help, people are usually receptive. I originally started working on debian packaging while backporting various packages to end-of-lifed ubuntu lucid while working at Yelp. Just before python 3.5 released, lucid reached the end of its support cycle and launchpad (rightfully so!) disabled PPA uploads for lucid (including deadsnakes). Developers (including myself) wanted to use some of the new features such as `subprocess.run`, `async` / `await`, and unpacking generalizations. At the time, an upgrade to a not-end-of-lifed distribution was still 2 to 3 years out. I was able to successfully backport 3.5 and learned a ton in the process (undoing multiarch, adjusting dependencies, patching tests, etc.). When 3.6 was released, the deadsnakes ppa homepage held a message that support was being discontinued. I offered to help with maintainership, and with a little coaching had working sources for 3.6 and the rest is history!

What challenges have you faced as a part of that team?

To be honest, most of the responsibility and maintenance of deadsnakes is pretty easy and straightforward once you learn the tooling (or automate the tooling). Most of the ease-of-maintenance comes from having three relatively-high-quality upstreams: debian, ubuntu, and of course cpython. Most of the maintenance work comes from new releases (a new LTS results in a rebuild of all packages and adjusting for two years of distribution changes!).

Thanks for doing the interview, Anthony!