Skip to content Skip to sidebar Skip to footer

Python Setup Does Not Install Read Pip.conf

Remote Repositories

A Remote Repositories defined in Artifactory serves equally a caching proxy for a registry managed at a remote URL such equally  https://pypi.python.org/.

Artifacts (such every bit .whl files) requested from a remote repository are cached on demand. Y'all can remove downloaded artifacts from the remote repository cache, however you can non manually deploy artifacts to a remote PyPI repository.

To create a repository to proxy a remote PyPI repository follow the steps below:

  1. In theAdministration module underRepositories | Repositories | Remote, and clickNew Remote Repository.
  2. Set thePackage Blazon toPyPIand enter theRepository Keyvalue.

  3. 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: Modify the URL field to https://files.pythonhosted.org/ , and set the Registry URL field to https://api/pypi.org/.

    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 lot would set theRegistry URL to https://my.remote.artifactory/artifactory/api/pypi/python-project as shown below:

    PyPI remote repository URL

    You should non include api/pypi or /simple in the PyPI remote repository URL. These suffixes are added by Artifactory when accessing the remote repository.

    If you use a custom PyPI remote repository, yous demand to make sure it has a unproblematic index (directory listing manner) accessible past <URL>/unproblematic .

  4. Click Relieve & Finish.

    Remote Artifactory

    If the remote repository is also managed by an Artifactory server, and then you need to point to its PyPI API URL in the Registry URL field. For instance, http://my.remote.artifactory/artifactory/api/pypi/python-project

Virtual Repositories

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 Assistants module, go toRepositories | Repositories | Virtual, set its Package Blazon to be PyPI, select the underlying local and remote PyPI repositories to include in theBasic settings tab, and click Save & Cease.



Resolving from Artifactory Using pip

To install the pip command line tool refer to pip documentation pages. We recommend using  virtualenv to divide your environment when installing PIP.

Using a Valid SSL Certificate with pip and Artifactory

pip uses packages from the local enshroud, (i.due east. from the machine on which the pip customer 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 ever first accomplish Artifactory fifty-fifty if the packages exist on the local cache.

To brandish code snippets you can use to configure pip  and setup.py  to use your PyPI repository, select the repository and so click Set Me Up.


Specifying the Repository on the Command Line

Index URL

When accessing a PyPI repository through Artifactory, the repository URL should not exist prefixed with api/pypi in the path. This applies to all pip commands and distutils URLs including pip install.

When using pip to resolve PyPI packages it must point to <Artifactory URL>/pypi/<repository key>/elementary .

For instance, if you are using Artifactory standalone or as a local service, you would access your PyPI repositories using the following URL:

http://localhost:8081/artifactory/pypi/<repository key>/simple

Or, if you lot are using Artifactory Cloud, the URL would be:

https://<server name>.jfrog.io/artifactory/pypi/<repository key>/uncomplicated


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

Using Credentials

Due to it's blueprint, pip does not back up reading credentials from a file. Credentials can be supplied as function of the URL, for example http://<username>:<password>@localhost:8081/artifactory/api/pypi/pypi-local/simple . The password can be omitted (with the preceding colon), and in this case, the user volition 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:

[global] alphabetize-url = http://user:countersign@localhost:8081/artifactory/api/pypi/pypi-virtual/simple          

For more information, please refer to  PIP User Guide.

Using a Requirements File

A requirements file contains a list of packages to install. Unremarkably these are dependencies for the electric current bundle. Information technology tin can be created manually or using the pip freeze command. The index URL can be specified in the first line of the file, For instance:

--index-url http://localhost:8081/artifactory/api/pypi/pypi-local/elementary PyYAML==three.11 argparse==1.2.ane frog-bar==0.2 frog-fu==0.2a nltk==two.0.4 wsgiref==0.1.2

Publishing to Artifactory

Using distutils or setuptools

setuptools vs. distutils and python versions

Artifactory is agnostic to whether you employ setuptools or distutils, and likewise 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 crave minor modification to the instructions beneath.

Uploading to Artifactory using a setup.py script is supported in a similar way to uploading to PyPI. First, y'all demand to add Artifactory equally an index server for your user.

For instructions on using setuptools to parcel Python projects and create a setup.py script, please refer to the  setuptools documentation and this tutorial projection.

Create the $HOME/.pypirc File

To upload to Artifactory, an entry for each repository needs to exist made in $Habitation/.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 cease with/simple.

The Domicile environment variable

setuptools requires that the .pypirc file be establish under $Dwelling/.pypirc, using the Dwelling house environment variable.

On unix-like systems this is usually set by your organization to /abode/yourusername/ but in sure environments such equally build servers you will take to set it manually.

On Windows it must exist set manually.

Uploading

Later 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 yous are using wheel (whl) yous 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 cycle (whl), y'all can upload them equally 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.

Default upload

By default, both setuptools and distutils will upload to https://pypi.org/pypi if no repository is specified.

The 'annals' 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 Spider web UI or the Artifactory REST API. For Artifactory to handle those packages correctly equally PyPI packages they must exist uploaded with pypi.proper noun and pypi.versionBackdrop.

Automatic extraction of properties

While indexing the newly uploaded packages Artifactory volition automatically try to extract required properties from the parcel metadata saved in the file. Note that non all supported files tin be extracted.

Currently, simply zip , tar, tgz, tar.gz, tar.bz2, egg and whl files tin can be extracted for metadata.

In addition, indexing starts after a threescore second quiet period, counting from the last upload to the current repository.


Searching for PyPI Packages

Using PIP

Artifactory supports search using pip'southward 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 parcel, while irbench is found at pypi.org , both repositories aggregated by the pypi-virtual repository.

Specifying the index

When using the search command, the alphabetize should exist specified explicitly (without the/simple at the end), as pip volition ignore the alphabetize-url variable in its pip.conf file.

Artifactory Search

PyPI packages tin also be searched for using Artifactory'south Property Search. All PyPI packages accept the backdrop pypi.name, pypi.version and pypi.summary prepare by the uploading client, or later during indexing for supported file types.


Artifactory lets yous view selected metadata for a PyPI package directly from the UI.

In the Artifacts moduleTree Browser,drill down to select the file yous want to inspect. The metadata is displayed in the PyPI Info tab.

PyPI Info


Working with Remote Repositories with the Custom Registry Suffix

You can ready a custom suffix instead of the default simple like in cases of DevPi.

To fix the devpi registry suffix to the server suffix:

Use the root URL in the URL and Registry URL. For example: http://m.devpi.internet.

In order to search, include the required scope in the index URL (every bit in the devpi example, it could be root/pypi).

$ pip search frog-fu --alphabetize http://localhost:8081/artifactory/api/pypi/devpi/root/pypi/

To install, include the desired scope in the index url (like in devpi example, it could be root/pypi)

$ pip install frog-bar -i http://localhost:8081/artifactory/api/pypi/devpi/root/pypi/simple

Watch the Screencast

rhodeshilewhousels.blogspot.com

Source: https://www.jfrog.com/confluence/display/JFROG/PyPI+Repositories

Post a Comment for "Python Setup Does Not Install Read Pip.conf"