Generate the requirements.txt file automatically.

Free Python Code - Aug 20 '23 - - Dev Community

Hi 🙂🖐

In this post i will share with you how to Generate the requirements.txt file automatically.

I will use a tool called Pipreqs it is very easy to use.

step 1

install pipreqs pip install pipreqs

step 2

Open your code editor and write any script to test. I will write this for the test.


import moviepy.editor as mp
import colored

from PIL import Image
from pyfiglet import figlet_format

print(colored.stylize(figlet_format('Testscript. ;)'), colored.fg(50)))

def test(image_path):
    img = Image.open(image_path)

Enter fullscreen mode Exit fullscreen mode

If you are using Vscode, you can write pipreqs
in the terminal.

If you havent terminal in your code editor
open the cmd and write pipreqs /home/project/location

For more information
https://stackoverflow.com/questions/57907655/how-to-use-pipreqs-to-create-requirements-txt-file

result

requirements.txt file

colored==2.2.3
moviepy==1.0.3
Pillow==9.5.0
Pillow==10.0.0
pyfiglet==0.8.post1

Enter fullscreen mode Exit fullscreen mode

Now we're done 🤗

Don't forget to like and follow 🙂

Support me on PayPal 🤗
https://www.paypal.com/paypalme/amr396

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .