Pipreqs generate incorrect requiremnets for Hydra
Asked Answered
S

1

2

I'm using pipreqs for generating requirements.txt. I started using hydra package (see https://hydra.cc/ or hydra-core package on PyPI). So I would like pipreqs to add hydra-core dependency automatically when I run.

But, when I checked output of pipreqs (directly in requirements.txt when running pipreqs --force or from console output with pipreqs --print) there is Hydra==2.5. But it's incorrect package (leading to Hydra which is package with a high performance bloom filter). I would expect to see hydra-core==1.0.6 which is the right version of my hydra (hydra-core to be correct) package.

Is there anything what should I do differently? Or is there any issue with pipreqs?


  • Python 3.8.6
  • pipreqs version: 0.4.10
Sig answered 9/4, 2021 at 14:0 Comment(1)
This is a common issue, actually (you can see all of the mixups in their "issues" for pipreqs). Most people seem to manually fix the issue. The solution, even from pipreqs' standpoint is not a simple one.Mummify
P
4

Unfortunately the Hydra package, first released at 2010 - predated the Hydra Framework, so I was not able to use name hydra as the pypi package name (hence hydra-core). I even reached out to the owner of that project, politely asking if he can let go of that name. I was not surprised when he declined :).

Installing hydra instead of hydra-core is pretty common mistake for people getting started with Hydra.

Looking at that project, they do have a mechanism to help indicate what package to use when seeing an import, which might be helpful. See this PR for example. You may want to open a pull request to add hydra-core to their mapping. Given that hydra-core is much more popular than the other hydra, I think they will be okay with it.

Psychiatrist answered 10/4, 2021 at 2:39 Comment(6)
Thanks, it seems you are right. First, I created issue there (github.com/bndr/pipreqs/issues/244). If the solution with updating mapping in pipreqs will be enough I will create PR later.Sig
@Nerxis: 1. If this answers your question, please accept. 2. Please follow-up on the issue you opened. :)Psychiatrist
Yes, I will follow-up but for some reason I didn't receive any notification, thanks for remainder. Regarding answer, I will accept it when PR is merged and everything is working, don't be afraid :-)Sig
@Sig If this solved your issue I would suggest accepting this answer. You should be able to update the mapping file yourself with the guidance provided in this answer.Mummify
FYI: github.com/bndr/pipreqs/pull/247 was merged, it will probably take some time to the next release but you can build directly from master atm. Thanks for your help.Sig
pipreqs got mysql-connector-python wrong too. I guess it is may due to similar reason.Delude

© 2022 - 2024 — McMap. All rights reserved.