-
Notifications
You must be signed in to change notification settings - Fork 414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated PR: Added --global option to perform actions for all users (#754) #1281
Conversation
Pinging @Gitznik who offered help in the original PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for picking this up! However we'll definitely need to add some more documentation, and extend the "How pipx works" documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for picking this up!
Thank you for the review and all helpful comments! I had a look into https://pipx.pypa.io/stable/how-pipx-works/ but I am not sure if I will be able to adjust the doc without blurring everything given my limited knowledge of pipx codebase. Some help here from your side would be highly appreciated! For now, I have updated the docs in docs/installation.md which already mention the env variables so I could add a concise and (hopefully) understandable note regarding |
Probably adding a bullet point mentioning the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just docs stuff, otherwise lgtm 👍
Is there anything I can do to get the tests to pass on MacOS? I am not sure why I get permission denied accessing |
You can use platformdirs |
That sounds good for MacOS, but I think we should stick to |
There's a lot of discourse around it online (spend about 20 minutes yesterday reading conflicting opinions on that topic). From what I gathered either would be fine, really. BSD derivatives favor IMO - stick to the decision |
Good, but if downstream packagers complain because they feel the need to patch this behaviour I'll direct them to you ;-) |
If you think that's a realistic scenario, let's go for |
I tested it locally on my Mac machine and writing to '/opt' works both on Intel and ARM Mac but I have to run commands as a root user with |
To follow up on my last comment I just run tests in with python docker image (debian based) with a non-root user and I got very similar output like in MacOS tests:
The same tests passes with a root user. I'm checking for the core issue but from what it looks like it's not the problem of EDIT: From what it looks like the |
On a separate branch just to test what I said above I have added a call in the failing MacOS test to set paths to local (which resets what previous tests did) and now MacOS tests are passing. Commit: https://github.com/Jendker/pipx/commit/969f0390df81197a99a871c32153a6355e79c65a It doesn't solve the core issue with pytest, is only a workaround. I don't have enough expertise in pytest to understand why that's needed in the first place but if you think that this test workaround is good enough for now I'll add this commit to PR branch and I think we can merge. |
* Added --global switch that sets the relevant paths to point to locations that should be accessable to all users. * Added --global specific tests * The implementation is crude.
...by not having --global in windows The behavior intended by --global doesn't have a precedent in windows when using pip (as in running pip with sudo). Leaving windows support to another time after some discussion.
* Moved path management to `pipx.paths` * Path "constants" available via a context object `pipx.paths.ctx`
|
This reverts commit fe24c8f.
That's a good point but that's still something the developer needs to add to avoid tests leaking so there is no substantial difference between adding |
Yes you're right. A lot of test have I'm fine with either version |
I have removed all the explicit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a quick note to the ensurepath
docs that you need to run it with --global
to add the global location to the PATH
. Aside from that - looks good to me know. Great work :)
Done in 740b775 :) |
I'm a bit late with the comment, but Homebrew used to install itself in |
If all looks good to you can this be merged? I am worried about the possible conflicts with other PR which may emerge if it doesn’t get merged into master some time soon |
Thanks for picking this up and following all the way through @Jendker 🚀 |
@Gitznik Is there an ETA for the next release? I can't wait to try this feature. |
And until I've refurbished the release pipeline to do so, please feel free to install directly from the |
changelog.d/
(if the patch affects the end users)Summary of changes
Adds a
--global
option to perform actions for all users. This is a resubmission of PR #1088 by https://github.com/haxwithaxe which I rebased on the latestmain
.Test plan
Passes your CI process on github (via your unaltered actions in my fork) apart from MacOS test which needs to be investigated. Help from your side is highly appreciated. Test run from my fork: https://github.com/Jendker/pipx/actions/runs/8182365101
To verify the changes do what they are supposed to
To test all the relevant commands for regressions.