Just create requirements.txt in your lib folder and write all the dependencies like this:
gunicorn docutils>=0.3 lxml==0.5a7
Then create a setup.py script and read requirements.txt in:
import os thelibFolder = os.path.dirname(os.path.realpath(__file__)) requirementPath = thelibFolder + '/requirements.txt' install_requires = []
Performing the installation python setup.py install install your package and all the dependencies. As @jwodder said that it is not necessary to create a requirements.txt file, you can simply install install_requires directly in the setup.py script. But writing the requirements.txt file is good practice.
In the configuration function, you must also install version , packages , author , etc. Read the document for a complete example: https://docs.python.org/3.7/distutils/setupscript.html
Your dir package will look like this:
βββ yourpackage β βββ yourpackage β β βββ __init__.py β β βββ yourmodule.py β βββ requirements.txt β βββ setup.py
source share