Home / Companies / Tabnine / Blog / Post Details
Content Deep Dive

Why so many Python projects lack dependencies management in git, and what you can do about it

Blog post from Tabnine

Post Details
Company
Date Published
Author
Tabnine Team
Word Count
876
Language
English
Hacker News Points
-
Summary

Modern software development heavily relies on external libraries, with Python being no exception, as projects frequently utilize libraries like Flask, boto3, or pandas. A study of over 500,000 Python repositories on GitHub discovered that a significant majority of these projects lacked a dependencies management file, despite having import clauses for PyPi libraries. This contrasts with JavaScript projects, where dependency files are more commonly included in version control. The absence of such files in Python projects may be attributed to Python's nature as a flexible, on-demand tool favored for data analysis, which often leads to informal coding practices. Although tracking dependencies can be cumbersome, it is essential for maintaining the functionality of code over time. To facilitate this, developers are encouraged to write dependencies to a designated file upon installation, using tools like pip, Poetry, and Pipenv for streamlined management. For existing projects lacking dependency files, commands like pip freeze or conda list can generate lists of installed packages, though these methods have limitations. Additionally, tools like piperqs offer innovative ways to extract dependencies directly from source code, despite some challenges with accuracy and dynamically imported modules.