
The Python Podcast.__init__
Automatically Enforce Software Structures With Powerful Code Modifications Powered By LibCST
Apr 25, 2022 · 56 min · Episode 361 · 43.4 MB
0:00-56:48
Streams straight from the publisher. podnod never proxies or re-hosts episode audio.
Summary
Programmers love to automate tedious processes, including refactoring your code. In order to support the creation of code modifications for your Python projects Jimmy Lai created LibCST. It provides a richly typed and high level API for creating and manipulating concrete syntax trees of your source code. In this episode Jimmy Lai and Zsolt Dollenstein explain how it works, some of the linting and automatic code modification utilities that you can build with it and how to get started with using it to maintain your own Python projects.
Announcements
- Hello and welcome to Podcast.__init__, the podcast about Python’s role in data and science.
- 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 pythonpodcast.com/linode 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!
- Your host as usual is Tobias Macey and today I’m interviewing Zsolt Dollenstein and Jimmy Lai about LibCST, a concrete syntax tree parser and serializer library for Python
Interview
- Introductions
- How did you get introduced to Python?
- Can you describe what LibCST is and the story behind it?
- How does a concrete syntax tree differ from an abstract syntax tree?
- What are some of the situations where the preservation of the exact structure is necessary?
- There are a few other libraries in Python for creating concrete syntax trees. What was missing in the available options that made it necessary to create LibCST?
- What are the use cases that LibCST is focused on supporting
- Can you describe how LibCST is implemented?
- How have the design and goals of the project changed or evolved since you started working on it?
- How might I use LibCST for something like restructuring a set of modules to move a function definition while maintaining proper imports?
- How do the capabilities of LibCST for codemodding compare to the Rope framework?
- What are some other workflows that someone might build with LibCST?
- What are some of the ways that LibCST is being used in your own work?
- What are the most interesting, innovative, or unexpected ways that you have seen LibCST used?
- What are the most interesting, unexpected, or challenging lessons that you have learned while working on LibCST?
- When is LibCST the wrong choice?
- What do you have planned for the future of LibCST?
Keep In Touch
Picks
- Tobias
- Zsolt
- Jimmy
- Paying down technical debt
Closing Announcements
- Thank you for listening! Don’t forget to check out our other show, the Data Engineering Podcast for the latest on modern data management.
- Visit the site to subscribe to the show, sign up for the mailing list, and read the show notes.
- If you’ve learned something or tried out a project from the show then tell us about it! Email hosts@podcastinit.com) with your story.
- To help other people find the show please leave a review on iTunes and tell your friends and co-workers
Links
- LibCST
- Carta
- lib2to3
- Abstract Syntax Tree
- Concrete Syntax Tree
- Pyre
- Parso
- Cython
- mypyc
- Rope
- Flake8
- Pylint
- ESLint
- Fixit
- MonkeyType
The intro and outro music is from Requiem for a Fish The Freak Fandango Orchestra / CC BY-SA
pythonpodcast.com/linode
pythonpodcast.comzsol
github.comLinkedIn
linkedin.comjimmylai
github.comLinkedIn
linkedin.comOsprey Manta Backpack
osprey.comAutotransform
github.comGlean
glean.softwareData Engineering Podcast
dataengineeringpodcast.comsite
pythonpodcast.comiTunes
itunes.apple.comLibCST
github.comCarta
carta.comlib2to3
docs.python.orgAbstract Syntax Tree
en.wikipedia.orgConcrete Syntax Tree
en.wikipedia.orgPyre
pyre-check.orgParso
parso.readthedocs.ioCython
cython.orgPodcast Episode
pythonpodcast.commypyc
github.comRope
github.comFlake8
flake8.pycqa.orgPodcast Episode
pythonpodcast.comPylint
pylint.pycqa.orgESLint
eslint.orgFixit
github.comMonkeyType
github.comPodcast Episode
pythonpodcast.comThe Freak Fandango Orchestra
freemusicarchive.orgCC BY-SA
creativecommons.org
- 0:13Introduction and Guest Introduction
- 1:07Scholz and Jimmy's Backgrounds
- 2:02First Encounters with Python
- 2:47Overview of LibCST
- 6:12Concrete Syntax Tree vs Abstract Syntax Tree
- 9:16LibCST's Unique Features
- 13:21Implementation and Architecture of LibCST
- 17:10Evolution and Goals of LibCST
- 21:15Performance and Optimization
- 25:06Using LibCST for Code Mods
- 31:06Linting with LibCST and Fixit
- 37:04Structure and Use Cases of Fixit
- 43:46Lessons Learned from LibCST
- 47:12When Not to Use LibCST
- 49:18Future Plans for LibCST
- 50:34Closing Remarks