Experiment: Use uv+pip to install packages during build #659
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When building the image for the app below on the main branch (using pip) it currently takes 31 seconds. Building the same image using uv takes 14s. This might be controversial because we are adding a dependency instead of just using the base python tooling. However, the speed up is pretty impressive in my opinion and given the tweak -> build -> tweak -> build nature of users' applications I think the improvement will be felt.
There is also an additional optimization bundled in that could be separated out. I changed the build step command processing so that it resolves all dependencies at once instead of doing a bunch of individual pip installs. However, if somebody had two different
add_python_packages
, my current implementation of this optimization would break. If we like it, I'll make a more robust version that allows for multiple groups of packages.One other change you might notice is the addition of
imageArchitectures
in the config. The primary reason I added this was so that we could use arm runner images when developing locally (they are much faster). I added an optional flag to the makefile so that you can decide which architecture to build the runner with.