Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Comments on What is the point of pipx?

Parent

What is the point of pipx?

+10
−0

Background

Many Python programs now recommend installing with pipx, and there is a sense that you shouldn't install with pip anymore, you should use tools like pipx.

Main Question

However, what does pipx actually do that makes it such a preferred alternative to pip?

Thoughts

I checked their docs and what I found doesn't really make sense. In sum:

  • pipx is described as a package manager, but package managers install files in system locations whereas pipx installs them in user locations. Also, package managers already have python-... packages where it makes sense.
  • It mentions that unlike pip, it is specifically for CLI apps. But what exactly does pip not do? AFAIK executable packages just have a wrapper script in ~/.local/bin/ that calls them. This doesn't seem worth a whole program.
  • It talks about PyPi as an "app store", which sounds weird. Yes, people can and do distribute on PyPi, but there are major differences which pipx hardly closes.

I do see that it mentions isolating envs. I can see how it is not straightforward with pip to install each CLI app in a venv, but also make it available in PATH. So is that all pipx is, CLI apps in venv? This seems like a rather inefficient way to handle packaging (see also "static link everything").

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

"package managers install files in system locations" (3 comments)
Post
+6
−0

They are tools for different audiences. pipx does not replace pip.

In some more detail, pip answers the question "As a Python developer, how can I install Python packages and their dependencies" whereas pipx answers the question "As a user, how can I conveniently install a tool which is available via PyPi, without learning anything about Python, and without ending up in a situation where two packages I installed have trouble coexisting because they have conflicting or otherwise incompatible dependencies?"

Seen from this angle, it's pretty clear that the use cases are different.

pipx takes care to encapsulate each installation so that, behind the scenes, the installation effectively has its own virtual environment which gets activated when you run a pipx-installed command. Thus, any dependencies pipx installs are specific to, and separated from, any other Python packages installed elsewhere on your system somehow.

Even as a Python developer, I have some tools that I install because they are convenient to have available on my system, not particularly because they help me with Python or as a developer. The CLI for Amazon AWS is a good example.

Also, on shared servers, I can install tools like ruff without messing with the system or breaking anything for other users.

Any instructions which recommend installation with pipx, then, are meant for consumers of the utility package. The instructions basically imply, "if you know how to use pip, and prefer to use that for your use case (for example, to install this package as a dependency for a Python project of your own), by all means use pip instead if you like."

Obviously, pipx only makes sense for packages which are useful as a standalone CLI utility. For your Python development needs, pip remains the recommended installation tool, and the only one which makes sense for a library you want to use from your own Python code, directly or indirectly.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

2 comment threads

General feedback (3 comments)
Bootstrapping (2 comments)
General feedback
matthewsnyder‭ wrote over 1 year ago

First, it's more accurate to say that pip is for installing python packages. When you say "dependencies", that makes it sound as if it can't install "tools", when in fact it can install any package. I am not aware of pip being specced specifically as to exclude installing non-dependencies. This is why I asked the question - it's not clear what exactly is impossible or difficult with pip, and easy with pipx.

I think you're getting close to the actual answer with the brief remark in parentheses. This answer would be better if you expanded on that to explain the use case more concretely, and added examples.

tripleee‭ wrote over 1 year ago

Thanks for the feedback. I removed the parentheses and expanded slighty on what exactly pipx does. The AWS example seems sufficient to me as an illustration; did you have some other type of example in mind?

matthewsnyder‭ wrote over 1 year ago

Thank you! That actually does answer my question.