mesa icon indicating copy to clipboard operation
mesa copied to clipboard

ci: Use uv pip for faster build

Open rht opened this issue 1 year ago • 8 comments

uv is a fast drop-in pip, pip-compile, virtualenv etc replacement created by the creator of Ruff.

rht avatar Feb 16 '24 01:02 rht

Thank you for mentioning uv, the news haven't reached me yet. I think this is quite exciting and I will start using uv today, but I strongly discourage its use for mesa just yet. The first public release is less than 24 hours ago. This potentially decreases our workflows by a few seconds, but I don't think that justifies the possible hurdles that are attached to bleeding edge software.

Corvince avatar Feb 16 '24 07:02 Corvince

I have yet to measure by how much this shaves off the build time, because the CI still fails.

According to the blog post:

uv is designed as a drop-in replacement for pip and pip-tools, and is ready for production use today in projects built around those workflows.

If it builds and runs the code just fine, I see no reason not to use it. Besides, Ruff is considered bleeding edge, yet many huge projects use it in their CI. Not all "bleeding edge" public-released tools are the same in terms of reliability.

rht avatar Feb 16 '24 07:02 rht

I have overcome https://github.com/astral-sh/uv/issues/1374. Waiting for https://github.com/astral-sh/uv/issues/1355 to be fixed, which should happen really soon.

rht avatar Feb 16 '24 08:02 rht

Not all "bleeding edge" public-released tools are the same in terms of reliability.

Yes but there have already been 2 bugfix releases in the first 12 hours of its existence and you already linked two issues that you had to overcome/waiting for a fix. And these are just the obvious bugs, I am more worried about the subtle bugs, where it appears to be working, but some details are broken. This is inevitable for such large projects. We don't know if it will affect us, but why risk it?

Corvince avatar Feb 16 '24 08:02 Corvince

Didn't you want to know how much this will speed up the macOS and Windows build? My sense is that it will be a lot, and to have a CI duration that is < 1min.

rht avatar Feb 16 '24 09:02 rht

I agree with @Corvince. Let's give UV a few weeks to sort out the initial problems before we consider shifting.

Also, what is the problem with a CI that takes a bit over a minute?

quaquel avatar Feb 16 '24 09:02 quaquel

Let's give UV a few weeks to sort out the initial problems before we consider shifting.

That sounds like a good timeline for Ruff developers. Ruff used to have a daily (if not more frequent) release cycle. And during this high frequency releases, it already had adopters by huge projects. Faster CI does matter, to the point they have been willing to adopt an alpha-release linter.

Also, what is the problem with a CI that takes a bit over a minute?

https://github.com/projectmesa/mesa/pull/2039#issuecomment-1948115515

rht avatar Feb 16 '24 10:02 rht

but I strongly discourage its use for mesa just yet. The first public release is less than 24 hours ago.

Agreed. Let's wait a few week until uv stabilizes a bit more.

EwoutH avatar Feb 17 '24 12:02 EwoutH

I think its funny that pip takes 2 seconds to install just uv and then uv continues to install the dependencies in a few milliseconds. Curious how it will perform with outdated caches.

Corvince avatar Feb 20 '24 13:02 Corvince

Everything builds except for Windows, which is a matter of using rm -r -fo instead of rm -fr. The macOS build is sped up 2x (which should be sped up further after catching). The examples build is sped up from 27s in #2044 to 17s.

I should be able to revert my advanced (but complex) caching back to setup-python pip cache, and it would be simpler and even faster overall.

rht avatar Feb 20 '24 13:02 rht

Tests all passed.

rht avatar Feb 23 '24 05:02 rht

It's now even more concise with uv pip install --system ....

rht avatar Mar 03 '24 12:03 rht

Nice work, I like the reduced complexity of our CI configuration. I think we can try it.

EwoutH avatar Mar 03 '24 14:03 EwoutH

There has been ~100 PRs opened that contain uv pip install, including from the astral-sh repo itself. How about we wait until at least ~300? https://github.com/search?q=%22uv+pip+install%22&type=pullrequests.

rht avatar Mar 04 '24 06:03 rht