Member-only story
Quick Requirements Generation for Python
3 min readAug 25, 2021
Yay! you just made an awesome project. Now you want to let the whole world use it! But wait, what about the requirements? You of course want to make sure that your dear users don’t have to manually go hunting for each dependency right?
This is a tiny tutorial on how to do this easily and some tricks along the way.
What we want
- A text file with the packages listed with their version numbers so all dependencies can be easily installed
- A way to update if anything changes
- An example :
jupytext==1.6.0
graphviz==0.14.2
Installing from a requirements.txt
- Just navigate to where the file is stored
- pip install -r requirements.txt
The simplest method
You can use this almost every time. It takes a few seconds and works very well.
- Open your favorite terminal
- Get the package pipreqs (pip install pipreqs)
- Identify the path to your project directory (‘pwd’ for linux/mac or ‘cd’ for windows)