Date: Sat, 27 Jan 2018 22:00:00 -0500
<h3>Summary</h3> <p>One of the draws of Python is how dynamic and flexible the language can be. Sometimes, that flexibility can be problematic if the format of variables at various parts of your program is unclear or the descriptions are inaccurate. The growing middle ground is to use type annotations as a way of providing some verification of the format of data as it flows through your application and enforcing gradual typing. To make it simpler to get started with type hinting, Carl Meyer and Matt Page, along with other engineers at Instagram, created MonkeyType to analyze your code as it runs and generate the type annotations. In this episode they explain how that process works, how it has helped them reduce bugs in their code, and how you can start using it today.</p> <h3>Preface</h3> <ul> <li>Hello and welcome to Podcast.__init__, the podcast about Python and the people who make it great.</li> <li>I would like to thank everyone who supports us on <a href="https://www.pythonpodcast.com/podcastinit?utm_source=rss&utm_medium=rss">Patreon</a>. Your contributions help to make the show sustainable.</li> <li>When you’re ready to launch your next project you’ll need somewhere to deploy it. Check out Linode at <a href="https://www.pythonpodcast.com/linode?utm_source=rss&utm_medium=rss">podastinit.com/linode</a> and get a $20 credit to try out their fast and reliable Linux virtual servers for running your awesome app. And now you can deliver your work to your users even faster with the newly upgraded 200 GBit network in all of their datacenters.</li> <li>If you’re tired of cobbling together your deployment pipeline then it’s time to try out GoCD, the open source continuous delivery platform built by the people at ThoughtWorks who wrote the book about it. With GoCD you get complete visibility into the life-cycle of your software from one location. To download it now go to <a href="https://www.pythonpodcast.com/gocd?utm_source=rss&utm_medium=rss">podcatinit.com/gocd</a>. Professional support and enterprise plugins are available for added piece of mind.</li> <li>Visit the <a href="https://www.pythonpodcast.com?utm_source=rss&utm_medium=rss">site</a> 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 <a href="https://twtiter.com/podcastinit?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">@Podcast__init__</a> or email <a href="mailto:hosts@podcastinit.com">hosts@podcastinit.com</a>)</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&uo=6&at=&ct=&utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">iTunes</a>, or <a href="https://play.google.com/music/m/I7ogju4xv6adasgqz6545jndgsy?t=Podcastinit_-_Python_and_the_people_who_make_it_great&utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Google Play Music</a>, tell your friends and co-workers, and share it on social media.</li> <li>A few announcements before we start the show: <ul> <li>There’s still time to get your tickets for PyCon Colombia, happening February 9th and 10th. Go to <a href="https://www.pycon.co/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">pycon.co</a> to learn more and register.</li> <li>There is also still time to register for the O’Reilly Software Architecture Conference in New York Feb 25-28. Use the link <a href="https://www.pythonpodcast.com/sacon-new-york?utm_source=rss&utm_medium=rss">podcastinit.com/sacon-new-york</a> to register and save 20%</li> <li>If you work with data or want to learn more about how the projects you have heard about on the show get used in the real world then join me at the Open Data Science Conference in Boston from May 1st through the 4th. It has become one of the largest events for data scientists, data engineers, and data driven businesses to get together and learn how to be more effective. To save 60% off your tickets go to <a href="https://www.pythonpodcast.com/odsc-east-2018?utm_source=rss&utm_medium=rss">podcastinit.com/odsc-east-2018</a> and register.</li> </ul> </li> <li>Your host as usual is Tobias Macey and today I’m interviewing Carl Meyer and Matt Page about MonkeyType, a system to collect type information at runtime for your Python 3 code</li> </ul> <h3>Interview</h3> <ul> <li>Introductions</li> <li>How did you get introduced to Python?</li> <li>What is MonkeyType and how did the project get started?</li> <li>How much overhead does the MonkeyType tracing add to the running system, and what techniques have you used to minimize the impact on production systems?</li> <li>Given that the type information is collected from call traces at runtime, and some functions may accept multiple different types for the same arguments (e.g. <code>add</code>), do you have any logic that will allow for combining that information into a higher-order type that gets set as the annotation?</li> <li>How does MonkeyType function internally and how has the implementation evolved over the time that you have been working on it?</li> <li>Once the type annotations are present in your code base, what other tooling are you using to take advantage of that information?</li> <li>It seems as though using MonkeyType to trace your running production systems could be a way to inadvertantly identify dead sections of code that aren’t being executed. Have you investigated ways to use the collected type information perform that analysis?</li> <li>What have been some of the most challenging aspects of building, using, and maintaining MonkeyType?</li> <li>What have been some of the most interesting or noteworthy things that you have learned in the process of working on and with MonkeyType?</li> <li>What have you found to be the most useful and most problematic aspects of the typing capabilities provided in recent versions of Python?</li> <li>For someone who wants to start using MonkeyType today, what is involved in getting it set up and using it in a new or existing codebase?</li> <li>What features or improvements do you have planned for future releases of MonkeyType?</li> </ul> <h3>Keep In Touch</h3> <ul> <li>Carl <ul> <li><a href="mailto:carljm@instagram.com">Email</a></li> <li><a href="https://twitter.com/carljm?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">@carljm</a> on Twitter</li> </ul> </li> <li>Matt <ul> <li><a href="mailto:mpage@instagram.com">Email</a></li> <li><a href="https://twitter.com/void_star?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">@voidstar</a> on Twitter</li> </ul> </li> </ul> <h3>Picks</h3> <ul> <li>Tobias <ul> <li><a href="http://amzn.to/2Glzhbz?utmsource=rss&utmmedium=rss" rel="noopener" target="blank">LyxPro HAS-30 Headphones</a></li> </ul> </li> <li>Carl <ul> <li><a href="http://amzn.to/2Eg6VPo?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Broadchurch</a></li> <li><a href="http://amzn.to/2EfRBSV?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Happy Valley</a></li> </ul> </li> <li>Matt <ul> <li><a href="http://amzn.to/2nijamv?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Anova Sous Vide</a></li> </ul> </li> </ul> <h3>Links</h3> <ul> <li><a href="https://github.com/Instagram/MonkeyType?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">MonkeyType</a></li> <li><a href="https://www.instagram.com/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Instagram</a></li> <li><a href="http://www.diveintopython3.net/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Dive Into Python</a></li> <li><a href="https://docs.python.org/3/library/typing.html?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Python 3 Typing Module</a></li> <li>MyPy <ul> <li><a href="https://github.com/python/mypy?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Project Page</a></li> <li><a href="https://www.pythonpodcast.com/episode-65-mypy-with-david-fisher-and-greg-price/?utm_source=rss&utm_medium=rss">Podcast.<strong>init</strong> Interview</a></li> </ul> </li> <li><a href="https://en.wikipedia.org/wiki/Mike_Krieger?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Mike Krieger</a></li> <li><a href="https://github.com/dropbox/pyannotate?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">PyAnnotate</a></li> <li><a href="https://www.python.org/dev/peps/pep-0484/#the-meaning-of-annotations?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Type Annotations</a></li> <li><a href="https://www.python.org/dev/peps/pep-0484/#stub-files?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Type Stubs</a></li> <li><a href="https://www.python.org/dev/peps/pep-0523/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">PEP 523</a> frame evaluation api</li> <li><a href="https://feeds.fireside.fm/pythonpodcast/rss">Scuba</a></li> <li><a href="https://www.haskell.org/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Haskell</a></li> <li><a href="https://www.rust-lang.org/en-US/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Rust</a></li> <li><a href="https://www.python.org/dev/peps/pep-0563/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">PEP 563</a> Postponed Evaluation of Annotations</li> <li><a href="https://www.destroyallsoftware.com/talks/ideology?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Gary Bernhardt – Ideology</a></li> <li><a href="https://bitbucket.org/ned/coveragepy?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">coverage.py</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&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&utm_medium=rss" rel="noopener" target="_blank">CC BY-SA</a><img alt="" height="0" src="https://analytics.boundlessnotions.com/piwik.php?idsite=1&rec=1&url=https%3A%2F%2Fwww.pythonpodcast.com%2Fmonkeytype-with-carl-meyer-and-matt-page-episode-146%2F&action_name=MonkeyType+with+Carl+Meyer+and+Matt+Page+-+Episode+146&urlref=https%3A%2F%2Fwww.pythonpodcast.com%2Ffeed%2F&utm_source=rss&utm_medium=rss" style="border: 0; width: 0; height: 0;" width="0" /></p>