Artifacts (such as .whl files) requested from a remote repository are cached on demand. You can remove downloaded artifacts from the remote repository cache, however you can not manually deploy artifacts to a remote PyPI repository.
To create a repository to proxy a remote PyPI repository follow the steps below:
- In the Administration module under Repositories | Repositories | Remote, and click New Remote Repository.
Set the Package Type to PyPI and enter the Repository Key value.
The URL and Registry URL settings depend on whether you are proxying the public external PyPI repository, or a PyPI repository hosted on another Artifactory server.
For a public, external PyPI repository: Change the URL field to
, and set the Registry URL field to
For a PyPI repository hosted on another Artifactory instance: Set the remote repository's PyPI API URL in the Registry URL field. For example, to proxy a PyPI repository called "
python-project" hosted by an Artifactory instance at
https://my.remote.artifactory/artifactory/, you would set the Registry URL to https://my.remote.artifactory/artifactory/api/pypi/python-project as shown below:
PyPI remote repository URL
You should not include
/simplein the PyPI remote repository URL. These suffixes are added by Artifactory when accessing the remote repository.
If you use a custom PyPI remote repository, you need to make sure it has a simple index (directory listing style) accessible by
Click Save & Finish.
If the remote repository is also managed by an Artifactory server, then you need to point to its PyPI API URL in the Registry URL field. For example,
A Virtual Repository defined in Artifactory aggregates packages from both local and remote repositories.
This allows you to access both locally hosted PyPI packages and remote proxied PyPI repositories from a single URL defined for the virtual repository.
To define a virtual PyPI repository, from the Administration module, go to Repositories | Repositories | Virtual, set its Package Type to be PyPI, select the underlying local and remote PyPI repositories to include in the Basic settings tab, and click Save & Finish.
Resolving from Artifactory Using pip
Using a Valid SSL Certificate with pip and Artifactory
pip uses packages from the local cache, (i.e. from the machine on which the pip client is running on), only if the download URL of the package is a trusted host with a valid SSL certificate. This means that if your Artifactory instance is not running with a valid SSL certificate, requests for packages will always first reach Artifactory even if the packages exist on the local cache.
To display code snippets you can use to configure
setup.py to use your PyPI repository, select the repository and then click Set Me Up.
Specifying the Repository on the Command Line
Once pip is installed, it can be used to specify the URL of the repository from which to resolve:
Due to it's design, pip does not support reading credentials from a file. Credentials can be supplied as part of the URL, for example
The password can be omitted (with the preceding colon), and in this case, the user will be prompted to enter credentials interactively.
Using a Configuration File
Aliases for different repositories can be specified through a pip configuration file, ~/.pip/pip.conf . The file contains configuration parameters per repository, for example:
For more information, please refer to PIP User Guide.
Using a Requirements File
A requirements file contains a list of packages to install. Usually these are dependencies for the current package. It can be created manually or using the
pip freeze command. The index URL can be specified in the first line of the file, For example:
Publishing to Artifactory
Using distutils or setuptools
setuptools vs. distutils and python versions
Artifactory is agnostic to whether you use
distutils, and also to the version or implementation of Python your project uses.
The following instruction were written for Python 2.7 and
setuptools in mind. Using different version of Python, or different tools such
zest, distutils and others may require minor modification to the instructions below.
Uploading to Artifactory using a
setup.py script is supported in a similar way to uploading to PyPI. First, you need to add Artifactory as an index server for your user.
Create the $HOME/.pypirc File
To upload to Artifactory, an entry for each repository needs to be made in
$HOME/.pypirc as follows:
Notice that the URL does not end with
The HOME environment variable
setuptools requires that the
.pypirc file be found under
$HOME/.pypirc, using the
HOME environment variable.
On unix-like systems this is usually set by your system to
/home/yourusername/ but in certain environments such as build servers you will have to set it manually.
On Windows it must be set manually.
After creating a
.pypirc file and a
setup.py script at the root of your project, you can upload your egg (tar.gz) packages as follows:
If you are using wheel (
whl) you can upload your packaged as follows:
Or if you wish to use both egg (
tar.gz) and wheel (
whl), you can upload them as follows:
Where local is the name of the section in your
.pypirc file that points to your Artifactory PyPI repository.
By default, both
distutils will upload to
if no repository is specified.
The 'register' command should be omitted
When uploading directly to
pypi.org, the documentation states that your package must first be registered by calling
python setup.py register.
When uploading to Artifactory this is neither required nor supported and should be omitted.
Publishing Manually Using the Web UI or REST
PyPI packages can also be uploaded manually using the Web UI or the Artifactory REST API. For Artifactory to handle those packages correctly as PyPI packages they must be uploaded with
Automatic extraction of properties
While indexing the newly uploaded packages Artifactory will automatically try to extract required properties from the package metadata saved in the file. Note that not all supported files can be extracted.
whl files can be extracted for metadata.
In addition, indexing starts after a 60 second quiet period, counting from the last upload to the current repository.
Searching for PyPI Packages
Artifactory supports search using pip's search command in local, remote and virtual repositories. For example:
In this example frog-fu is a locally installed package, while irbench is found at
pypi.org, both repositories aggregated by the
Specifying the index
When using the search command, the index should be specified explicitly (without the
/simple at the end), as pip will ignore the
index-url variable in its
PyPI packages can also be searched for using Artifactory's Property Search. All PyPI packages have the properties
pypi.summary set by the uploading client, or later during indexing for supported file types.
Viewing Metadata of PyPI Packages
Artifactory lets you view selected metadata for a PyPI package directly from the UI.
In the Artifacts module Tree Browser, drill down to select the file you want to inspect. The metadata is displayed in the PyPI Info tab.
Working with Remote Repositories with the Custom Registry Suffix
You can set a custom suffix instead of the default simple like in cases of DevPi.
To set the
devpi registry suffix to the server suffix:
Use the root URL in the URL and Registry URL. For example:
In order to search, include the required scope in the index URL (as in the
devpi example, it could be
To install, include the desired scope in the index url (like in devpi example, it could be