rules_python icon indicating copy to clipboard operation
rules_python copied to clipboard

Isolated wheel building ignores rules_python-provided PYTHONPATH

Open dflems opened this issue 3 years ago • 1 comments
trafficstars

pip_repository goes through the effort of building PYTHONPATH using its vendored dependencies like setuptools. This is used in pip_repository and whl_library.

By default, it also passes --isolated to pip wheel, thereby ignoring the environment variables that it just set, so when wheels are built, the setuptools from rules_python is not used, instead the interpreter uses whatever setuptools is available to it.

Is this intended? For now I'm just setting isolated = False, but I would assume that rules_python would try and use the vendored python libraries for the sake of consistency, even when building wheels in isolated mode.

Context: Latest setuptools (63.1.0) is broken on non-homebrew macOS python 3.9 installations. I noticed that pip wheel was failing because of this and it was unexpectedly using this version rather than the one vendored in rules_python.

dflems avatar Jul 13 '22 18:07 dflems

Is this intended?

I think in general, yes. I don't think the rules should be imposing dependencies on the users of the rules. Perhaps one idea would be to supply an additional lockfile for "build requirements" that get installed first before pip wheel is run? Or maybe only the version of setuptools to preinstall?

I agree that it's not great that it's not consistent between PYTHONPATH and the usage of pip wheel.

The situation where these rules fallback to running builds when they encounter sdist is an unfortunate situation of python packaging. These rules really work best when used with --only-binary=:all:.

groodt avatar Jul 15 '22 10:07 groodt

This issue was automatically closed because it went 30 days without a reply since it was labeled "Can Close?"

github-actions[bot] avatar Sep 13 '22 22:09 github-actions[bot]