Comments (24)
It's fairly straightforward to create a Homebrew formula from a Python package. Here's the formula for doitlive
: https://github.com/Homebrew/homebrew-core/blob/master/Formula/doitlive.rb .
I then use this script to update the Homebrew formula after I make a PyPI release: https://github.com/sloria/doitlive/blob/dev/release_homebrew.sh
@cs01 Would you be up for adding this to your release workflow?
from pipx.
Got it working. Solution was to not use hombrew's virtualenv creation mechanism. Here's the pull request: Homebrew/homebrew-core#39020
from pipx.
Merged! Homebrew/homebrew-core@e3e53ec
Please run brew install pipx
to try it out.
@cs01 next step will be updating the readme to add brew install pipx
for macOS and updating your make publish
command. I'll use @sloria's release_homebrew script as a base.
PRs to come!
from pipx.
The advantage of a Homebrew installer would be that pipx could be installed in /usr/local/bin/pipx
with the other homebrew-installed binaries.
Currently, if you install pipx is installed using Homebrew-installed python3
:
python3 -m pip install --user pipx
The pipx binary gets installed to $HOME/Library/Python/3.7/bin/pipx
, which isn't in $PATH
by default.
I'm currently working around this by installing pipx with pipx...
python3 -m pip install --user pipx
python3 -m pipx install pipx
And ensuring that $HOME/.local/bin
is at the front of $PATH
:
export PATH="$HOME/.local/bin:$PATH"
from pipx.
PR's welcome to build it into the publish
target of the makefile. That way I can keep running the same command, and homebrew will be updated.
from pipx.
re:
Btw, not sure if this is relevant, but pipx no longer installs itself to $HOME/.local/bin, it just installs itself to site-packages.
Right, so the README states to run pip install --user pipx
which means it will get installed in $HOME/.local/bin
. If the user doesn't already have this in their PATH, the next command, pipx ensurepath
would fail
re: automatically running ensurepath
I believe homebrew has a strict policy against modifying a user's shell profile automatically so pipx ensurepath
cannot be done there. The general practice is to list it under the "Caveats" which is printed at install time. This is similar to how pip install --user pipx
works right now where a warning is printed if the $HOME/.local/bin
is not in the PATH.
The experience would be identical in terms of the printed warning except for the fact that the pipx
tool is guaranteed to be on the PATH via homebrew. This way, the pipx ensurepath
command or pipx --help
etc. will always work.
If the user missess the caveat to add $HOME/.local/bin
the first time, running any pipx command can notify them to do so since pipx
is guaranteed to be in the PATH.
re: maintainance
yep, if @sloria doesn't want it, I'll volunteer to maintain. I use the tool a fair amount and I've been evangalizing it at work. would love to add support for homebrew since we install the majority of our CLI tools in this way.
from pipx.
lol wait nevermind, there was a small issue! Homebrew/homebrew-core#39483
should be good momentarily, I'll post here when its merged.
from pipx.
@cs01 merged! Homebrew/homebrew-core@dfbe626
from pipx.
I am planning on making a pipx-bootstrap
package on PyPI to avoid the curl
method (#44).
I think the hardest part of the installation is modifying the PATH and opening a new terminal. What do you think would be made easier by moving to brew?
from pipx.
Just saw this thread... To your question @cs01 what are the benefits of moving to brew: Beeing able to install something with brew means its all in the same package manager: E.g. you can list all your installed packages making it easier to migrate to a new machine.
ps: Thanks for pipx. It's awsome!
from pipx.
Thank you!
I have no objection to someone adding it to brew, but I wonβt be able to take that on myself. Also note that standard installation is now more straightforward with just βpip install pipxβ so if you add it to brew there is no need for the bootstrap command.
from pipx.
hi @sloria do you want to submit a PR for adding this to homebrew or should I take a stab at it?
from pipx.
@cs01 The biggest reason as far as I can tell is that the second command in the README: pipx ensurepath
will fail if $HOME/.local/bin
isn't already in the PATH.
It's a circular dependency
from pipx.
Could you explain more about what the issue with pipx ensurepath
is? Maybe the homebrew formula could have the equivalent of pipx ensurepath
built into it?
Btw, not sure if this is relevant, but pipx no longer installs itself to $HOME/.local/bin
, it just installs itself to site-packages.
from pipx.
Not sure if this is related but the instructions in the pipx README.md say to use pip install --user pipx
.
If you are using HomeBrew built Python the --user
argument is disabled due to a bug in distuils.
https://docs.brew.sh/Homebrew-and-Python
from pipx.
@iain2k thanks for sharing! pipx technically does not require a --user
install. I wrote that because I thought it would get around common issues on mac and avoid polluting the global environment.
For anyone else reading, I would like to set expectations on this appropriately: I welcome having pipx on homebrew but want to completely rely on someone owning the pipx/homebrew experience.
I want my involvement to be make publish
(as it currently is). Any homebrew issues that come up would be owned by someone else. Is anyone interested in volunteering for this?
from pipx.
@AlJohri All yours--I won't have time to work on this.
from pipx.
which means it will get installed in $HOME/.local/bin
Is this true? On my computer it installs to ~/Library/Python/VERSION/bin
What does
python -c "import site; print(site.USER_BASE + '/bin')"
output for you?
re: automatically running ensurepath
I will defer to you to work through those details and dogfood them on your coworkers π
I'll volunteer to maintain. I use the tool a fair amount and I've been evangalizing it at work. would love to add support for homebrew since we install the majority of our CLI tools in this way.
Nice, thanks so much!
from pipx.
@cs01 you got it! π
Is this true?
My default python installed via asdf (similar to pyenv) has path of ~/.local/bin
. Homebrew python has path of: ~Library/Python/3.7/bin
(this folder does not exist).
asdf python
$ asdf list
nodejs
11.10.0
11.5.0
python
2.7.15
3.7.2
ruby
2.5.3
$ which python
/Users/al/.asdf/shims/python
$ python --version
Python 3.7.2
$ python -c "import site; print(site.USER_BASE + '/bin')"
/Users/al/.local/bin
homebrew python
$ /usr/local/bin/python3 -c "import site; print(site.USER_BASE + '/bin')"
/Users/al/Library/Python/3.7/bin
$ stat /Users/al/Library/Python/3.7/bin
stat: /Users/al/Library/Python/3.7/bin: stat: No such file or directory
from pipx.
ran into an issue where pipx ensurepath
can see the PATH is set properly but pipx install <package>
doesn't when installed via my test homebrew formula.
will work through debugging but just throwing this here in case its immediately obvious to someone
from pipx.
I think I've identified the issue. Homebrew requires creating an isolated virtualenv for any python app. For some reason, creating a venv
as pipx does, when it is already inside a virtualenv, has odd behavior.
The two virtualenvs (the homebrew isolated virtualenv for pipx) and the venv that pipx creates for a single package become linked.
Looking for a way around this...
from pipx.
Nice, thanks!
I just tried running brew install pipx
but got Error: No available formula with the name "pipx"
.
from pipx.
@cs01 try running brew update
and then brew install pipx
? maybe you have export HOMEBREW_NO_AUTO_UPDATE=1
set so it didn't automatically update
from pipx.
On macOS, as stated by some earlier, I had to
export PATH=$HOME/Library/Python/3.7/bin:$PATH
To make the command pipx
work.
from pipx.
Related Issues (20)
- Using pipx run and updating git versions HOT 6
- How to delete temporary environment of pipx run? HOT 1
- Version: 11.10.2.dev1
- `package_or_url` remains local path even after installed package is no longer editable
- `pipx install --global` partially installs in `~/.local` HOT 3
- 'pin' claims package is not installed when it is installed HOT 2
- Using `pipx inject python-lsp-server 'python-lsp-server[rope]'` fails HOT 8
- Symlinks in GitHub's markdown viewer are broken
- Pipx package in Ubuntu 24.04 is obsolete, how to properly upgrade to 1.6.0 HOT 2
- pipx wont run HOT 2
- binary not added globally when using pipx inject HOT 2
- ModuleNotFoundError: No module named 'dtw' in VSCodium on Ubuntu 24.04 LTS HOT 1
- pipx ensurepath fails on last Alpine (3.20): "No such file or directory: 'bash'" HOT 4
- Cannot run netviel HOT 1
- PIPX_GLOBAL_(HOME|BIN_DIR|MAN_DIR) missing from documentation and `pipx environment`
- Support use of truststore for pipx install
- pip._vendor.distlib.DistlibException: Unable to locate finder for 'pip._vendor.distlib' HOT 2
- Support CLI completion of environment variable names
- Feature: have a configuration file for e.g. `--pip-args` HOT 1
- `upgrade-all` does not allow specifying `--pip-args`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pipx.