-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
Support uv
as an alternative package installer
#100
Comments
Thanks for proposing this idea! I haven't spent a lot of time yet thinking about how this tool could/should interface with I have been thinking about One big difference I've noticed and still need to understand more fully is that I need to learn more about how |
It's also worth noting that pip doesn't need to be installed in the environment these days (and personally I prefer not to do so). I agree that tools that "act on the environment" are in a somewhat odd position here. Jupyter/IPython is another example I have trouble with - I want to have it available everywhere, without having to install it into the environment (especially as it's a big, complex set of packages - I was going to say "pip-run doesn't have that issue" but with 25 packages in a pip-run installation, I'm not sure that's true...) I'd like to see a standard behaviour for tools when they need to discover the appropriate Python environment to work on. I think |
Also, regarding discovering the interpreter to use, having a |
That number seemed high to me, so I checked and for a recent Python, the number of packages installed is 13 (14 if you include pip). On Python 3.8, it's 18 (due to tomli, importlib_metadata, importlib_resources, zipp, and backports.tarfile). It's quite possible when you last checked, there were 25 dependencies. I don't see a large number of (maintained) dependencies as a problem as much as a sign of a healthy project.
All good suggestions. I'll consider them in #104 and use this ticket to focus on |
Yes, please proceed with discussions about the UI and a PR. Here are a couple of considerations that come to mind. Let's consider if we could somehow autodetect which installer the user would prefer to use. I'm not sure we can, but I'd like to have friendly defaults. Another thing to consider - how does |
Just a quick comment about which Python to use. My expectation (which doesn't match the reality right now) is that if I type |
I'm not sure "the same Python I'd normally expect" is a well-defined construct. There are a number of factors that affect which interpreter a user might expect:
In my opinion, having ever divergent processes across Windows and Linux is a bug and ideally the tooling should work toward convergence rather than perpetuating the platform-specific behaviors.
If we introduce Given the entanglement between this issue and #104, I'm not confident we can come up with a durable solution to adopt Please consider articulating your design/approach before spending too much time engineering. I think we may want to consider several different approaches before adopting one. |
No problem. It may take some time before I get round to this as life is a bit busy at the moment. I'll make sure I discuss design before implementing anything. While I understand where you're coming from with regard to #1041, I don't think it's the job of this tool to resolve the problem of how people invoke Python. That's very much the core developers issue, and if they don't resolve it, IMO we should work with existing conventions, no matter how much we may disagree with them, rather than fighting the ecosystem. With that in mind, my view is:
If there is an activated virtual environment, that is what should be used. Detecting an activated virtual environment, given that pip-run could be running in its own, different, environment, could be problematic, though. A practical solution would be to check the To make this work, we should always run the installer (whether pip or uv) with the We could consider extensions to this behaviour, such as uv's approach of automatically detecting a This comment turned out to be sufficiently long and detailed that I'm going to copy it to #104, for completeness... Footnotes
|
uv
is much faster than pip when installing packages, and therefore makes creating transient environments much quicker. For examplepip-run scipy -- -c pass
takes 16 seconds using pip, with all the relevant packages cached, but takes under 1 second withuv
(also with everything cached).A proof of concept is as simple as changing the command in pip_run.deps.load, from
to
With this change, only one test fails:
This seems to be shallow, as it's failing because the
uv
installation output differs from pip's, rather than because of a functionality issue.A more robust implementation would likely need to include a configuration option to choose
uv
orpip
, and maybe bundle a private copy ofuv
.I'd be happy to discuss details of the best UI for this, and provide a PR, if you think this is a reasonable feature to add.
The text was updated successfully, but these errors were encountered: