A Remote Repository defined in Artifactory serves as a caching proxy for a registry managed at a remote URL such as .
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:
Set the Package Type to PyPI and enter the Repository Key value.
You should not include "/pypi" or "/simple" in the 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
For patch versions provided for Artifactory 5.8.9 and above and Artifactory 5.9.5 and above, to support the new PyPI structure, the only change you need to make is to set the URL field to https://pypi.org. The https://files.pythonhosted.org is automatically extracted from a system property,
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 both URL field and 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, create virtual repository, set its Package Type to be PyPI, select the underlying local and remote PyPI repositories to include in the Basic settings tab, click "Save & Finish".
To install the
pip command line tool refer to . We recommend using to separate your environment when installing PIP.
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.
Once pip is installed, it can be used to specify the URL of the repository from which to resolve:
$ pip install frog-bar -i http://localhost:8081/artifactory/api/pypi/pypi-local/simple
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.
Aliases for different repositories can be specified through a pip configuration file, ~/.pip/pip.conf . The file contains configuration parameters per repository, for example:
[global] index-url = http://user:password@localhost:8081/artifactory/api/pypi/pypi-virtual/simple
For more information, please refer to .
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:
--index-url http://localhost:8081/artifactory/api/pypi/pypi-local/simple PyYAML==3.11 argparse==1.2.1 frog-bar==0.2 frog-fu==0.2a nltk==2.0.4 wsgiref==0.1.2
Artifactory is agnostic to whether you use
The following instruction were written for Python 2.7 and
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.
For instructions on using setuptools to package Python projects and create a setup.py script, please refer to the and .
To upload to Artifactory, an entry for each repository needs to be made in $HOME/.pypirc as follows:
[distutils] index-servers = local pypi [pypi] repository: https://pypi.org/pypi username: mrBagthrope password: notToBeSeen [local] repository: http://localhost:8081/artifactory/api/pypi/pypi-local username: admin password: password
Notice that the URL does not end with
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:
~/python_project $ python setup.py sdist upload -r local
If you are using wheel (whl) you can upload your packaged as follows:
~/python_project $ python setup.py bdist_wheel upload -r local
Or if you wish to use both egg (tar.gz) and wheel (whl), you can upload them as follows:
~/python_project $ python setup.py sdist bdist_wheel upload -r local
Where local is the name of the section in your .pypirc file that points to your Artifactory PyPI repository.
By default, both
When uploading directly to pypi.org, the documentation states that your package must first be registered by calling
When uploading to Artifactory this is neither required nor supported and should be omitted.
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 pypi.name and pypi.version 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.
Currently, only zip, tar, tgz, tar.gz, tar.bz2, egg and 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.
Artifactory supports search using pip's search command in local, remote and virtual repositories. For example:
$ pip search frog-fu --index http://localhost:8081/artifactory/api/pypi/pypi-virtual/ frog-fu - 0.2a INSTALLED: 0.2a (latest) $ pip search irbench --index http://localhost:8081/artifactory/api/pypi/pypi-virtual/ irbench - Image Retrieval Benchmark.
In this example frog-fu is a locally installed package, while irbench is found at pypi.org, both repositories aggregated by the pypi-virtual repository.
When using the search command, the index should be specified explicitly (without the
PyPI packages can also be searched for using Artifactory's Property Search. All PyPI packages have the properties pypi.name, pypi.version and pypi.summary set by the uploading client, or later during indexing for supported file types.
Artifactory lets you view selected metadata of 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.
<iframe width="560" height="315" src="https://www.youtube.com/embed/WSUjbnfWxvg" frameborder="0" allowfullscreen></iframe>