pip-check-reqs icon indicating copy to clipboard operation
pip-check-reqs copied to clipboard

add whitelist support

Open HitLuca opened this issue 3 years ago • 6 comments

As I started using this great package, I noticed a big thing that's missing: the ability to add a whitelist for the pip-extra-reqs command. My use case is as follows:

  • my api is built using flask
  • when a docker container with my api gets built, it gets served using gunicorn
  • the gunicorn package gets used only when running the docker entrypoint, and no import gunicorn is found in the code
  • if I use the pip-extra-reqs command during my builds, theu fail because gunicorn is seen as an unused package.
  • having something like pip-extra-reqs --whitelist-packages=gunicorn ... would remove this issue which I believe could affect a number of users. For example in my case I am unable to use this functionality at all as the build would fail each time

I don't believe this issue affects the pip-missing-reqs command

HitLuca avatar Jul 08 '20 10:07 HitLuca

After some testing I can also suggest the addition of a whitelist for the pip-missing-reqs command, as for example the keras ml library requires a backend, which doesn't need to be actually used in the code. This results in an extra dependency result which should be ignored

HitLuca avatar Jul 08 '20 12:07 HitLuca

@HitLuca Just to be sure - have you looked at / considered the --ignore-requirement option in pip-extra-reqs?

adamtheturtle avatar Jul 10 '20 14:07 adamtheturtle

Looks like I completely overlooked that, because that section in the Readme talks about ignoring modules and I interpreted that as project subfolders, not actual libraries. Thank you.

HitLuca avatar Jul 10 '20 15:07 HitLuca

@HitLuca I would welcome a README PR.

adamtheturtle avatar Jul 10 '20 15:07 adamtheturtle

Sure, I'll make one when I have the time

HitLuca avatar Jul 13 '20 09:07 HitLuca

In any case, I am still thinking that a whitelist could be a useful addition

HitLuca avatar Jul 13 '20 09:07 HitLuca