canonical / canonical/pycloudlib

[enchancement idea] Streamlining and speeding up CI (tox)

Open
#404 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
22
Forks
42
PR merge metrics
No merged PRs in 30d

Description

### Feature Request Description
It would be amazing to speed up the CI times for pycloudlib. There is no reason it should be this slow :sleeping:

### Problem Statement
@aciba90 and I have been doing a TON of back and forth on PRs over the past week and the slow CI times have been a huge pain point for the both of us. Due to the slow CI time, i was not running tox locally and thus have been failing to catch linting errors before pushing a new round of changes for review. And this just makes the review process even more annoying for both the reviewer and the author of the PR.

### Proposed Solution
Not sure what the best solution is, but just simply using `tox-uv` sped up my local CI times immensely, since the normal time for each tox env to setup and install is ~30s. This could be an incredible start.

#### Initial Results:
The time to setup each environment is now nearly negligible vs the normal ~30s.
First, tox-uv was installed:
```
pip install tox-uv
```

Then tox was run using the new `tox-uv`:
```
tox
```

And the entire run only takes about a minute:
```
ruff: OK (1.67=setup[1.65]+cmd[0.03] seconds)
format-check: OK (0.38=setup[0.35]+cmd[0.03] seconds)
mypy: OK (1.38=setup[0.36]+cmd[1.03] seconds)
pytest: OK (5.02=setup[0.38]+cmd[4.64] seconds)
pylint: OK (33.53=setup[0.38]+cmd[33.15] seconds)
docs: FAIL code 2 (15.48=setup[0.00]+cmd[15.47] seconds)
evaluation failed :( (57.51 seconds)
```

previously, I was looking at 5+ minute runs:
```
ruff: OK (37.16=setup[37.14]+cmd[0.02] seconds)
format-check: OK (38.72=setup[38.69]+cmd[0.02] seconds)
mypy: OK (42.31=setup[37.89]+cmd[4.42] seconds)
pytest: OK (39.11=setup[36.90]+cmd[2.21] seconds)
pylint: OK (70.75=setup[36.59]+cmd[34.17] seconds)
docs: OK (13.72=setup[0.02]+cmd[13.70] seconds)
congratulations :) (241.81 seconds)
```

This is an incredible speed up for literally zero effort and with this, I will absolutely be using tox-uv locally from now on!!! :exploding_head: :partying_face: :raised_hands: :smiling_imp:

#### tox-uv and uv references:
https://github.com/tox-dev/tox-uv
https://github.com/astral-sh/uv

### Benefits

This will enable all contributors and maintainers to test changes locally before pushing much less painful. I find myself often not running `tox` locally before pushing just because it takes 5+ min normally.

### Risks or Concerns

There might be some weirdness introduced by using `uv` but I think it will be worth it. Drawbacks to using `uv` need to be investigated further.

And an issue as already surfaced: my docs CI now fail.... Not sure why. Will investigate further when i have the chance.

### Additional Exploration

Pylint now is the slowest part of the CI. In my tests, pylint takes HALF of the entire CI run time. It would be ideal to have this reduced such that pytest is the slowest portion of the CI.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.