8000 add more ideas · aignas/rules_python@03932a6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 03932a6

Browse files
committed
add more ideas
10000
1 parent b302243 commit 03932a6

File tree

1 file changed

+55
-31
lines changed

1 file changed

+55
-31
lines changed

python/private/pypi/extension.bzl

Lines changed: 55 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -431,32 +431,6 @@ def parse_modules(
431431
Returns:
432432
A struct with the following attributes:
433433
"""
434-
defaults = {
435-
"platforms": {},
436-
}
437-
for mod in module_ctx.modules:
438-
if not (mod.is_root or mod.name == "rules_python"):
439-
continue
440-
441-
for tag in mod.tags.default:
442-
_configure(
443-
defaults,
444-
arch_name = tag.arch_name,
445-
constraint_values = tag.constraint_values,
446-
# The env_ values is only used if the `PIPSTAR` is enabled
447-
env_implementation_name = tag.env_implementation_name,
448-
env_os_name = tag.env_os_name,
449-
env_platform_machine = tag.env_platform_machine,
450-
env_platform_release = tag.env_platform_release,
451-
env_platform_system = tag.env_platform_system,
452-
env_platform_version = tag.env_platform_version,
453-
env_sys_platform = tag.env_sys_platform,
454-
os_name = tag.os_name,
455-
platform = tag.platform,
456-
target_settings = tag.target_settings,
457-
override = mod.is_root,
458-
)
459-
460434
whl_mods = {}
461435
for mod in module_ctx.modules:
462436
for whl_mod in mod.tags.whl_mods:
@@ -488,6 +462,36 @@ You cannot use both the additive_build_content and additive_build_content_file a
488462
srcs_exclude_glob = whl_mod.srcs_exclude_glob,
489463
)
490464

465+
defaults = {
466+
"platforms": {},
467+
}
468+
for mod in module_ctx.modules:
469+
if not (mod.is_root or mod.name == "rules_python"):
470+
continue
471+
472+
for tag in mod.tags.default:
473+
_configure(
474+
defaults,
475+
arch_name = tag.arch_name,
476+
constraint_values = tag.constraint_values,
477+
# The env_ values is only used if the `PIPSTAR` is enabled
478+
env_implementation_name = tag.env_implementation_name,
479+
env_os_name = tag.env_os_name,
480+
env_platform_machine = tag.env_platform_machine,
481+
env_platform_release = tag.env_platform_release,
482+
env_platform_system = tag.env_platform_system,
483+
env_platform_version = tag.env_platform_version,
484+
env_sys_platform = tag.env_sys_platform,
485+
os_name = tag.os_name,
486+
platform = tag.platform,
487+
target_settings = tag.target_settings,
488+
override = mod.is_root,
489+
# TODO @aignas 2025-05-19: add more attr groups:
490+
# * for AUTH
491+
# * for index config
492+
)
493+
494+
# Merge override API with the builder?
491495
_overriden_whl_set = {}
492496
whl_overrides = {}
493497
for module in module_ctx.modules:
@@ -597,6 +601,8 @@ You cannot use both the additive_build_content and additive_build_content_file a
597601
elif pip_attr.experimental_index_url_overrides:
598602
fail("'experimental_index_url_overrides' is a no-op unless 'experimental_index_url' is set")
599603

604+
# TODO @aignas 2025-05-19: superimpose the pip.parse on top of the defaults
605+
# and then pass everything as pip_attr
600606
out = _create_whl_repos(
601607
module_ctx,
602608
pip_attr = pip_attr,
@@ -754,6 +760,16 @@ def _pip_impl(module_ctx):
754760
_default_attrs = {
755761
"arch_name": attr.string(),
756762
"constraint_values": attr.label_list(),
763+
"os_name": attr.string(),
764+
"platform": attr.string(),
765+
# TODO @aignas 2025-05-19: use the following
766+
"target_settings": attr.label_list(
767+
doc = """\
768+
A list of config_settings that must be satisfied by the target configuration in order for this
769+
platform to be matched during analysis phase.
770+
""",
771+
),
772+
} | {
757773
# The values for PEP508 env marker evaluation during the lock file parsing
758774
"env_implementation_name": attr.string(),
759775
"env_os_name": attr.string(doc = "default will be inferred from {obj}`os_name`"),
@@ -762,14 +778,22 @@ _default_attrs = {
762778
"env_platform_system": attr.string(doc = "default will be inferred from {obj}`os_name`"),
763779
"env_platform_version": attr.string(),
764780
"env_sys_platform": attr.string(),
781+
# TODO @aignas 2025-05-19: add wiring for the following
782+
} | AUTH_ATTRS | {
783+
# TODO @aignas 2025-05-19: add wiring for the following
765784
"extra_index_urls": attr.string_list(),
766785
"index_url": attr.string(),
767-
"os_name": attr.string(),
768-
"platform": attr.string(),
769-
"target_settings": attr.label_list(
786+
"index_url_overrides": attr.string_dict(),
787+
"simpleapi_skip": attr.string_list(
770788
doc = """\
771-
A list of config_settings that must be satisfied by the target configuration in order for this
772-
platform to be matched during analysis phase.
789+
The list of packages to skip fetching metadata for from SimpleAPI index. You should
790+
normally not need this attribute, but in case you do, please report this as a bug
791+
to `rules_python` and use this attribute until the bug is fixed.
792+
793+
EXPERIMENTAL: this may be removed without notice.
794+
795+
:::{versionadded} 1.4.0
796+
:::
773797
""",
774798
),
775799
"whls_limit": attr.int(default = -1),

0 commit comments

Comments
 (0)
0