A Python application's requirements.txt file may be analysed for unneeded dependencies using many tools.
pip-tools: Python dependency management tools. The pip-check programme can find packages in a requirements.txt file that the application is not using.
pip install pip-tools
pip check
pip-autoremove: Removes superfluous dependencies from requirements.txt files. It removes required file packages that are not imported in any source code.
pip install pip-autoremove
pip-autoremove -r requirements.txt
pip-updater: Automatically updates and removes dependencies. This utility can update and delete packages.
pip install pip-updater
pip-updater -r requirements.txt
pyupgrade: Automatically upgrades and removes dependencies. It may upgrade and delete packages.
pip install pyupgrade
pyupgrade requirements.txt
Pyflakes can examine imports and dependencies in contemporary Python files.
Pipdeptree can produce a dependency tree for all your dependencies and show where they are utilised in your project.
pip install pipdeptree
pipdeptree