mu-editor / mu

A small, simple editor for beginner Python programmers. Written in Python and Qt5.
http://codewith.mu
GNU General Public License v3.0
1.39k stars 432 forks source link

Enhancement: Using `uv` to manage venv and pip install #2504

Open carlosperate opened 5 months ago

carlosperate commented 5 months ago

Astral has anounced "uv" as a drop in replacement tool for, among other things, "pip install" and virtual environment creation. When Mu needs to recreate a user venv this can take a significant amount of time, specially in slow computers, so a tool that claims to significantly help in this regard sounds quite interesting.

I've done a really quick hack to try it out: https://github.com/mu-editor/mu/commit/105c62fa823ce3092602c1170034f1070946f604

And on my machine (i7 Macbook) the time it took to launch Mu when there is no user venv went from 44 to 15 secons, so that's almost 3 times faster 🚀 with uv.

And that's without using uv to create the venv (still using virtualenv, so theoretically uv could save time there as well) and this hack also adds the extra steps to install uv inside the venv (we could ship uv installed together with Mu and use that directly).

As this is a rust application, we also want to make sure they provide wheels for all Mu supported platforms. Pi being armv7 might be the only thing less common, and looks like wheels are provided for this platform as well: https://pypi.org/project/uv/#files

So this looks promising, would be grea if we could incorporate it with Mu.

satmandu commented 2 weeks ago

Any chance of getting this merged? Speeding up mu startup would be lovely.