Summary
One of the perennial challenges in software engineering is to reduce the opportunity for bugs to creep into the system. Some of the tools in our arsenal that help in this endeavor include rich type systems, static analysis, writing tests, well defined interfaces, and linting. Phillip Schanely created the CrossHair project in order to add another ally in the fight against broken code. It sits somewhere between type systems, automated test generation, and static analysis. In this episode he explains his motivation for creating it, how he uses it for his own projects, and how to start incorporating it into yours. He also discusses the utility of writing contracts for your functions, and the differences between property based testing and SMT solvers. This is an interesting and informative conversation about some of the more nuanced aspects of how to write well-behaved programs.
Announcements
- 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 or want to try a project you hear about on the show, you’ll need somewhere to deploy it, so take a look at our friends over at Linode. With the launch of their managed Kubernetes platform it’s easy to get started with the next generation of deployment and scaling, powered by the battle tested Linode platform, including simple pricing, node balancers, 40Gbit networking, dedicated CPU and GPU instances, and worldwide data centers. Go to pythonpodcast.com/linode and get a $100 credit to try out a Kubernetes cluster of your own. And don’t forget to thank them for their continued support of this show!
- Your host as usual is Tobias Macey and today I’m interviewing Phillip Schanely about CrossHair, an analysis tool for Python that blurs the line between testing and type systems.
Interview
- Introductions
- How did you get introduced to Python?
- Can you start by giving an overview of what the CrossHair project is and how it got started?
- What are some examples of the types of tools that CrossHair might augment or replace? (e.g. Pydantic, Doctest, etc.)
- What are the categories of bugs or problems in your code that CrossHair can help to identify or discover?
- Can you explain the benefits of implementing contracts in your software?
- What are the limitations of contract implementations?
- What are the available interfaces for creating and validating contracts?
- How does the use of contracts in your software influence the overall design of the system?
- How does CrossHair compare to type systems in terms of use cases or capabilities?
- Can you describe how CrossHair is implemented?
- How has the design or goal of CrossHair changed or evolved since you first began working on it?
- What are some of the other projects that you have gained inspiration or ideas from while working on CrossHair? (inside or outside of the Python ecosystem)
- For someone who wants to get started with CrossHair, can you talk through the developer workflow?
- I noticed that you recently added support for validating the functional equivalency of different method implementations. What was the inspiration for that capability?
- What kinds of use cases does that enable?
- How much of CrossHair are you able to dogfood while developing CrossHair?
- What are some of the most interesting, innovative, or unexpected ways that you have seen CrossHair used?
- What are the most interesting, unexpected, or challenging lessons that you have learned while working on CrossHair?
- When is CrossHair the wrong choice?
- What do you have planned for the future of the project?
Keep In Touch
- pschanely on GitHub
- @pschanely on Twitter
Picks
- Tobias
- The War With Grandpa
- Phillip
- Hammock chairs! (affiliate link)
Closing Announcements
- Thank you for listening! Don’t forget to check out our other show, the Data Engineering Podcast for the latest on modern data management.
- Visit the site to subscribe to the show, sign up for the mailing list, and read the show notes.
- If you’ve learned something or tried out a project from the show then tell us about it! Email hosts@podcastinit.com) with your story.
- To help other people find the show please leave a review on iTunes and tell your friends and co-workers
- Join the community in the new Zulip chat workspace at pythonpodcast.com/chat
Links
- CrossHair
- NLTK == Natural Language ToolKit
- ACL2
- Liquid Haskell
- SMT Solver
- Doctest
- Property Based Testing
- Hypothesis
- Podcast Episode
- Halting Problem
- Pydantic
- PEP 316
- icontract
- Eiffel programming language
- Design By Contract
- Metamorphic Testing
- Higher Order Types
- Fuzz Testing
- The Fuzzing Book
- Python Audit Hooks
- GitHub Scientist
- Laboratory Python implementation of GitHub Scientist
- Podcast Episode
- Laboratory Python implementation of GitHub Scientist
- Taint Analysis
The intro and outro music is from Requiem for a Fish The Freak Fandango Orchestra / CC BY-SA
Information
- Show
- PublishedFebruary 16, 2021 at 2:00 AM UTC
- Length43 min
- Episode302
- RatingClean