Minimal reproduction of a rules_python bug where pip.default() configurations in a dependency module are not respected when consumed by a root module via bzlmod.
When a Bazel module (dep_mod) defines pip.default() to configure platform-specific pip parsing, and another module (root_mod) depends on it, the pip defaults are ignored — causing incorrect dependency resolution.
├── dep_mod/ # Dependency module with pip.default() config
│ ├── MODULE.bazel # Defines pip.default() for platforms plat_a/plat_b
│ ├── BUILD # Config settings + py_binary using requests
│ └── requirements_*.txt
│
└── root_mod/ # Root module consuming dep_mod
├── MODULE.bazel # Depends on dep_mod via local_path_override
└── BUILD # py_binary depending on dep_mod//:dep
cd root_mod
bazel build //:root --@dep_mod//:plat_flag=aExpected: Build succeeds using platform plat_a pip configuration.
Actual:
- MacOS error
The target platform 'cp312.12_plat_a' could not be found in ["cp312.12_linux_x86_64", "cp312.12_linux_aarch64", "cp312.12_osx_aarch64", "cp312.12_osx_x86_64", "cp312.12_windows_x86_64", "cp312.12_windows_aarch64"] - Linux error
Error: key "cp312.12_plat_a" not found in dictionary
Duplicate the pip.default() declarations in the root module's MODULE.bazel (see commented code in root_mod/MODULE.bazel).
- Bazel: 7.5.0
- rules_python: 1.7.0
- Python: 3.12
- OS: macOS 26.1, Ubuntu 24.04