Check for packages that are imported but not used?

Is there a way to check for packages that have been imported through using but aren’t actually being used?

I’m trying to split an overgrown package up into smaller chunks and this functionality would be really helpful

This kind of functionality should be a part of linting. It would be really cool if the text editor would give you a warning that something is imported but not used (same way Spyder does it).

2 Likes

Be explicit in the module

using A: a, b, c
using B: d, e, f
import A: Ab, Ac

Usually tracking those and a good test suite will answer that question.

Testing and extracting functions is definitely a nice way to minimise, but it would be nice to have something other than run/error testing approaches for detecting when the minimum function set is specified

2 Likes