justinmayer / virtualfish

Fish shell tool for managing Python virtual environments
MIT License
1.07k stars 101 forks source link

Support for `uv` #248

Open zefr0x opened 6 months ago

zefr0x commented 6 months ago

Feature Request

Support for Astral.sh's new uv tool as a drop-in alternative for pip and virtualenv commands.

justinmayer commented 6 months ago

What is the rationale for this proposal? What problems would it solve?

zefr0x commented 6 months ago

What is the rationale for this proposal? What problems would it solve?

  1. If I'm using uv it wouldn't make scene to have python-virtualenv and other utilities that provide the same functionality in my system.

  2. uv will make most tasks blazingly faster for people who want to use it, since it was written in lower level language with best practices and doesn't have the limitations of current tools. (Benchmarks: https://github.com/astral-sh/uv/blob/main/BENCHMARKS.md)


The only disadvantage that I can see is that uv might not support every thing used in virtualfish, but we need to take a look at virtualfish's code base first.

justinmayer commented 6 months ago

If someone would like to propose a uv-related PR in a way that notably improves VirtualFish, I would be happy to merge it.

I am not much interested in purity. Respectfully, I believe that terms like “lower level” and “best practices” are largely subjective and unrelated to providing good end-user experiences.

As it relates to speed, the provided benchmarks link talks about dependency resolution, which is only related to VirtualFish by way of its use of Pip to install packages. As far as virtual environments, virtual environment creation is faster in uv but not in a way that is noticeable to end users — both uv and Virtualenv create environments in milliseconds. Virtual environment activation speeds are comparable, in the single-digit milliseconds for each.

Perhaps new environment variable setting(s) could be added that allow the user to choose which tool(s) to use for (1) virtual environment creation and (2) package installation. Something like:

set -gx VIRTUALFISH_VENV_TOOL "virtualenv"  # Or "uv", etc.
set -gx VIRTUALFISH_PACKAGE_TOOL "pip"    # Or "uv", etc.

Ideally such a change would be implemented in the form of a plugin, if technically feasible.