# Using Python AST to resolve dependencies

DevFeed: [Using Python AST to resolve dependencies](<https://devfeed.tech/articles/using-python-ast-to-resolve-dependencies-39624.md>)

Original publisher: [Read original article](<https://www.gauravsarma.com/posts/2023-06-30_Using-Python-AST-to-resolve-dependencies-c849bd184020>)

Published: 2023-06-30T00:00:00Z

Content type: tutorial

Language: en

Sources: [Gaurav Sarma's Blog](<https://devfeed.tech/sources/gaurav-sarma-s-blog.md>)

Topics: [Python](<https://devfeed.tech/topics/python.md>), [Parsing](<https://devfeed.tech/topics/parsing.md>), [syntax](<https://devfeed.tech/topics/syntax.md>), [modules](<https://devfeed.tech/topics/modules.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [article](<https://devfeed.tech/tags/article.md>), [ast](<https://devfeed.tech/tags/ast.md>), [code](<https://devfeed.tech/tags/code.md>), [dependencies](<https://devfeed.tech/tags/dependencies.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [import](<https://devfeed.tech/tags/import.md>), [modules](<https://devfeed.tech/tags/modules.md>), [object](<https://devfeed.tech/tags/object.md>), [python](<https://devfeed.tech/tags/python.md>), [python-dependencies](<https://devfeed.tech/tags/python-dependencies.md>), [repository](<https://devfeed.tech/tags/repository.md>), [resolver](<https://devfeed.tech/tags/resolver.md>), [startup](<https://devfeed.tech/tags/startup.md>), [syntax](<https://devfeed.tech/tags/syntax.md>), [tokens](<https://devfeed.tech/tags/tokens.md>), [trees](<https://devfeed.tech/tags/trees.md>), [unit-tests](<https://devfeed.tech/tags/unit-tests.md>)

## AI overview

This tutorial explains how to use Python's Abstract Syntax Trees to resolve dependencies among objects imported across modules in a complex repository. It proposes recursively analyzing imports and copying required object code and dependencies into a destination folder.

## Source excerpt

This article covers how to resolve python dependencies using Python's Abstract Syntax Trees (AST). There are different and maybe better ways to understand the scope of your python dependencies...