pip: Add support for various pip install modes#72097
Conversation
|
The test The test The test |
5f91c9d to
6c041e5
Compare
dd4b6f2 to
4bea9bf
Compare
4bea9bf to
9b0f96f
Compare
|
ready_for_review |
|
A number of the idempotence checks would be broken by this change, as well as potentially allowing "escape" from a virtualenv. Would also need to look into using module respawn to ensure that the idempotence checks run in the proper context. If you're still interested in moving forward with this, we can do a full review- just let us know. Thanks! |
Hey @nitzmahone - certainly happy to consider more changes, though with it being 18 months since I worked on this it will probably require quite a few updates anyway, I see some merge conflicts are showing up. In the meantime, I'd be interested to have more information on the problems you describe 😃 |
|
@nightowlengineer Thanks for the contribution. Could you please rebase this branch to incorporate new changes? Thanks, |
|
@nightowlengineer This PR is waiting for your response. Please respond or the PR will be closed. |
|
I mean it's been 5 years so I'm happy to get it updated but it's not going to be top of my list. I haven't seen any additional guidance/suggestions since the review above either. If I invest the time in bringing this up to date, will it actually get reviewed and merged? |
SUMMARY
Introduces support for the various 'site' locations in pip - system (default), user, target, prefix, root. Fixes #56333, potential fix for #71781
ISSUE TYPE
COMPONENT NAME
pip
ADDITIONAL INFORMATION
Currently pip can only be used to install to the 'user site' location by including extra_args, which is not a great user experience. The module also (correctly) marks any invocation with extra_args as 'changed' when in check mode. This will allow at least some tasks to be migrated away and have more accurate idempotency.
Before:
{ "virtualenv": null, "changed": true, "requirements": null, "name": [ "pyyaml" ], "stdout": "Collecting pyyaml==5.3.0\nInstalling collected packages: pyyaml\nSuccessfully installed pyyaml-5.3\n", "cmd": [ "/usr/bin/pip3", "install", "pyyaml==5.3.0" ], "state": "present", "version": "5.3.0", "stderr": "", "invocation": { "module_args": { "virtualenv": null, "virtualenv_site_packages": false, "executable": "pip3", "chdir": null, "requirements": null, "name": [ "pyyaml" ], "virtualenv_python": null, "editable": false, "umask": null, "virtualenv_command": "virtualenv", "extra_args": null, "state": "present", "version": "5.3.0" } } }After (user):
{ "virtualenv": null, "changed": true, "requirements": null, "name": [ "pyyaml" ], "stdout": "Collecting pyyaml==5.3.0\nInstalling collected packages: pyyaml\nSuccessfully installed pyyaml-5.3\n", "cmd": [ "/usr/bin/pip3", "install", "--user", "pyyaml==5.3.0" ], "state": "present", "version": "5.3.0", "stderr": "", "invocation": { "module_args": { "virtualenv": null, "virtualenv_site_packages": false, "executable": "pip3", "chdir": null, "requirements": null, "name": [ "pyyaml" ], "virtualenv_python": null, "editable": false, "umask": null, "site": "user", "virtualenv_command": "virtualenv", "extra_args": null, "state": "present", "version": "5.3.0", "path": null } } }After (prefix):
{ "virtualenv": null, "changed": true, "requirements": null, "name": [ "pyyaml" ], "stdout": "Collecting pyyaml==5.3.0\nInstalling collected packages: pyyaml\nSuccessfully installed pyyaml-5.3\n", "cmd": [ "/usr/bin/pip3", "install", "--root", "/tmp/prefixed-path", "pyyaml==5.3.0" ], "state": "present", "version": "5.3.0", "stderr": "", "invocation": { "module_args": { "virtualenv": null, "virtualenv_site_packages": false, "executable": "pip3", "chdir": null, "requirements": null, "name": [ "pyyaml" ], "virtualenv_python": null, "editable": false, "umask": null, "site": "root", "virtualenv_command": "virtualenv", "extra_args": null, "state": "present", "version": "5.3.0", "path": "/tmp/prefixed-path" } } }