Maintaining the health and well-being of your software is a never-ending responsibility. Automating away as much of it as possible makes that challenge more achievable. In this episode Anthony Sottile describes his work on the pre-commit framework to simplify the process of writing and distributing functions to make sure that you only commit code that meets your definition of clean. He explains how it supports tools and repositories written in multiple languages, enforces team standards, and how you can start using it today to ship better software.
- Hello and welcome to Podcast.__init__, the podcast about Python and the people who make it great.
- When you’re ready to launch your next app you’ll need somewhere to deploy it, so check out Linode. With private networking, shared block storage, node balancers, and a 40Gbit network, all controlled by a brand new API you’ve got everything you need to scale up. Go to podcastinit.com/linode to get a $20 credit and launch a new server in under a minute.
- Visit the site to subscribe to the show, sign up for the newsletter, and read the show notes. And if you have any questions, comments, or suggestions I would love to hear them. You can reach me on Twitter at @Podcast__init__ or email firstname.lastname@example.org)
- To help other people find the show please leave a review on iTunes, or Google Play Music, tell your friends and co-workers, and share it on social media.
- Join the community in the new Zulip chat workspace at podcastinit.com/chat
- Your host as usual is Tobias Macey and today I’m interviewing Anthony Sottile about pre-commit, a framework for managing and maintaining hooks for multiple languages
- How did you get introduced to Python?
- Can you start by describing what a pre-commit hook is and some of the ways that they are useful for developers?
- What was you motivation for creating a framework to manage your pre-commit hooks?
- How does it differ from other projects built to manage these hooks?
- What are the steps for getting someone started with pre-commit in a new project?
- Which other event hooks would be most useful to implement for maintaining the health of a repository?
- What types of operations are most useful for ensuring the health of a project?
- What types of routines should be avoided as a pre-commit step?
- Installing the hooks into a user’s local environment is a manual step, so how do you ensure that all of your developers are using the configured hooks?
- What factors have you found that lead to developers skipping or disabling hooks?
- How is pre-commit implemented and how has that design evolved from when you first started?
- What have been the most difficult aspects of supporting multiple languages and package managers?
- What would you do differently if you started over today?
- Would you still use Python?
- For someone who wants to write a plugin for pre-commit, what are the steps involved?
- What are some of the strangest or most unusual uses of pre-commit hooks that you have seen?
- What are your plans for the future of pre-commit?
Keep In Touch
- asottile on GitHub
- @codewithanthony on Twitter
- anthonywritescode on twitch
- anthonywritescode on YouTube
- Git hooks
- Type Annotations