Skip to content

Vooblin/pip-default-bug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

pip.default Bug Reproduction

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.

Bug Summary

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.

Repository Structure

├── 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

Reproducing the Bug

cd root_mod
bazel build //:root --@dep_mod//:plat_flag=a

Expected: 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

Workaround

Duplicate the pip.default() declarations in the root module's MODULE.bazel (see commented code in root_mod/MODULE.bazel).

Environment

  • Bazel: 7.5.0
  • rules_python: 1.7.0
  • Python: 3.12
  • OS: macOS 26.1, Ubuntu 24.04

About

Minimal reproduction of a bug in rules_python repository related to pip.default

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published