Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1c768ca
feat(pypi): enable pipstar by default on bzlmod
aignas Aug 30, 2025
10692ce
chore: cleanup bzlmod codebase after pipstar enabling
aignas Sep 7, 2025
6177306
Revert "chore: cleanup bzlmod codebase after pipstar enabling"
aignas Sep 8, 2025
b8bb5fa
enable pipstar in tests
aignas Sep 8, 2025
1194739
Merge branch 'main' into aignas.exp.bzlmod.enable.pipstar
aignas Sep 28, 2025
2ab8e3c
chore: also enable pipstar on WORKSPACE
aignas Sep 28, 2025
320b65f
pass a dummy list instead of passing dep_template
aignas Sep 28, 2025
8fc665e
a better included packages passing
aignas Sep 28, 2025
8ceeee6
actually turn the switch on for WORKSPACE
aignas Sep 28, 2025
881e6bf
fix the dep wiring in WORKSPACE
aignas Sep 28, 2025
a9e4e83
add a note
aignas Sep 28, 2025
e096244
fixup
aignas Sep 28, 2025
47b80c4
add extra docs to the changelog and adjust a bit
aignas Sep 30, 2025
162c2f4
also test what we suggest in CHANGELOG
aignas Sep 30, 2025
c8bd484
Apply suggestion from @gemini-code-assist[bot]
aignas Oct 1, 2025
e6e60ac
Update CHANGELOG.md
aignas Oct 1, 2025
a91a147
wip
aignas Oct 2, 2025
52d65dd
remove the CHANGELOG note
aignas Oct 2, 2025
e5916e7
use hub aliases repo if available: wip finish multi_pip_parse if needed
aignas Oct 2, 2025
af68cce
consolidate the config and group libraries
aignas Oct 4, 2025
a61e676
fixup
aignas Oct 4, 2025
e6f09b5
further cleanup to prepare for final review
aignas Oct 4, 2025
323cb13
extra tidyup and fixes
aignas Oct 4, 2025
5157614
deprecated is not an attr kwarg
aignas Oct 4, 2025
4b18416
fixup
aignas Oct 4, 2025
513c8bb
Merge branch 'main' into aignas.exp.bzlmod.enable.pipstar
aignas Oct 4, 2025
42fef58
clarify wording
aignas Oct 4, 2025
ff28b1b
comments
aignas Oct 5, 2025
a0e4b47
fixup! comments
aignas Oct 5, 2025
f308d07
add notes about vendoring
aignas Oct 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ END_UNRELEASED_TEMPLATE
* (bootstrap) For {obj}`--bootstrap_impl=system_python`, the sys.path order has
changed from `[app paths, stdlib, runtime site-packages]` to `[stdlib, app
paths, runtime site-packages]`.
* (pypi) `pipstar` flag has been flipped to be enabled by default for bzlmod
([#2949](https://github.com/bazel-contrib/rules_python/issues/2949)).

{#v0-0-0-fixed}
### Fixed
Expand Down
3 changes: 2 additions & 1 deletion python/private/internal_config_repo.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ settings for rules to later use.

load(":repo_utils.bzl", "repo_utils")

_BZLMOD_ENABLED = "@@" in str(Label("//:unused"))
_ENABLE_PIPSTAR_ENVVAR_NAME = "RULES_PYTHON_ENABLE_PIPSTAR"
_ENABLE_PIPSTAR_DEFAULT = "0"
_ENABLE_PIPSTAR_DEFAULT = "1" if _BZLMOD_ENABLED else "0"
_ENABLE_PYSTAR_ENVVAR_NAME = "RULES_PYTHON_ENABLE_PYSTAR"
_ENABLE_PYSTAR_DEFAULT = "1"
_ENABLE_DEPRECATION_WARNINGS_ENVVAR_NAME = "RULES_PYTHON_DEPRECATION_WARNINGS"
Expand Down
3 changes: 3 additions & 0 deletions python/private/internal_dev_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def _internal_dev_deps_impl(mctx):
name = "somepkg_with_build_files",
whl_file = "@whl_with_build_files//:somepkg-1.0-any-none-any.whl",
requirement = "somepkg",
dep_template = "@rules_python//tests/support:support.bzl",
)

# Setup for //tests/implicit_namespace_packages
Expand All @@ -53,6 +54,7 @@ def _internal_dev_deps_impl(mctx):
whl_file = "@implicit_namespace_ns_sub1_whl//:ns_sub1-1.0-any-none-any.whl",
requirement = "ns-sub1",
enable_implicit_namespace_pkgs = False,
dep_template = "@rules_python//tests/support:support.bzl",
)

whl_from_dir_repo(
Expand All @@ -65,6 +67,7 @@ def _internal_dev_deps_impl(mctx):
whl_file = "@implicit_namespace_ns_sub2_whl//:ns_sub2-1.0-any-none-any.whl",
requirement = "ns-sub2",
enable_implicit_namespace_pkgs = False,
dep_template = "@rules_python//tests/support:support.bzl",
)

internal_dev_deps = module_extension(
Expand Down
6 changes: 5 additions & 1 deletion python/private/pypi/whl_metadata.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ def whl_metadata(*, install_dir, read_fn, logger):
result = parse_whl_metadata(contents)

if not (result.name and result.version):
logger.fail("Failed to parsed the wheel METADATA file:\n{}".format(contents))
logger.fail("Failed to parsed the wheel METADATA file:\n{}\n{}\n{}".format(
80 * "=",
contents.rstrip("\n"),
80 * "=",
))
return None

return result
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Name: ns-sub1
Version: 1.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Name: ns-sub2
Version: 1.0
40 changes: 2 additions & 38 deletions tests/pypi/hub_builder/hub_builder_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ simple==0.0.1 \

def hub_builder(
env,
enable_pipstar = False,
enable_pipstar = True,
debug = False,
config = None,
minor_mapping = {},
Expand Down Expand Up @@ -405,7 +405,7 @@ def _test_torch_experimental_index_url(env):
env,
config = struct(
netrc = None,
enable_pipstar = False,
enable_pipstar = True,
auth_patterns = {},
platforms = {
"{}_{}".format(os, cpu): _plat(
Expand Down Expand Up @@ -516,7 +516,6 @@ torch==2.4.1+cpu ; platform_machine == 'x86_64' \
pypi.whl_libraries().contains_exactly({
"pypi_312_torch_cp312_cp312_linux_x86_64_8800deef": {
"dep_template": "@pypi//{name}:{target}",
"experimental_target_platforms": ["linux_x86_64"],
"filename": "torch-2.4.1+cpu-cp312-cp312-linux_x86_64.whl",
"python_interpreter_target": "unit_test_interpreter_target",
"requirement": "torch==2.4.1+cpu",
Expand All @@ -525,7 +524,6 @@ torch==2.4.1+cpu ; platform_machine == 'x86_64' \
},
"pypi_312_torch_cp312_cp312_manylinux_2_17_aarch64_36109432": {
"dep_template": "@pypi//{name}:{target}",
"experimental_target_platforms": ["linux_aarch64"],
"filename": "torch-2.4.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"python_interpreter_target": "unit_test_interpreter_target",
"requirement": "torch==2.4.1",
Expand All @@ -534,7 +532,6 @@ torch==2.4.1+cpu ; platform_machine == 'x86_64' \
},
"pypi_312_torch_cp312_cp312_win_amd64_3a570e5c": {
"dep_template": "@pypi//{name}:{target}",
"experimental_target_platforms": ["windows_x86_64"],
"filename": "torch-2.4.1+cpu-cp312-cp312-win_amd64.whl",
"python_interpreter_target": "unit_test_interpreter_target",
"requirement": "torch==2.4.1+cpu",
Expand All @@ -543,7 +540,6 @@ torch==2.4.1+cpu ; platform_machine == 'x86_64' \
},
"pypi_312_torch_cp312_none_macosx_11_0_arm64_72b484d5": {
"dep_template": "@pypi//{name}:{target}",
"experimental_target_platforms": ["osx_aarch64"],
"filename": "torch-2.4.1-cp312-none-macosx_11_0_arm64.whl",
"python_interpreter_target": "unit_test_interpreter_target",
"requirement": "torch==2.4.1",
Expand Down Expand Up @@ -621,8 +617,6 @@ simple==0.0.3 \
"pypi_315_extra": {
"dep_template": "@pypi//{name}:{target}",
"download_only": True,
# TODO @aignas 2025-04-20: ensure that this is in the hub repo
# "experimental_target_platforms": ["cp315_linux_x86_64"],
"extra_pip_args": ["--platform=manylinux_2_17_x86_64", "--python-version=315", "--implementation=cp", "--abi=cp315"],
"python_interpreter_target": "unit_test_interpreter_target",
"requirement": "extra==0.0.1 --hash=sha256:deadb00f",
Expand Down Expand Up @@ -821,12 +815,6 @@ git_dep @ git+https://git.server/repo/project@deadbeefdeadbeef
pypi.whl_libraries().contains_exactly({
"pypi_315_any_name": {
"dep_template": "@pypi//{name}:{target}",
"experimental_target_platforms": [
"linux_aarch64",
"linux_x86_64",
"osx_aarch64",
"windows_aarch64",
],
"extra_pip_args": ["--extra-args-for-sdist-building"],
"filename": "any-name.tar.gz",
"python_interpreter_target": "unit_test_interpreter_target",
Expand All @@ -836,12 +824,6 @@ git_dep @ git+https://git.server/repo/project@deadbeefdeadbeef
},
"pypi_315_direct_without_sha_0_0_1_py3_none_any": {
"dep_template": "@pypi//{name}:{target}",
"experimental_target_platforms": [
"linux_aarch64",
"linux_x86_64",
"osx_aarch64",
"windows_aarch64",
],
"filename": "direct_without_sha-0.0.1-py3-none-any.whl",
"python_interpreter_target": "unit_test_interpreter_target",
"requirement": "direct_without_sha==0.0.1",
Expand All @@ -862,12 +844,6 @@ git_dep @ git+https://git.server/repo/project@deadbeefdeadbeef
},
"pypi_315_simple_py3_none_any_deadb00f": {
"dep_template": "@pypi//{name}:{target}",
"experimental_target_platforms": [
"linux_aarch64",
"linux_x86_64",
"osx_aarch64",
"windows_aarch64",
],
"filename": "simple-0.0.1-py3-none-any.whl",
"python_interpreter_target": "unit_test_interpreter_target",
"requirement": "simple==0.0.1",
Expand All @@ -876,12 +852,6 @@ git_dep @ git+https://git.server/repo/project@deadbeefdeadbeef
},
"pypi_315_some_pkg_py3_none_any_deadbaaf": {
"dep_template": "@pypi//{name}:{target}",
"experimental_target_platforms": [
"linux_aarch64",
"linux_x86_64",
"osx_aarch64",
"windows_aarch64",
],
"filename": "some_pkg-0.0.1-py3-none-any.whl",
"python_interpreter_target": "unit_test_interpreter_target",
"requirement": "some_pkg==0.0.1",
Expand All @@ -890,12 +860,6 @@ git_dep @ git+https://git.server/repo/project@deadbeefdeadbeef
},
"pypi_315_some_py3_none_any_deadb33f": {
"dep_template": "@pypi//{name}:{target}",
"experimental_target_platforms": [
"linux_aarch64",
"linux_x86_64",
"osx_aarch64",
"windows_aarch64",
],
"filename": "some-other-pkg-0.0.1-py3-none-any.whl",
"python_interpreter_target": "unit_test_interpreter_target",
"requirement": "some_other_pkg==0.0.1",
Expand Down
3 changes: 3 additions & 0 deletions tests/support/support.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
load("//python/private:bzlmod_enabled.bzl", "BZLMOD_ENABLED") # buildifier: disable=bzl-visibility
load("//python/private:util.bzl", "IS_BAZEL_7_OR_HIGHER") # buildifier: disable=bzl-visibility

# this is used in integration tests with `whl_library`
whl_map = []

MAC = Label("//tests/support:mac")
MAC_X86_64 = Label("//tests/support:mac_x86_64")
LINUX = Label("//tests/support:linux")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Name: somepkg
Version: 1.0