-
-
Notifications
You must be signed in to change notification settings - Fork 638
Description
π feature request
Relevant Rules
hubs created by pip.parse.
Description
One shall not use multiple hubs in the same dependency tree as otherwise potentially one can have one Python module multiple times with different versions in the dependency tree.
While this is easy to follow in small projects, ensuring this never happens by accident in large projects is a challenge. Especially, if the different hubs come to a target as non obvious transitive dependencies.
Since, the order of dependencies affects which version of a duplicated module is found first, this can cause surprising behavior in a number of scenarios.
Describe the solution you'd like
I believe one can detect clashing hubs with a Bazel aspect. I did a naive implementation locally and it worked well for my toy examples.
It would be great if rules_python would offer an aspect for detecting hub clashes.
In my naive implementation I relied on the naming scheme pip.parse uses to create the workspaces for the individual Python modules contained in a hub.
While it is easy enough to unit test this works as expected given a certain Bazel and rules_python version, such code relying on rules_python implementation details is better suited to live in rules_python itself.
An alternative could be an aspect ensuring no Python module offered by a hub exists twice in the dependency tree. This would allow combining hubs as long as no errornous dependency duplication is introduced.
Describe alternatives you've considered
I am not aware of other measures to ensure hubs never clash.