You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(pypi): add pip.dep to declare abstract pypi dependencies (bazel-contrib#3850)
Introduce the pip.dep tag class to allow modules to declare abstract
PyPI dependencies. These declarations ensure the target structure for
a PyPI package is created, but provide a no-op implementation that
passes analysis time, but fails at execution time.
Along the way, create an agent rule for `*.bzl` files to help guide it
in creating better bzl files.
hub_clause=' when building under PyPI hub "{hub}". Try adding it to the requirements of this hub (e.g. requirements_lock or requirements_by_platform in pip.parse)'.format(
11
+
hub=ctx.attr.hub_name,
12
+
)
13
+
else:
14
+
hub_clause=' because no default PyPI hub was configured. Try designating a default hub via pip.default(default_hub = "...") or select a hub using --@rules_python//python/config_settings:venv'
15
+
9
16
# Register an action that fails when Bazel attempts to stage/build this file
10
17
ctx.actions.run_shell(
11
18
outputs= [out],
12
19
command="echo 'ERROR: PyPI package \"{pkg}\" is not available{hub_clause}.' >&2 && exit 1".format(
13
20
pkg=ctx.attr.package_name,
14
-
hub_clause=(' when building under PyPI hub "%s"'%ctx.attr.hub_name) ifctx.attr.hub_nameelse" because no PyPI hub or default hub is requested",
'ERROR: PyPI package "declared_only_pkg:declared-only-alias" is not available when building under PyPI hub "pypi_b"\\. Try adding it to the requirements of this hub',
0 commit comments