5 ms·
I would additionally recommend to use : pip freeze -r requirements-to-freeze.txt > requirements.txt instead of just: pip freeze > requirements.txt So yo
by blaze33 11y ago
I would additionally recommend to use :
pip freeze -r requirements-to-freeze.txt > requirements.txt
instead of just:
pip freeze > requirements.txt
So you can keep your file structure with comments, nicely separating your dependencies from the dependencies of your dependencies. Actually I only used one requirements.txt file, removing everything below "## The following requirements were added by pip --freeze:" and regenerating it when I changed my dependencies.
And sure, beware of git urls being replaced by egg names in the process.
- nikolay 11y agoNice! Didn't know this was even possible!
- nikolay 11y agoDuh! That's how I was using it along with the -l option!
- true_religion 11y agoAnother tool you might find useful is pipreq. pipreq --savepath gen.requirements.txt / The above will run through all your source code, and generate the requirements that you actually use via imports. https://github.com/bndr/pipreqs https://github.com/bndr/pipreqs Disclaimer: I contribute to it.
- StavrosK 11y agoDoes it work well? I can't imagine it would be very accurate for things like a Django project...
- true_religion 11y agoIt works pretty well for a Django project with the exception of anything that's only called from INSTALLED_APPs. I have a branch that can handle Django, but I kept it private because it's not really general purpose to introspect Django's settings.py then read out data.