0

I have an application with plenty of third-party packages in it, some of them are not required, and few packages have many versions installed in the environment.

Is there any tool or method to detect those redundant packages and remove those, so that the application size can be reduced??

Currently, I'm listing the all packages performing the tests removing individual packages one by one, if the tests passed removing the packages, any better approach??

DilLip_Chowdary
  • 841
  • 4
  • 18
  • i think maybe the other way is more performant, to create a new environement and to install only the required package needed for the application to run. – Ghassen Sultana Nov 03 '22 at 12:01
  • Yeah, but that too takes a similar time as the removing packages method right? – DilLip_Chowdary Nov 03 '22 at 12:03
  • 1
    not really, because you can couple this methode with try except, and catch the ImportError and install the package on the fly with a recursive call to the application. but know that installing a package dynamically is not recommanded [link](https://stackoverflow.com/questions/6120902/how-do-i-automatically-install-missing-python-modules) but i think in your case coupling the two should do the trick – Ghassen Sultana Nov 03 '22 at 12:10
  • https://pypi.org/project/pigar/ -- https://pypi.org/project/pipreqs/ -- and maybe others... – sinoroc Nov 03 '22 at 17:40
  • @sinoroc seems like.., need to tryout this. – DilLip_Chowdary Nov 04 '22 at 04:29

0 Answers0