Date: Mon, 05 Apr 2021 21:00:00 -0400
<div class="wp-block-jetpack-markdown"><h3>Summary</h3> <p>When you are writing code it is all to easy to introduce subtle bugs or leave behind unused code. Unused variables, unused imports, overly complex logic, etc. If you are careful and diligent you can find these problems yourself, but isn’t that what computers are supposed to help you with? Thankfully Python has a wealth of tools that will work with you to keep your code clean and maintainable. In this episode Anthony Sottile explores Flake8, one of the most popular options for identifying those problematic lines of code. He shares how he became involved in the project and took over as maintainer and explains the different categories of code quality tooling and how Flake8 compares to other static analyzers. He also discusses the ecosystem of plugins that have grown up around it, including some detailed examples of how you can write your own (and why you might want to).</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 Anthony Sottile about Flake8</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 Flake8 is and how you got involved with the project?</li> <li>There are a variety of tools available for checking or enforcing code quality. How would you characterize Flake8 in comparison to the other options?</li> <li>What do you see as the motivating factors for individuals or teams to integrate static analysis/linting in their toolchain and workflow? <ul> <li>What are some of the challenges that might prevent someone from adopting something like Flake8?</li> <li>How can developers add Flake8 to an existing project without spending hours or days fixing all of the violations?</li> </ul> </li> <li>Can you describe the overall design and implementation of Flake8? <ul> <li>How has the design and goals of the project changed or evolved?</li> </ul> </li> <li>There are a wide array of plugins for Flake8. What is involved in adding new functionality or linting rules? <ul> <li>What capabilities does Flake8 provide that make it a viable platform for building plugins?</li> <li>What are some of the limitations of Flake8 as a platform?</li> </ul> </li> <li>What do you see as the factors that have contributed to the widespread usage of Flake8 and the large number of available plugins? <ul> <li>What challenges does that pose as a maintainer of Flake8?</li> </ul> </li> <li>What are some of the other tools that you see developers use alongside Flake8 to help manage code quality and style enforcement?</li> <li>What are some of the most interesting, innovative, or unexpected ways that you have seen Flake8 and its plugin ecosystem used?</li> <li>What are the most interesting, unexpected, or challenging lessons that you have learned while working on Flake8?</li> <li>When is Flake8 the wrong choice?</li> <li>What do you have planned for the future of Flake8?</li> </ul> <h3>Keep In Touch</h3> <ul> <li><a href="https://twitter.com/codewithanthony?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">@codewithanthony</a> on Twitter</li> <li><a href="https://github.com/asottile?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">asottile</a> on GitHub</li> <li><a href="https://www.linkedin.com/in/anthony-sottile-940008b1/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">LinkedIn</a></li> </ul> <h3>Picks</h3> <ul> <li>Tobias <ul> <li><a href="https://www.nealstephenson.com/seveneves.html?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">SEVENEVES</a> by Neal Stephenson</li> </ul> </li> <li>Anthony <ul> <li><a href="https://pre-commit.ci/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">pre-commit CI</a></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://flake8.pycqa.org/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Flake8</a></li> <li><a href="https://github.com/PyCQA/pyflakes?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">PyFlakes</a></li> <li><a href="https://pycodestyle.pycqa.org/en/latest/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">PyCodestyle</a></li> <li><a href="https://github.com/pycqa/mccabe?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">McCabe</a></li> <li><a href="https://pre-commit.com/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">pre-commit</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> <li><a href="https://www.python.org/dev/peps/pep-0484/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">PEP 484</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://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance&utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Pylance</a></li> <li><a href="https://github.com/microsoft/pyright?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Pyright</a></li> <li><a href="http://pylint.pycqa.org/en/latest/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Pylint</a></li> <li><a href="https://black.readthedocs.io/en/stable/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Black</a></li> <li><a href="https://github.com/google/yapf?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">yapf</a></li> <li><a href="https://pypi.org/project/autopep8/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">autopep8</a></li> <li><a href="https://github.com/asottile/pyupgrade?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">pyupgrade</a></li> <li><a href="https://pycqa.github.io/isort/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">isort</a></li> <li><a href="https://github.com/asottile/reorder_python_imports?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">reorder-python-imports</a></li> <li><a href="https://en.wikipedia.org/wiki/Static_program_analysis?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Static Analysis</a></li> <li><a href="http://www.pydocstyle.org/en/stable/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">pydocstyle</a></li> <li><a href="https://github.com/myint/autoflake?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">autoflake</a></li> <li><a href="https://snarky.ca/what-the-heck-is-pyproject-toml/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">pyproject.toml</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://en.wikipedia.org/wiki/Parse_tree?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Concrete Syntax Tree</a></li> <li><a href="https://dagster.io/?utm_source=rss&utm_medium=rss" rel="noopener" target="_blank">Dagster</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%2Fflake8-static-analysis-episode-309%2F&action_name=Keep+Your+Code+Clean+And+Maintainable+Using+Static+Analysis+With+Flake8+-+Episode+309&urlref=https%3A%2F%2Fwww.pythonpodcast.com%2Ffeed%2F&utm_source=rss&utm_medium=rss" style="border: 0; width: 0; height: 0;" width="0" />