How to make a local ‘setup.py’ resolve dependencies from Artifactory.

Or Naishtat
2021-07-22 08:29

Setup.py is the build script for setuptools. It tells setuptools about your package details such as the name, version, and dependencies.
When we install a local .py package with a local setup.py file, it does not reach the ".pypirc" configurations. Therefore instead of using Artifactory default "Set Me Up" we need to add a 'dependency_links' parameter to the setup.py file​​ to be able to resolve dependencies from Artifactory – 

dependency_links=['http://<ARTIFACTORY IP>:8082/api/pypi/pypi/simple']

If anonymous access is not permitted to the Artifactory instance/repository please inject the credentials with the below method –

dependency_links=['http://<USER>:<PASSWORD>@<ARTIFACTORY IP>:8082/api/pypi/pypi/simple']

The example below uses the setup.py file taken from our Github python-example
User-added image