Generating the requirements.txt file

We also have the possibility to create the requirements.txt file from the project source code.

For this task, we can use the pipreqs module, whose code can be downloaded from the GitHub repository at https://github.com/bndr/pipreqs

In this way, the module can be installed either with the pip install pipreqs command or through the GitHub code repository using the python setup.py install command.

For more information about the module, you can query the official pypi page: https://pypi.python.org/pypi/pipreqs.

To generate the requirements.txt file, you have to execute the following command:

 pipreqs <path_project>

Get Mastering Python for Networking and Security now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.