Most Python CI pipelines are slower than they should be — and it’s not obvious why right away. In the CI/CD pipelines which my team uses, we constantly look for improving performance of infrastructure and test suites. But only recently, we resolved the bottleneck hiding in plain sight — dependency installation.
If you run your pipeline every few days, this trick might not save you lots of money, but it will definitely save you time ESPECIALLY if you run the pipeline often, like multiple times per day.
That’s a huge cost for something most people treat as “just part of the process.”
So instead of optimizing around it, I asked a simpler question:
What happens if I replace
pipwith something faster?
I found uv as the pip replacement and ran the benchmark on AWS CodeBuild and GitHub Actions CI/CD solutions. The results are in this blog post.
To access the code used for testing, the link to the GitHub repository is here.
The Experiment
To keep things clean and honest, I avoided any complex optimizations — no caching strategies, no Docker layer tricks, no architectural changes.
I ran the same project multiple times in two environments:
- GitHub Actions
- AWS CodePipeline (via CodeBuild)
Each run used:
- the same
requirements.txt - the same environment setup
- fresh installs
The only change was this:
- pip install -r requirements.txt
+ uv pip install -r requirements.txt
That’s literally it. A single line change.
The requirements.txt file looks like the following:
aws-cdk-lib>=2.120.0
constructs>=10.0.0
boto3
python-dotenv
Pillow
numpy
opencv-python-headless
scikit-image
fastapi
uvicorn[standard]
python-multipart
moto[all]
pytest
I’ve chosen these libraries, as they are most used for accessing AWS infrastructure, testing, and AI/ML development.
Results
GitHub Actions
The difference between the two libraries was obvious right away:
| Run | pip | uv |
|---|---|---|
| 1 | 1m14s | 26s |
| 2 | 1m16s | 23s |
| 3 | 1m11s | 24s |
| 4 | 1m13s | 20s |
| 5 | 1m19s | 24s |
| 6 | 1m16s | 26s |
| 7 | 1m06s | 20s |
| 8 | 1m06s | 21s |
| 9 | 1m06s | 26s |
| 10 | 1m24s | 25s |
Across all runs, pip averaged around 73 seconds, while uv averaged about 23.5 seconds.
That’s roughly a 68% reduction in install time, or about 3× faster overall!
More importantly, the variance dropped significantly. With pip, install times fluctuated noticeably, with uv, the times were in a tighter interval, which makes the run times more predictable.
AWS CodePipeline (CodeBuild)
In AWS, the results were still strong, but slightly less dramatic most probably due to infrastructure overhead.
| Run | pip | uv |
|---|---|---|
| 1 | 3m27s | 3m07s |
| 2 | 4m28s | 2m24s |
| 3 | 4m47s | 1m02s |
| 4 | 3m42s | 1m20s |
| 5 | 4m50s | 2m14s |
| 6 | 3m15s | 2m02s |
| 7 | 6m23s | 3m52s |
| 8 | 3m42s | 1m15s |
| 9 | 2m49s | 3m41s |
| 10 | 2m52s | 1m32s |
Here, pip averaged about 4 minutes, while uv averaged roughly 2 minutes and 15 seconds. That’s still a 44% improvement, which is significant in any CI/CD pipeline.
What’s Actually Going On?
uv is faster than pip because of the following reasons:
- it’s written in Rust, while
pipis written in Python, which enablesuvto run without the Python interpreter, improving performance -
uvcomes with parallel installation of the dependencies by default
Speed is only part of the benefit
Yes, uv is faster. But the more important improvement is consistency. With pip, install times varied widely. In the AWS runs, one build took over 6 minutes, while others were closer to 3 minutes. That kind of variability introduces unpredictability into your pipeline.
With uv, the results were far more stable. Even when there were slower runs, the range was tighter and easier to reason about. That predictability matters. It reduces noise when debugging pipelines and improves developer confidence in build times.
Infrastructure affects the gains
One interesting observation is that the performance improvement was much larger in GitHub Actions than in AWS. In GitHub Actions, dependency installation is a dominant part of the runtime, so speeding it up has a massive impact.
In AWS CodeBuild, however, there are additional factors:
- container startup time
- network latency
- AWS-managed overhead
These reduce the relative impact of faster dependency installation. Even so, cutting build time nearly in half is still a meaningful win.
Worst-case scenarios improve significantly
Averages are useful, but worst-case performance is often more important in CI.
In my runs:
- The slowest
pipbuild took 6m23s - The slowest
uvbuild took 3m52s
That’s a substantial difference. It means fewer unexpected slow builds, fewer pipeline bottlenecks, and a lower chance of hitting timeouts or frustrating delays.
Implementation
Switching to uv is actually pretty simple:
In your build step, replace:
pip install -r requirements.txt
with:
curl -Ls https://astral.sh/uv/install.sh | sh
uv pip install -r requirements.txt
There’s no need to restructure your project or change your dependency files — uv acts as a drop-in replacement for most common pip workflows, so you are ready to implement uv right away.
If you want to install uv on your PC, please take a look at the official documentation of the tool, which you can access by clicking on the link here.
What’s the impact on pricing?
Based on the documentation of GitHub Actions and AWS CodePipeline, one execution minute costs ~$0.002 USD, which is not a lot, however if you are running your pipelines all the time, this simple change is going to save you money and time.
Here are the estimated savings, based on the number of runs of your whole team or company — having the pip pipeline run on average 4 minutes, and the uv pipeline run on average 2 minutes and 15 seconds:
100 builds / month
| Tool | Monthly Cost |
|---|---|
| pip | $0.80 |
| uv | $0.45 |
Save: $0.35/month
1,000 builds / month
| Tool | Monthly Cost |
|---|---|
| pip | $8.00 |
| uv | $4.50 |
Save: $3.50/month
10,000 builds / month
| Tool | Monthly Cost |
|---|---|
| pip | $80.00 |
| uv | $45.00 |
Save: $35/month
Pros and Cons
When should you use uv ?
This change is most valuable when:
- your dependency installation step takes more than ~30 seconds
- you run CI pipelines frequently
- build speed directly impacts developer productivity
In these cases, the time savings compound quickly.
When You Might Skip It
There are still scenarios where sticking with pip makes sense:
- highly controlled enterprise environments with strict tooling policies
- extremely small projects where install time is negligible
- edge cases that depend on specific pip behaviors
uv is powerful, but it’s still relatively new, so it’s worth validating in your own environment.
Final Takeaway
What made this simple experiment most interesting and surprising was that I just researched the package managers for Python, found one and implemented it with a few commands, and it had a huge time impact right away.
No architectural changes, no optimization work — just one command!
If your CI pipeline feels slower than it should be, there’s a good chance you’re dealing with a default that hasn’t been questioned.
This is one of those rare cases where fixing it is simple.
Top comments (0)