@@ -115,6 +115,7 @@ def build_config(
115115 _configure (
116116 defaults ,
117117 override = mod .is_root ,
118+ index_url = tag .index_url ,
118119 # extra values that we just add
119120 auth_patterns = tag .auth_patterns ,
120121 netrc = tag .netrc ,
@@ -125,6 +126,7 @@ def build_config(
125126
126127 return struct (
127128 auth_patterns = defaults .get ("auth_patterns" , {}),
129+ index_url = defaults .get ("index_url" , "https://pypi.org/simple" ).rstrip ("/" ),
128130 netrc = defaults .get ("netrc" , None ),
129131 platforms = {
130132 name : _plat (** values )
@@ -449,6 +451,30 @@ Supported keys:
449451::::{note}
450452This is only used if the {envvar}`RULES_PYTHON_ENABLE_PIPSTAR` is enabled.
451453::::
454+ """ ,
455+ ),
456+ "index_url" : attr .string (
457+ doc = """\
458+ The index URL to use as a default when downloading packages from PyPI. This is used if nothing is
459+ specified via `--index-url` or `--extra-index-url` parameters in the `requirements.txt` file or via
460+ the {attr}`pip.parse.extra_pip_args`.
461+
462+ This value is going to be subject to `envsubst` substitutions if necessary, look at the
463+ {attr}`pip.parse.envsubst` documentation for more information..
464+
465+ The indexes must support Simple API as described here:
466+ https://packaging.python.org/en/latest/specifications/simple-repository-api/
467+
468+ Index metadata will be used to get `sha256` values for packages even if the
469+ `sha256` values are not present in the requirements.txt lock file.
470+
471+ Defaults to `https://pypi.org/simple`.
472+
473+ :::{versionadded} 2.0.0
474+ This has been added as a replacement for
475+ {obj}`pip.parse.experimental_index_url` and
476+ {obj}`pip.parse.experimental_extra_index_urls`.
477+ :::
452478""" ,
453479 ),
454480 "marker" : attr .string (
@@ -566,43 +592,23 @@ def _pip_parse_ext_attrs(**kwargs):
566592 attrs = dict ({
567593 "experimental_extra_index_urls" : attr .string_list (
568594 doc = """\
569- The extra index URLs to use for downloading wheels using bazel downloader.
570- Each value is going to be subject to `envsubst` substitutions if necessary.
595+ May be removed in future releases.
571596
572- The indexes must support Simple API as described here:
573- https://packaging.python.org/en/latest/specifications/simple-repository-api/
574-
575- This is equivalent to `--extra-index-urls` `pip` option.
576-
577- :::{versionchanged} 1.1.0
578- Starting with this version we will iterate over each index specified until
579- we find metadata for all references distributions.
597+ :::{versionchanged} 2.0.0
598+ This is deprecated, please use {obj}`pip.default.index_url` or pass the `--index-url` parameter via the
599+ lock-file or {obj}`pip.parse.extra_pip_args`.
580600:::
581601""" ,
582602 default = [],
583603 ),
584604 "experimental_index_url" : attr .string (
585605 default = kwargs .get ("experimental_index_url" , "" ),
586606 doc = """\
587- The index URL to use for downloading wheels using bazel downloader. This value is going
588- to be subject to `envsubst` substitutions if necessary.
589-
590- The indexes must support Simple API as described here:
591- https://packaging.python.org/en/latest/specifications/simple-repository-api/
592-
593- In the future this could be defaulted to `https://pypi.org` when this feature becomes
594- stable.
595-
596- This is equivalent to `--index-url` `pip` option.
607+ May be removed in future releases.
597608
598- :::{versionchanged} 0.37.0
599- If {attr}`download_only` is set, then `sdist` archives will be discarded and `pip.parse` will
600- operate in wheel-only mode.
601- :::
602-
603- :::{versionchanged} 1.4.0
604- Index metadata will be used to deduct `sha256` values for packages even if the
605- `sha256` values are not present in the requirements.txt lock file.
609+ :::{versionchanged} 2.0.0
610+ This is deprecated, please use {obj}`pip.default.index_url` or pass the `--index-url` parameter via the
611+ lock-file or {obj}`pip.parse.extra_pip_args`.
606612:::
607613""" ,
608614 ),
@@ -835,9 +841,6 @@ the BUILD files for wheels.
835841 This tag class allows for more customization of how the configuration for the hub repositories is built.
836842
837843
838- :::{include} /_includes/experimental_api.md
839- :::
840-
841844:::{seealso}
842845The [environment markers][environment_markers] specification for the explanation of the
843846terms used in this extension.
0 commit comments