I have Python project and have installed hundreds of packages using pip over time. However, I have since improved my code and suspect that some of these packages are no longer in use. I want to remove all of the unused packages.
I am already familiar with the pip uninstall package-name
command and have seen suggestions to use pip-autoremove package-name
, but it's not considered to be the optimal option for my case as there are hundreds of unused packages, and I do not want to manually uninstall each one.
Additionally, I do not want to accidentally remove packages that are still being used in my project.
I am wondering if there is a better solution, or a way to look for python imports inside files and detect for unused. Any latest or alternative approaches would be highly appreciated. Thank you.