DEV Community

Akash
Akash

Posted on

Automate your requirements.txt with few lines of code

We all get an one common problem with what's libraries we use in our python project.Today I discovered a very simple solution.Yeah, you can also follow this process to make your SDL ( Software Development Life Cycle).I hope it will be gotcha for you.

I hope as a python developer you are familiar with pip.
Wow! you are almost done.

  1. Step 1: Install pip-tools
pip install pip-tools
Enter fullscreen mode Exit fullscreen mode
  1. Step 2: Create a file in root directory with name requirements.in and list down libraries what you want to install.

  2. Step 3: Compile your requirements.in file with pip-tools

 pip-compile requirements.in
Enter fullscreen mode Exit fullscreen mode
  1. Final step: Use known to all of you
pip install -r requirements.txt 
Enter fullscreen mode Exit fullscreen mode

Done. You get all the libraries you need at all in you requiements.txt file.

See below :
Image description

Image description

Bye . Happy Coding !! :)

Top comments (0)