We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

Exploring the Python AST Ecosystem

00:00

Formal Metadata

Title
Exploring the Python AST Ecosystem
Title of Series
Number of Parts
132
Author
License
CC Attribution - NonCommercial - ShareAlike 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this
Identifiers
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
This session will introduce attendees to Python's rich ecosystem of abstract syntax tree tooling and libraries, with an emphasis on practical applications in static analysis and metaprogramming. Attendees should be fully comfortable with Python syntax and semantics, but familiarity with the ast module itself will not be necessary. The talk will begin with a conceptual overview of ASTs, including a brief look at Python's built-in introspection capabilities. It will introduce tools for AST visualization (astor, showast, python-ast-explorer), creation (asttools, meta), and transformation to source code (codegen). How the AST can be used for static analysis will be covered; this will include discussion of Python's built-in facilities (NodeVisitor) as well as of the 3rd party tools astsearch, astpath, and bellybutton. The talk will demonstrate the advantages and limits of these tools in comparison to other static analysis tooling (pylint, mypy); particular attention will be paid to how these tools can be incorporated into attendees' workflows and existing codebases and projects. Tooling for Python AST manipulation and metaprogramming will be the final topic covered, focusing on the use of the NodeTransformer built-in. The talk will cover practical applications and examples of metaprogramming, such as metaprogramming for DSLS (pony, xpyth), runtime code manipulation (patterns, yield-from), and others (e.g. assertion rewriting in pytest). While the talk will touch only briefly on each of the applications discussed, by the end of the session attendees should have a firm grasp of the kinds of problems the AST can be used to solve, what existing AST tooling can accomplish, and what resources are available for the development of their own AST tools.
Abstract syntax treeMathematical analysisCodeWindowAbstract syntax treeCartesian coordinate systemLambda calculusBytecodeDifferent (Kate Ryan album)ExpressionElectric generatorReverse engineeringOperator (mathematics)Type theoryAbstract syntaxRepresentation (politics)BitElectronic mailing listNumbering schemeCellular automatonRight angleAbstractionIdeal (ethics)System callData compressionCodePlatonic solidMonad (category theory)CompilerRun time (program lifecycle phase)Module (mathematics)Visualization (computer graphics)FunktionalanalysisInformationObject (grammar)Virtual machineGroup actionInstallation artCore dumpInclusion mapSource code4 (number)MereologyPhysical systemSocial classNetwork topologyIntegrated development environmentSoftware testingHypothesisFluid staticsInstance (computer science)Real numberPoisson-KlammerSpacetimeLine (geometry)String (computer science)Medical imagingComputer fileRevision controlVariable (mathematics)Entire functionQuicksortPoint (geometry)AdditionMetric systemMoment (mathematics)Inheritance (object-oriented programming)Data storage deviceStatement (computer science)WritingLaptopMathematical optimizationComputing platformParsingInstallable File SystemINTEGRALComputer programmingCondition numberEndliche ModelltheorieComputer animation
Mathematical analysisFluidExecution unitRegulärer Ausdruck <Textverarbeitung>Pauli exclusion principlePattern languageMaxima and minimaLocal GroupExpressionAttribute grammarProjective planeQuicksortCASE <Informatik>Power (physics)Multiplication signCodeCartesian coordinate systemFluid staticsPhysical systemFunktionalanalysisComplex analysisSource codeStatement (computer science)Object (grammar)CounterexampleRepresentation (politics)Module (mathematics)DatabaseRight angleSystem callElement (mathematics)Level (video gaming)Abstract syntax treePattern languageRule of inferenceElectronic mailing listInstance (computer science)Functional programmingError messageLine (geometry)Variable (mathematics)Maxima and minimaLoop (music)File formatCategory of beingSocial classComputer filePositional notationMatching (graph theory)Software repositoryMathematical analysisNetwork topologyInheritance (object-oriented programming)Point (geometry)Software testingComputer programmingParsingNumbering schemeGraph (mathematics)Telephone number mappingProfil (magazine)Human migrationDifferent (Kate Ryan album)Cycle (graph theory)Regulärer Ausdruck <Textverarbeitung>IntegerRevision controlDescriptive statisticsKey (cryptography)Pauli exclusion principleTerm (mathematics)Data dictionaryWrapper (data mining)Arrow of timePlastikkarteSpacetimeHash functionAbstract syntaxComputer animation
Abstract syntax treeHardware-in-the-loop simulationLoginMessage passingString (computer science)Drum memoryUser interfaceFormal grammarCodeTransformation (genetics)Abstract syntax treeFigurate numberModule (mathematics)Exception handlingKey (cryptography)BitSource codeMatching (graph theory)Social classInterior (topology)Line (geometry)Cellular automatonAttribute grammarFunktionalanalysisGoodness of fitSlide ruleInheritance (object-oriented programming)Data compressionFluid staticsComputer programmingElectronic mailing listQuicksortMessage passingString (computer science)DampingExecution unitSoftware developerDynamical systemLetterpress printingType theoryPhysical systemObject (grammar)Error messageProcess (computing)Data structureFunction (mathematics)Electronic program guideArtificial lifeLibrary (computing)MathematicsFormal languageRegulärer Ausdruck <Textverarbeitung>Reading (process)Greatest elementTemplate (C++)View (database)Right angleComputer fileNetwork topologyForm (programming)File formatCartesian coordinate systemMereologySoftware testingVideo gameStatement (computer science)Instance (computer science)Differenz <Mathematik>Integrated development environmentData miningProduct (business)ParsingRange (statistics)Sequel2 (number)Metric systemRevision controlMathematical singularityUnit testingTypprüfungDifferent (Kate Ryan album)BuildingData conversionProfil (magazine)ExpressionSign (mathematics)Single-precision floating-point formatComputer animation
Query languageSoftware testingSource codeAbstract syntax treeVirtual machineComputer programmingExpressionPauli exclusion principleEquivalence relation1 (number)QuicksortError messageMereologyData storage deviceChannel capacityResultantString (computer science)Fluid staticsClosed setLine (geometry)EmailValidity (statistics)Automatic differentiationImplementationReal numberSoftware testingNumbering schemeMathematicsRegular graphProcess (computing)Module (mathematics)Transformation (genetics)Pattern matchingBranch (computer science)Latent heatCodeSyntaxbaumElectric generatorMappingVirtual machineComputer programmingSource codeStructural loadProduct (business)Scripting languageQuery languageType theoryInterpreter (computing)Projective planeFigurate numberSpacetimeBitAreaInstance (computer science)Control flowMonad (category theory)Block (periodic table)Keyboard shortcutDomain nameSimilarity (geometry)Sound effectInverter (logic gate)Arrow of timeRegulärer Ausdruck <Textverarbeitung>Series (mathematics)Term (mathematics)Right angleStatement (computer science)CurvatureGoodness of fitSlide ruleEqualiser (mathematics)Different (Kate Ryan album)Revision controlMultiplication signAbstract syntax treePermutationTrailRandomizationBoilerplate (text)Suite (music)Macro (computer science)Metric systemParticle systemSequelFront and back endsMilitary baseCondition numberSystem callOperator (mathematics)Presentation of a groupForm (programming)Rule of inferenceFormal languageSoftware developerLevel (video gaming)Pattern languagePoint (geometry)Computer animation
Transcript: English(auto-generated)