0

I would like to know if there is any automatic way to discover the list of dependencies that I need to add to the install_requires section of a setup.py file for a Python library, without inspecting the code "manually".

It would be good if this tool is compatible with pre-commit as well, so that I get notified if dependencies change in a later commit.

sinoroc
  • 18,409
  • 2
  • 39
  • 70
  • seeking tool recommendations is off topic because it tends to be spammy. the problem is also not simple _even with the code_. it's pretty straightforward to discover 3rd party imports (such as with [classify-imports](https://github.com/asottile/classify-imports) -- one of my projects) -- but the pypi name doesn't have to match the module name (and often doesn't) and that mapping is difficult. with the dependencies installed it's fairly straightforward to inspect the `RECORD` files against the module names, but that requires everything to already be installed! – anthony sottile Feb 27 '23 at 22:46
  • Question has aready been asked many times: use pipreqs or pigar. – sinoroc Feb 27 '23 at 22:57
  • It answers. I did not found this question when searching for the solution. The only is that there is no integration to pre-commit. – Thomas Friesen Mar 01 '23 at 23:01

0 Answers0