Python: add ensurepip variant#28205
Conversation
cosmicexplorer
left a comment
There was a problem hiding this comment.
I think the only thing we should think about is whether to default to +ensurepip or ~ensurepip.
Regarding whether users expect pip to be made available: on Alpine and Ubuntu I both have to ensure I apk add python3{,-pip} or apt install python3{,-pip} in order to get pip installed, so while I think it's a great thing to expose ensurepip in spack, I think it makes some sense to not have it on by default? Unclear if I'm missing something.
I'm also a bit concerned with how this will interact with #27798. We may need to make the dependency on py-pip in PythonPackage conditional on the Python variant.
Will try to review that one asap to get more context on this then!
| variant('virtualenv', default=False, description='Install optional virtualenv dependency') | ||
|
|
||
| depends_on('[email protected]:', type=('build', 'run')) | ||
| depends_on('[email protected]:+ensurepip', type=('build', 'run')) |
There was a problem hiding this comment.
How would we add a test case for this functionality? I could add it in a followup if it's too tedious here.
There was a problem hiding this comment.
You could create a fake package following the instructions at https://packaging.python.org/en/latest/tutorials/packaging-projects/ and try to build it. I think it would need at least one dependency? It would also need internet access.
This or we can have a |
Many users are surprised that
spack install pythondoes not installpip(#2065). Some packages actually require a version of Python built with--ensurepip(pypa/build#266). This PR adds an+ensurepipvariant to the Python package.I think the only thing we should think about is whether to default to
+ensurepipor~ensurepip. I'm also a bit concerned with how this will interact with #27798. We may need to make the dependency onpy-pipinPythonPackageconditional on the Python variant.Note that the
ensurepipmodule is available in Python even if--without-ensurepipis used. The module seems to work fine, but when you create a venv it doesn't containpip. This causes tools likebuildto fail.Closes #2065