I need to make a .whl file of a package and it will be installed in a isolated environment which cannot connect to Internet.
In this package, it will use some third party libraries for example black and pydantic. I know that in setup.py we can set "required" packages, but this method will work only if the environment can connect to Internet.
Currently I use a workaround. This is my directory structure.
└── src
└── my_package
I download the required packages and add them to my source code before packing them into a whl file.
pip install --target=lib -r requirements.txt
cp -r lib/* src
So the directory structure will be like below
└── src
├── my_package
├── black
└── pydantic
In my setup.py, I set
package_dir={
"": "src",
},
So that after I pip install this whl file, my_package, black, pydantic will appear in python site-packages directory.
However, with this method, console script of third party libraries like black test.py
cannot work since there is no console script under the (virtualenv path)/bin directory.
Is there a more elegant way to merge third party libraries into my whl file?
Regards,