Skip to main content
Version: 2.14 (deprecated)

python-repos


External Python code repositories, such as PyPI.

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

Backend: pants.core

Config section: [python-repos]

Basic options

--python-repos-find-links="['<str>', '<str>', ...]"
PANTS_PYTHON_REPOS_FIND_LINKS
pants.toml
[python-repos]
find_links = [
'<str>',
'<str>',
...,
]
default: []

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.

Advanced options

indexes

--python-repos-indexes="['<str>', '<str>', ...]"
PANTS_PYTHON_REPOS_INDEXES
pants.toml
[python-repos]
indexes = [
'<str>',
'<str>',
...,
]
default:
[
  "https://pypi.org/simple/"
]

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).

path_mappings

--python-repos-path-mappings="['<str>', '<str>', ...]"
PANTS_PYTHON_REPOS_PATH_MAPPINGS
pants.toml
[python-repos]
path_mappings = [
'<str>',
'<str>',
...,
]
default: []

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 https://www.pantsbuild.org/v2.14/docs/python-third-party-dependencies#local-requirements. [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 (https://www.pantsbuild.org/v2.14/docs/options#config-file-interpolation. 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 (https://www.pantsbuild.org/v2.14/docs/options#pantsrc-file.

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

Deprecated options

repos

--python-repos-repos="['<str>', '<str>', ...]"
PANTS_PYTHON_REPOS_REPOS
pants.toml
[python-repos]
repos = [
'<str>',
'<str>',
...,
]
default: []
Deprecated, will be removed in version: 3.0.0.dev0.
A deprecated alias for `[python-repos].find_links`.

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

None