Date: Mon, 30 May 2022 16:00:00 -0400
<div class="wp-block-jetpack-markdown"><h2>Summary</h2> <p>Most developers have encountered code completion systems and rely on them as part of their daily work. They allow you to stay in the flow of programming, but have you ever stopped to think about how they work? In this episode Meredydd Luff takes us behind the scenes to dig into the mechanics of code completion engines and how you can customize them to fit your particular use case.</p> <h2>Announcements</h2> <ul> <li>Hello and welcome to Podcast.__init__, the podcast about Python’s role in data and science.</li> <li>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 <a href="https://www.pythonpodcast.com/linode?utm_source=rss&utm_medium=rss">pythonpodcast.com/linode</a> 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!</li> <li>Your host as usual is Tobias Macey and today I’m interviewing Meredydd Luff about how code completion works and what it takes to build your own</li> </ul> <h2>Interview</h2> <ul> <li>Introductions</li> <li>How did you get introduced to Python?</li> <li>Most programmers are familiar with the idea of code completion, but can you just give the elevator pitch to get us all on the same page?</li> <li>You gave a presentation recently at PyCon about how to build a code completion system. What was your approach to identifying what fundamental concepts needed to be addressed and how to fit that lesson into the available time?</li> <li>In the presentation you mentioned that you had built a more full-featured completion engine into Anvil. Can you describe what possessed you to build your own code completion tool? <ul> <li>What are the core components required to build a completion engine?</li> <li>What are the benefits that can be realized by customizing the completion engine for a given language or task?</li> </ul> </li> <li>Can you describe the feature set and implementation details of the full-fledged completion engine that is available in Anvil?</li> <li>Beyond the toy example, there are a number of considerations to address if you want to make the completion engine "production grade". Can you talk through some of the obvious edge cases and how to solve for them? (e.g. handling parsing of incomplete code)</li> <li>What are the inputs that you use to build up the list of candidate tokens for completion?</li> <li>Once you have a functioning baseline for offering completions, what are some of the signals that you hook into for ranking suggestions?</li> <li>In your presentation you leaned on the machinery available in the Python standard library. What are some of the ways that you might think about generalizing across languages vs. coupling to a given language?</li> <li>What design/architectural advice do you have for compartmentalizing logic in a full-featured completion engine?</li> <li>What are some of the complexities that become a factor when you are trying to scale across an entire code base?</li> <li>Beyond just being able to parse and process a body of code, there is also the question of integrating with the development environment. What are some of the challenges that get introduced when trying to access the appropriate set(s) of files and code through the editor interface(s)?</li> <li>What are the most interesting, innovative, or unexpected ways that you have seen code completion applied to developer experience?</li> <li>What are the most interesting, unexpected, or challenging lessons that you have learned while working on code completion for Anvil?</li> <li>When is code completion more effort than it’s worth?</li> <li>What do you have planned for the future of the Anvil code completion functionality?</li> </ul> <h2>Keep In Touch</h2> <ul> <li><a href="https://www.linkedin.com/in/meredydd/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">LinkedIn</a></li> <li><a href="https://github.com/meredydd?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">meredydd</a> on GitHub</li> <li><a href="https://twitter.com/meredydd?lang=en&utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">@meredydd</a> on Twitter</li> </ul> <h2>Picks</h2> <ul> <li>Tobias <ul> <li><a href="https://www.weirdal.com/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">"Weird Al" Yankovic</a></li> </ul> </li> <li>Meredydd <ul> <li><a href="https://www.timescale.com/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">TimescaleDB</a> <ul> <li><a href="https://www.dataengineeringpodcast.com/timescaledb-round-2-episode-65/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Data Engineering Podcast Episode</a></li> </ul> </li> <li><a href="https://www.timescale.com/promscale?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Promscale</a></li> </ul> </li> </ul> <h2>Closing Announcements</h2> <ul> <li>Thank you for listening! Don’t forget to check out our other show, the <a href="https://www.dataengineeringpodcast.com?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Data Engineering Podcast</a> for the latest on modern data management.</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 mailing list, and read the show notes.</li> <li>If you’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&uo=6&at=&ct=&utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">iTunes</a> and tell your friends and co-workers</li> </ul> <h2>Links</h2> <ul> <li><a href="https://www.youtube.com/watch?v=aRO7DkJrA_c&utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">PyCon presentation about building a completion engine</a></li> <li><a href="https://anvil.works/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Anvil</a> <ul> <li><a href="https://www.pythonpodcast.com/anvil-web-application-development-episode-215/?utm_source=rss&utm_medium=rss">Podcast Episode</a></li> </ul> </li> <li><a href="https://www.nano-editor.org/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Nano</a></li> <li><a href="https://microsoft.github.io/language-server-protocol/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Language Server Protocol</a></li> <li><a href="https://jedi.readthedocs.io/en/latest/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Jedi</a> <ul> <li><a href="https://www.pythonpodcast.com/episode-113-jedi-code-completion-with-david-halter/?utm_source=rss&utm_medium=rss">Podcast Episode</a></li> </ul> </li> <li><a href="https://skulpt.org/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Skulpt</a></li> <li><a href="https://en.wikipedia.org/wiki/Parsing?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Parser</a></li> <li><a href="https://en.wikipedia.org/wiki/Abstract_syntax_tree?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Abstract Syntax Tree</a></li> <li><a href="https://www.openapis.org/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">OpenAPI</a></li> <li><a href="https://copilot.github.com/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">GitHub Copilot</a></li> <li><a href="https://en.wikipedia.org/wiki/Halting_problem?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Halting Problem</a></li> <li><a href="https://ocw.mit.edu/ans7870/6/6.005/s16/classes/18-parser-generators/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Parser Generator</a></li> <li><a href="https://docs.python.org/3/reference/grammar.html?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Python Language Grammar Definition</a></li> <li><a href="https://lezer.codemirror.net/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Lezer Parser Generator</a></li> <li><a href="https://github.com/tree-sitter/tree-sitter?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Tree-sitter</a></li> <li><a href="https://pyscript.net/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">PyScript</a></li> <li><a href="https://grafana.com/oss/tempo/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Grafana Tempo Tracing Service</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></p> </div> <img alt="" height="0" src="https://analytics.boundlessnotions.com/piwik.php?idsite=1&rec=1&url=https%3A%2F%2Fwww.pythonpodcast.com%2Fcode-completion-deep-dive-episode-366%2F&action_name=Take+A+Deep+Dive+On+How+Code+Completion+Works+And+How+To+Customize+It+-+Episode+366&urlref=https%3A%2F%2Fwww.pythonpodcast.com%2Ffeed%2F&utm_source=rss&utm_medium=rss" style="border: 0; width: 0; height: 0;" width="0" />