HomeDocs
DocsCommunityTestimonialsUsersGitHubTwitterBlogJobsTermsPrivacyCookies
TermsPrivacyCookies
Hey! These docs are for version 2.14, which is no longer officially supported. Click here for the latest version, 2.17!


External Python code repositories, such as PyPI.

These options may be used to point to custom package indexes when resolving requirements.

Backend: <span style="color: purple"><code>pants.core</code></span> Config section: <span style="color: purple"><code>[python-repos]</code></span>

## Basic options

<div style="color: purple">

### `find_links`

<code>--python-repos-find-links="['&lt;str&gt;', '&lt;str&gt;', ...]"</code><br> <code>PANTS_PYTHON_REPOS_FIND_LINKS</code><br>

</div> <div style="padding-left: 2em;"> <span style="color: green">default: <code>[]</code></span>

<br>

URLs and/or file paths corresponding to pip's `--find-links` option.

Per [pip's documentation](🔗), URLs should be to HTML files with links to `.whl` and/or sdist files. Local paths must be absolute, and can either be to an HTML file with links or to a directory with `.whl` and/or sdist files, e.g. `file:///Users/pantsbuild/prebuilt_wheels`.

For local paths, you may want to use the option `[python-repos].path_mappings`.

</div> <br>

## Advanced options

<div style="color: purple">

### `indexes`

<code>--python-repos-indexes="['&lt;str&gt;', '&lt;str&gt;', ...]"</code><br> <code>PANTS_PYTHON_REPOS_INDEXES</code><br>

</div> <div style="padding-left: 2em;"> <span style="color: green">default: <pre>[ "https://pypi.org/simple/" ]</pre></span>

<br>

URLs of [PEP-503 compatible](🔗) code repository indexes to look for requirements.

If set to an empty list, then Pex will use no indexes (meaning it will not use PyPI).

</div> <br>

<div style="color: purple">

### `path_mappings`

<code>--python-repos-path-mappings="['&lt;str&gt;', '&lt;str&gt;', ...]"</code><br> <code>PANTS_PYTHON_REPOS_PATH_MAPPINGS</code><br>

</div> <div style="padding-left: 2em;"> <span style="color: green">default: <code>[]</code></span>

<br>

Mappings to facilitate using local Python requirements when the absolute file paths are different on different users' machines. For example, the path `file:///Users/pantsbuild/prebuilt_wheels/django-3.1.1-py3-none-any.whl` could become `file://${WHEELS_DIR}/django-3.1.1-py3-none-any.whl`, where each user can configure what WHEELS_DIR points to on their machine.

Expects values in the form `NAME|PATH`, e.g. `WHEELS_DIR|/Users/pantsbuild/prebuilt_wheels`. You can specify multiple entries in the list.

This feature is intended to be used with `[python-repos].find_links`, rather than PEP 440 direct reference requirements (see [Third-party dependencies](🔗). `[python-repos].find_links` must be configured to a valid absolute path for the current machine.

Tip: you can avoid each user needing to manually configure this option and `[python-repos].find_links` by using a common file location, along with Pants's interpolation support ([Options](🔗). For example, in `pants.toml`, you could set both options to `%(buildroot)s/python_wheels` to point to the directory `python_wheels` in the root of your repository; or, use the path `%(env.HOME)s/pants_wheels` for the path `~/pants_wheels`. If you are not able to use a common path like this, then we recommend setting that each user set these options via a `.pants.rc` file ([Options](🔗).

Note: Only takes effect if you use Pex lockfiles. Use the default `[python].lockfile_generator = "pex"` and run the `generate-lockfiles` goal.

</div> <br>

## Deprecated options

<div style="color: purple">

### `repos`

<code>--python-repos-repos="['&lt;str&gt;', '&lt;str&gt;', ...]"</code><br> <code>PANTS_PYTHON_REPOS_REPOS</code><br>

</div> <div style="padding-left: 2em;"> <span style="color: green">default: <code>[]</code></span> <p style="color: darkred">Deprecated, is scheduled to be removed in version: 3.0.0.dev0.<br>A deprecated alias for `[python-repos].find_links`.</p> <br>

URLs of code repositories to look for requirements. In Pip and Pex, this option corresponds to the `--find-links` option.

</div> <br>