CrossHair: Your Automatic Pair Programmer

The Python Podcast.__init__

Episode | Podcast

Date: Mon, 15 Feb 2021 21:00:00 -0500

<div class="wp-block-jetpack-markdown"><h3>Summary</h3> <p>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.</p> <h3>Announcements</h3> <ul> <li>Hello and welcome to Podcast.__init__, the podcast about Python and the people who make it great.</li> <li>When you&#8217;re ready to launch your next app or want to try a project you hear about on the show, you&#8217;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&#8217;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 <a href="https://www.pythonpodcast.com/linode?utm_source=rss&amp;utm_medium=rss">pythonpodcast.com/linode</a> and get a $100 credit to try out a Kubernetes cluster of your own. And don&#8217;t forget to thank them for their continued support of this show!</li> <li>Your host as usual is Tobias Macey and today I&#8217;m interviewing Phillip Schanely about CrossHair, an analysis tool for Python that blurs the line between testing and type systems.</li> </ul> <h3>Interview</h3> <ul> <li>Introductions</li> <li>How did you get introduced to Python?</li> <li>Can you start by giving an overview of what the CrossHair project is and how it got started?</li> <li>What are some examples of the types of tools that CrossHair might augment or replace? (e.g. Pydantic, Doctest, etc.)</li> <li>What are the categories of bugs or problems in your code that CrossHair can help to identify or discover?</li> <li>Can you explain the benefits of implementing contracts in your software?</li> <li>What are the limitations of contract implementations?</li> <li>What are the available interfaces for creating and validating contracts?</li> <li>How does the use of contracts in your software influence the overall design of the system?</li> <li>How does CrossHair compare to type systems in terms of use cases or capabilities?</li> <li>Can you describe how CrossHair is implemented? <ul> <li>How has the design or goal of CrossHair changed or evolved since you first began working on it?</li> <li>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)</li> </ul> </li> <li>For someone who wants to get started with CrossHair, can you talk through the developer workflow?</li> <li>I noticed that you recently added support for validating the functional equivalency of different method implementations. What was the inspiration for that capability? <ul> <li>What kinds of use cases does that enable?</li> </ul> </li> <li>How much of CrossHair are you able to dogfood while developing CrossHair?</li> <li>What are some of the most interesting, innovative, or unexpected ways that you have seen CrossHair used?</li> <li>What are the most interesting, unexpected, or challenging lessons that you have learned while working on CrossHair?</li> <li>When is CrossHair the wrong choice?</li> <li>What do you have planned for the future of the project?</li> </ul> <h3>Keep In Touch</h3> <ul> <li><a href="https://github.com/pschanely?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">pschanely</a> on GitHub</li> <li><a href="https://twitter.com/pschanely?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">@pschanely</a> on Twitter</li> <li><a href="https://www.linkedin.com/in/phil-schanely-1171131/?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">LinkedIn</a></li> </ul> <h3>Picks</h3> <ul> <li>Tobias <ul> <li><a href="https://www.imdb.com/title/tt4532038/?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">The War With Grandpa</a></li> </ul> </li> <li>Phillip <ul> <li><a href="https://amzn.to/3rRaK5e?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">Hammock chairs!</a> (affiliate link)</li> </ul> </li> </ul> <h3>Closing Announcements</h3> <ul> <li>Thank you for listening! Don&#8217;t forget to check out our other show, the <a href="https://feeds.fireside.fm/pythonpodcast/rss">Data Engineering Podcast</a> for the latest on modern data management.</li> <li>Visit the <a href="https://www.pythonpodcast.com?utm_source=rss&amp;utm_medium=rss">site</a> to subscribe to the show, sign up for the mailing list, and read the show notes.</li> <li>If you&#8217;ve learned something or tried out a project from the show then tell us about it! Email <a href="mailto:hosts@podcastinit.com">hosts@podcastinit.com</a>) with your story.</li> <li>To help other people find the show please leave a review on <a href="https://itunes.apple.com/us/podcast/podcast.-init/id981834425?mt=2&amp;uo=6&amp;at=&amp;ct=&amp;utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">iTunes</a> and tell your friends and co-workers</li> <li>Join the community in the new Zulip chat workspace at <a href="https://www.pythonpodcast.com/chat?utm_source=rss&amp;utm_medium=rss">pythonpodcast.com/chat</a></li> </ul> <h3>Links</h3> <ul> <li><a href="https://github.com/pschanely/CrossHair#ide-integrations?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">CrossHair</a></li> <li><a href="https://www.nltk.org/?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">NLTK == Natural Language ToolKit</a></li> <li><a href="https://en.wikipedia.org/wiki/ACL2?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">ACL2</a></li> <li><a href="https://ucsd-progsys.github.io/liquidhaskell-blog/?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">Liquid Haskell</a></li> <li><a href="https://en.wikipedia.org/wiki/Satisfiability_modulo_theories?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">SMT Solver</a></li> <li><a href="https://docs.python.org/3/library/doctest.html?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">Doctest</a></li> <li><a href="https://hypothesis.works/articles/what-is-property-based-testing/?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">Property Based Testing</a></li> <li><a href="https://hypothesis.readthedocs.io/?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">Hypothesis</a> <ul> <li><a href="https://www.pythonpodcast.com/episode-52-hypothesis-with-david-maciver/?utm_source=rss&amp;utm_medium=rss">Podcast Episode</a></li> </ul> </li> <li><a href="https://en.wikipedia.org/wiki/Halting_problem?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">Halting Problem</a></li> <li><a href="https://pydantic-docs.helpmanual.io/?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">Pydantic</a></li> <li><a href="https://www.python.org/dev/peps/pep-0316/?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">PEP 316</a></li> <li><a href="https://pypi.org/project/icontract/?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">icontract</a></li> <li><a href="https://en.wikipedia.org/wiki/Eiffel_(programming_language)?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">Eiffel</a> programming language</li> <li><a href="https://en.wikipedia.org/wiki/Design_by_contract?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">Design By Contract</a></li> <li><a href="https://en.wikipedia.org/wiki/Metamorphic_testing?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">Metamorphic Testing</a></li> <li><a href="https://en.wikipedia.org/wiki/Kind_(type_theory)?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">Higher Order Types</a></li> <li><a href="https://en.wikipedia.org/wiki/Fuzzing?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">Fuzz Testing</a></li> <li><a href="https://www.fuzzingbook.org/?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">The Fuzzing Book</a></li> <li><a href="https://docs.python.org/3/library/sys.html#sys.addaudithook?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">Python Audit Hooks</a></li> <li><a href="https://github.com/github/scientist?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">GitHub Scientist</a> <ul> <li><a href="https://github.com/joealcorn/laboratory?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">Laboratory</a> Python implementation of GitHub Scientist <ul> <li><a href="https://www.pythonpodcast.com/laboratory-with-joe-alcorn-episode-150/?utm_source=rss&amp;utm_medium=rss">Podcast Episode</a></li> </ul> </li> </ul> </li> <li><a href="https://en.wikipedia.org/wiki/Taint_checking?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">Taint Analysis</a></li> </ul> <p>The intro and outro music is from Requiem for a Fish <a href="http://freemusicarchive.org/music/The_Freak_Fandango_Orchestra/?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">The Freak Fandango Orchestra</a> / <a href="http://creativecommons.org/licenses/by-sa/3.0/?utm_source=rss&amp;utm_medium=rss" rel="noopener" target="_blank">CC BY-SA</a></p> </div> <img alt="" height="0" src="https://analytics.boundlessnotions.com/piwik.php?idsite=1&amp;rec=1&amp;url=https%3A%2F%2Fwww.pythonpodcast.com%2Fcrosshair-automated-bug-finder-episode-302%2F&amp;action_name=CrossHair%3A+Your+Automatic+Pair+Programmer+-+Episode+302&amp;urlref=https%3A%2F%2Fwww.pythonpodcast.com%2Ffeed%2F&amp;utm_source=rss&amp;utm_medium=rss" style="border: 0; width: 0; height: 0;" width="0" />