Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate requirements based on used imports

Is there any tool to generate requirements file based on actually used imports in your project, not only on output of pip freeze?

Rationale, as I see it:

it's nice and simple to generate requirements with pip freeze, when you start the project. Howether, when your project grows, you add some new dependecies, while other go away. It's already not very convinient to

pip freeze -r old_requirements > new_requirements

, as you already have some kind of tools installed into virtualenv, which are convinient, but are not needed for requirements (I'm talking about ipython or other such tools), so you have to correct requirements manually and clean them. Moreover, it's easy to forget to delete some library from requirements, when you project does not need it anymore, and a year later, you can't already remember, why it is there, and won't definetely delete it.

like image 623
eyeinthebrick Avatar asked Oct 18 '25 00:10

eyeinthebrick


1 Answers

I came across this https://github.com/bndr/pipreqs package, which does exactly, what I asked.

like image 112
eyeinthebrick Avatar answered Oct 19 '25 12:10

eyeinthebrick



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!