Skip to content
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

uv pipx {run,install} #1173

Closed
konstin opened this issue Jan 29, 2024 · 11 comments
Closed

uv pipx {run,install} #1173

konstin opened this issue Jan 29, 2024 · 11 comments
Labels
enhancement New feature or improvement to existing functionality

Comments

@konstin
Copy link
Member

konstin commented Jan 29, 2024

pipx is the preferred way to install python tools globally, storing each tool in an isolated, managed environment instead of causing problem in the global or user local environment.

We have all the basic parts required for pipx (venv creation, resolution, installation). What uv pipx would need to do is create a venv in a uv subfolder of the user data dir, install the requested package and expose the entrypoints/scripts to .local/bin or platform equivalent. We can extend this to arbitrary standard of pipx compatibility with options such as upgrade, reinstall, extend, etc.

@konstin konstin added the enhancement New feature or improvement to existing functionality label Jan 29, 2024
@zanieb zanieb changed the title puffin pipx {run,install} uv pipx {run,install} Feb 15, 2024
@mqudsi
Copy link

mqudsi commented Feb 16, 2024

This would be really cool.

fwiw, I found it misleading that the release announcement said uv is a full drop-in replacement for pipx (by name).. but it's not?

@BurntSushi
Copy link
Member

This would be really cool.

fwiw, I found it misleading that the release announcement said uv is a full drop-in replacement for pipx (by name).. but it's not?

Not pipx. pip.

@mqudsi
Copy link

mqudsi commented Feb 16, 2024

Just double-checked. I mistook the part about "imagine a tool that replaces" for the "this is a tool that replaces".

Mea culpa!

@johnthagen
Copy link

johnthagen commented Feb 29, 2024

This would be a great way to provide an equivalent to cargo install within uv. 👍

Related to this would be PEP 723 support (inline script metadata), which pipx run also provides.

Related to

@pfmoore
Copy link
Contributor

pfmoore commented Mar 19, 2024

Can we make the command uv run, and not uv pipx run? The convention of using uv <some command we're trying to emulate> as a subcommand seems like a bad approach long-term:

  1. It either causes confusion for users, or it locks uv into matching the design of the original command, warts and all.
  2. It creates a "competitive" impression, rather than a "co-operative" one.
  3. Should uv become dominant, and the original command get abandoned, the subcommand name will no longer make any sense.

@astrojuanlu
Copy link

astrojuanlu commented Mar 19, 2024

Related: #1657

@johnthagen
Copy link

The convention of using uv <some command we're trying to emulate> as a subcommand seems like a bad approach long-term:

From hearing Charlie talk about the current design of uv, the reason for this is so that uv can easily slot into existing workflows today, and at the same time provides Astal with a concrete set of features by which they can get all of the lower level machinery re-implemented in Rust. They did this with Ruff to pretty great effect.

I think there is a certain wisdom in this, since it allows them to keep the top level uv ___ open so they can get a lot of experience in the lower level internals before really stretching for ultimate goal of providing a Cargo/rustup-like experience for Python.

@konstin
Copy link
Member Author

konstin commented Mar 19, 2024

I want to keep the uv run name for running in-project scripts, i'm thinking about using something like uv install <tool> and uv runx <tool> or uv tool <tool> for pipx/npx-like global tools.

It either causes confusion for users, or it locks uv into matching the design of the original command, warts and all.

Can you talk a bit about what warts you wouldn't want us to emulate? We normally aim to be very similar to provide easier migration, so it's helpful to know where we should deviate.

@pfmoore
Copy link
Contributor

pfmoore commented Mar 19, 2024

Can you talk a bit about what warts you wouldn't want us to emulate?

Off the top of my head:

  • The design of --target, and the way it looks like a variant on a normal install, but doesn't act like one in practice (upgrades don't work as expected, uninstall isn't supported, list doesn't work, etc). Supporting the use case(s) is important, but the command design sucks.
  • Similarly, the mess of --prefer-binary vs --only-binary vs --no-binary, and the debate about making --only-binary :all: the default. Getting this right from the start rather than inheriting pip's baggage would be far better.
  • Keyring and authentication support. There's lots of problems with how pip does authentication, and the way keyring is supported is a mess of tentative part solutions, caused almost entirely by the fact that keyring itself isn't a pure Python dependency so we couldn't vendor it.
  • Passing of pip options to the installation of dependencies in the isolated build environment is a bit of a mess, which largely just grew out of fixing bugs as they came up. Having a proper design for how the user can configure the way installs to the build environment work would be much better.
  • All of the --root, --prefix and --implementation/--abi/--platform flags, intended to make preparing an installation to be copied to "another" Python, are (IMO) far too complex, and require a deep understanding from the user to be able to use them correctly.

There's also the warts you've already chosen not to match pip over - --resolution and --pre-release spring to mind, as well as the way you treat --extra-index-url. It's hard to take seriously the idea that you prefer to emulate pip's interface "warts and all" when these examples show that it's actually only "the warts we don't want to fix"...

@samypr100
Copy link
Collaborator

Thanks @pfmoore, this is a very useful list. Always good to know what alternative approaches would've been better in hindsight.

@zanieb
Copy link
Member

zanieb commented May 13, 2024

I'm going to close this in favor of the more accurate tracking issue at #3560. Regardless, I'll report back here when there's significant progress as I know there are a lot of subscribers to this issue.

@zanieb zanieb closed this as not planned Won't fix, can't repro, duplicate, stale May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement to existing functionality
Projects
None yet
Development

No branches or pull requests

8 participants