# Untangling our Python Code

DevFeed: [Untangling our Python Code](<https://devfeed.tech/articles/untangling-our-python-code-27401.md>)

Original publisher: [Read original article](<http://engineering.khanacademy.org/posts/python-refactor-3.htm>)

Author: Khan Academy

Published: 2018-04-16T22:00:00Z

Content type: tutorial

Language: en

Sources: [Khan Academy](<https://devfeed.tech/sources/khan-academy.md>)

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

Tags: [code](<https://devfeed.tech/tags/code.md>), [dependencies](<https://devfeed.tech/tags/dependencies.md>), [dependency](<https://devfeed.tech/tags/dependency.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [infrastructure](<https://devfeed.tech/tags/infrastructure.md>), [news](<https://devfeed.tech/tags/news.md>), [organization](<https://devfeed.tech/tags/organization.md>), [python](<https://devfeed.tech/tags/python.md>), [refactor](<https://devfeed.tech/tags/refactor.md>), [structure](<https://devfeed.tech/tags/structure.md>)

## AI overview

This article explains how Khan Academy addressed tangled dependencies in its Python codebase during its 2017 and 2018 refactoring work. It describes why dependency order matters, the problems caused by circular and poorly organized imports, and the use of package-based rules to guide code organization and detect problematic dependencies.

## Source excerpt

By Carter Bastian The previous posts about The Great Khan Academy Python Refactor of 2017 and Also 2018 ... Read more