jdx / mise

dev tools, env vars, task runner
https://mise.jdx.dev
MIT License
8.07k stars 211 forks source link

Use uv for much faster Python virtual env creation #2279

Open rsyring opened 3 weeks ago

rsyring commented 3 weeks ago

virtualenv and uv venv are much faster than python -m venv at creating virtual envs:

❯ time python -m venv python-demo           # 2.79 secs

❯ time pyvenv/bin/virtualenv venv-demo     #  224.15 millis

❯ time pyvenv/bin/uv venv uv-venv-demo  # 19.79 millis

I'm not sure how best to ensure those tools are installed and can be used. Should mise offer an "install command" type option (like tox) or just use uv or virtualenv if its on the path and assume the user is taking care of that? I'm inclined towards the latter and, if a user wants it to be more automatic, they should put their desired tool in default-python-packages or, as I would do, make it available using pipx.

nickchomey commented 3 weeks ago

If this doesn't happen, you might consider using Rye, which is now developed by the same folks as uv and uses it under the hood. Their goal is to make the Rust cargo of python.

I wrote about how I got it working in mise here - you can just skip the mise python altogether. You might even say it is the mise of python!