Date: Mon, 29 Mar 2021 22:00:00 -0400
<div class="wp-block-jetpack-markdown"><h3>Summary</h3> <p>Writing code that is easy to read and understand will have a lasting impact on you and your teammates over the life of a project. Sometimes it can be difficult to identify opportunities for simplifying a block of code, especially if you are early in your journey as a developer. If you work with senior engineers they can help by pointing out ways to refactor your code to be more readable, but they aren’t always available. Brendan Maginnis and Nick Thapen created Sourcery to act as a full time pair programmer sitting in your editor of choice, offering suggestions and automatically refactoring your Python code. In this episode they share their journey of building a tool to automatically find opportunities for refactoring in your code, including how it works under the hood, the types of refactoring that it supports currently, and how you can start using it in your own work today. It always pays to keep your tool box organized and your tools sharp and Sourcery is definitely worth adding to your repertoire.</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’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>We’ve all been asked to help with an ad-hoc request for data by the sales and marketing team. Then it becomes a critical report that they need updated every week or every day. Then what do you do? Send a CSV via email? Write some Python scripts to automate it? But what about incremental sync, API quotas, error handling, and all of the other details that eat up your time? Today, there is a better way. With Census, just write SQL or plug in your dbt models and start syncing your cloud warehouse to SaaS applications like Salesforce, Marketo, Hubspot, and many more. Go to <a href="https://www.pythonpodcast.com/census?utm_source=rss&utm_medium=rss">pythonpodcast.com/census</a> today to get a free 14-day trial.</li> <li>Your host as usual is Tobias Macey and today I’m interviewing Nick Thapen and Brendan Maginnis about Sourcery, an advanced refactoring engine that cleans up your code as you work</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 Sourcery is?</li> <li>What was your motivation for building a system for performing automated refactoring? <ul> <li>What are your goals and priorities with Sourcery?</li> </ul> </li> <li>There are a number of services that aim to automate portions of the developer workflow, such as code completions, quality checks, refactoring, etc. What was lacking in the existing tooling that made Sourcery a necessary project? <ul> <li>How does Sourcery compare with some of the other services that offer AI or ML powered assistance? (e.g. Kite, Tab9, Codata(?))</li> </ul> </li> <li>What was your reasoning for focusing solely on Python for your refactoring, rather than trying to support multiple language targets?</li> <li>Can you give some examples of the types of refactoring that you are able to automate?</li> <li>Can you describe how Sourcery is implemented? <ul> <li>What are some of the ways that the system has changed or evolved in design and/or scope?</li> </ul> </li> <li>What are some examples of the types of refactorings that Sourcery is ill-suited for and which still require manual intervention?</li> <li>What is involved in adding support for a new editor? <ul> <li>How much variation is there in terms of implementation or available functionality across editors?</li> <li>How has the introduction of the Language Server Protocol influenced your approach to editor integration?</li> </ul> </li> <li>What are some of the most interesting, unexpected, or challenging lessons that you have learned while working on Sourcery?</li> <li>When is Sourcery the wrong choice?</li> <li>What do you have planned for the future of Sourcery</li> </ul> <h3>Keep In Touch</h3> <ul> <li>Nick <ul> <li><a href="https://www.linkedin.com/in/nicholas-thapen/?originalSubdomain=uk&utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">LinkedIn</a></li> <li><a href="https://twitter.com/nthapen?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">@nthapen</a> on Twitter</li> </ul> </li> <li>Brendan <ul> <li><a href="https://www.linkedin.com/in/brendan-maginnis/?originalSubdomain=uk&utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">LinkedIn</a></li> <li><a href="https://twitter.com/brendan_m6s?lang=en&utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">@brendan_m6s</a> on Twitter</li> <li><a href="https://github.com/brendanator?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">brendanator</a> on GitHub</li> </ul> </li> </ul> <h3>Picks</h3> <ul> <li>Tobias <ul> <li><a href="https://www.imdb.com/title/tt2850386/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">The Croods: New Age</a></li> </ul> </li> <li>Nick <ul> <li><a href="https://www.syfy.com/the-magicians?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">The Magicians</a> TV Series</li> </ul> </li> <li>Brendan <ul> <li><a href="https://en.wikipedia.org/wiki/David_Copperfield?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">David Copperfield</a> by Charles Dickens</li> </ul> </li> </ul> <h3>Closing Announcements</h3> <ul> <li>Thank you for listening! Don’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&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> <li>Join the community in the new Zulip chat workspace at <a href="https://www.pythonpodcast.com/chat?utm_source=rss&utm_medium=rss">pythonpodcast.com/chat</a></li> </ul> <h3>Links</h3> <ul> <li><a href="https://sourcery.ai/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Sourcery</a></li> <li><a href="https://en.wikipedia.org/wiki/IBM_RPG?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">IBM RPG</a></li> <li><a href="https://en.wikipedia.org/wiki/Delphi_(software)?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Delphi</a></li> <li><a href="https://en.wikipedia.org/wiki/Java_(programming_language)?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Java</a></li> <li><a href="https://www.scala-lang.org/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Scala</a></li> <li><a href="https://pytorch.org/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">PyTorch</a> <ul> <li><a href="https://www.pythonpodcast.com/pytorch-deep-learning-epsiode-202/?utm_source=rss&utm_medium=rss">Podcast Episode</a></li> </ul> </li> <li><a href="https://en.wikipedia.org/wiki/Natural_language_processing?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">NLP == Natural Language Processing</a></li> <li><a href="https://www.tensorflow.org/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Tensorflow</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://en.wikipedia.org/wiki/Kent_Beck?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Kent Beck</a></li> <li><a href="https://martinfowler.com/aboutMe.html?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Martin Fowler</a></li> <li><a href="http://mypy-lang.org/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">MyPy</a></li> <li><a href="https://clojure.org/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Clojure</a></li> <li><a href="https://en.wikipedia.org/wiki/Lisp_(programming_language)?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Lisp</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://github.com/PyCQA/astroid?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">ASTroid</a> <ul> <li><a href="https://www.pythonpodcast.com/episode-35-sylvain-thenault-on-astroid/?utm_source=rss&utm_medium=rss">Podcast Episode</a></li> </ul> </li> <li><a href="https://github.com/python-rope/rope?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Rope</a></li> <li><a href="https://sans-io.readthedocs.io/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Sans I/O</a></li> <li><a href="https://pre-commit.com/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">pre-commit framework</a> <ul> <li><a href="https://www.pythonpodcast.com/pre-commit-with-anthony-sottile-episode-178/?utm_source=rss&utm_medium=rss">Podcast Episode</a></li> </ul> </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%2Fsourcery-automated-python-refactoring-episode-308%2F&action_name=Make+Your+Code+More+Readable+With+The+Magic+Of+Refactoring+Using+Sourcery+-+Episode+308&urlref=https%3A%2F%2Fwww.pythonpodcast.com%2Ffeed%2F&utm_source=rss&utm_medium=rss" style="border: 0; width: 0; height: 0;" width="0" />