Skip to content

Commit 25aeb40

Browse files
authored
doc: improve alias error msg in pip hubs (#2458)
Summary: * Add more flag values that we actually use. * Point users to online docs. I still think it is not good enough when somebody needs to debug, but I am not sure what to add. Maybe we just need user documentation outlining what each config setting means and what values it is using? Maybe we should generate the config settings inside the `rules_python` repository so that we have better visibility into what needs to be documented and explained.
1 parent 29fdcc2 commit 25aeb40

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

python/private/pypi/pkg_aliases.bzl

+17-7
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,31 @@ load(":whl_target_platforms.bzl", "whl_target_platforms")
3636
# it. It is more of an internal consistency check.
3737
_VERSION_NONE = (0, 0)
3838

39+
_CONFIG_SETTINGS_PKG = str(Label("//python/config_settings:BUILD.bazel")).partition(":")[0]
40+
3941
_NO_MATCH_ERROR_TEMPLATE = """\
4042
No matching wheel for current configuration's Python version.
4143
4244
The current build configuration's Python version doesn't match any of the Python
43-
wheels available for this wheel. This wheel supports the following Python
45+
wheels available for this distribution. This distribution supports the following Python
4446
configuration settings:
4547
{config_settings}
4648
4749
To determine the current configuration's Python version, run:
4850
`bazel config <config id>` (shown further below)
49-
and look for
50-
{rules_python}//python/config_settings:python_version
5151
52-
If the value is missing, then the "default" Python version is being used,
53-
which has a "null" version value and will not match version constraints.
54-
"""
52+
and look for one of:
53+
{settings_pkg}:python_version
54+
{settings_pkg}:pip_whl
55+
{settings_pkg}:pip_whl_glibc_version
56+
{settings_pkg}:pip_whl_muslc_version
57+
{settings_pkg}:pip_whl_osx_arch
58+
{settings_pkg}:pip_whl_osx_version
59+
{settings_pkg}:py_freethreaded
60+
{settings_pkg}:py_linux_libc
61+
62+
If the value is missing, then the default value is being used, see documentation:
63+
{docs_url}/python/config_settings"""
5564

5665
def _no_match_error(actual):
5766
if type(actual) != type({}):
@@ -68,7 +77,8 @@ def _no_match_error(actual):
6877
for value in (key if type(key) == "tuple" else [key])
6978
])),
7079
).lstrip(),
71-
rules_python = "rules_python",
80+
settings_pkg = _CONFIG_SETTINGS_PKG,
81+
docs_url = "https://rules-python.readthedocs.io/en/latest/api/rules_python",
7282
)
7383

7484
def pkg_aliases(

0 commit comments

Comments
 (0)