aspect-build / rules_lint

Run static analysis tools with Bazel
Apache License 2.0
61 stars 33 forks source link

[FR]: Detect unused Python dependencies #296

Open jab opened 2 weeks ago

jab commented 2 weeks ago

What is the current behavior?

No linter is currently supported that detects unused Python dependencies.

Describe the feature

Enable Python users to notice when they are taking dependencies that no targets are actually importing.

https://github.com/tweag/FawltyDeps is an existing tool that enables this for pip dependencies (as well as the opposite - noticing when code is importing a dependency that is not being taken).

Not sure if there is something more general-purpose (eg also works with non-pip deps, ideally even for other languages, by leveraging Bazel).

alexeagle commented 2 weeks ago

Normally it's gazelle's job to manage deps by removing those which aren't imported (and have no #keep comment) I'm not sure if it's desirable to have a second competing workflow for that...

jab commented 2 weeks ago

Does gazelle look in pyproject.toml and requirements.in files?