Skip to content

Commit 620d402

Browse files
authored
build(deps-dev): bump ruff to 0.3.0 and replace pip with uv (#236)
* build(deps-dev): bump ruff to 0.3.0 * ci(github): bump ruff in CI * ci(github): replaces pip with uv * ci(github): fix uv install command * ci(github): fix uv install command * ci(github): fix uv install command * docs(makefile): update style command * ci(github): fix script CI job
1 parent 91b7543 commit 620d402

12 files changed

+68
-124
lines changed

.github/workflows/builds.yml

+9-21
Original file line numberDiff line numberDiff line change
@@ -15,50 +15,38 @@ jobs:
1515
os: [ubuntu-latest, macos-latest, windows-latest]
1616
python: [3.8, 3.9, '3.10', 3.11]
1717
steps:
18-
- uses: actions/checkout@v2
19-
- name: Set up Python
20-
uses: actions/setup-python@v4
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-python@v5
2120
with:
2221
python-version: ${{ matrix.python }}
2322
architecture: x64
24-
- name: Cache python modules
25-
uses: actions/cache@v2
26-
with:
27-
path: ~/.cache/pip
28-
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}-build
2923
- name: Install package
3024
run: |
31-
python -m pip install --upgrade pip
32-
pip install -e . --upgrade
25+
python -m pip install --upgrade uv
26+
uv pip install --system --upgrade -e .
3327
- name: Import package
3428
run: python -c "import torchcam; print(torchcam.__version__)"
3529

3630
pypi:
3731
runs-on: ubuntu-latest
3832
steps:
39-
- uses: actions/checkout@v2
40-
- name: Set up Python
41-
uses: actions/setup-python@v4
33+
- uses: actions/checkout@v4
34+
- uses: actions/setup-python@v5
4235
with:
4336
python-version: 3.9
4437
architecture: x64
45-
- name: Cache python modules
46-
uses: actions/cache@v2
47-
with:
48-
path: ~/.cache/pip
49-
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}-build
5038
- name: Install dependencies
5139
run: |
52-
python -m pip install --upgrade pip
53-
pip install setuptools wheel twine --upgrade
40+
python -m pip install --upgrade uv
41+
uv pip install --system --upgrade setuptools wheel twine
5442
- run: |
5543
python setup.py sdist bdist_wheel
5644
twine check dist/*
5745
5846
conda:
5947
runs-on: ubuntu-latest
6048
steps:
61-
- uses: actions/checkout@v2
49+
- uses: actions/checkout@v4
6250
- uses: conda-incubator/setup-miniconda@v2
6351
with:
6452
auto-update-conda: true

.github/workflows/demo.yml

+4-10
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,15 @@ jobs:
1515
os: [ubuntu-latest]
1616
python: [3.9]
1717
steps:
18-
- uses: actions/checkout@v2
19-
- name: Set up Python
20-
uses: actions/setup-python@v4
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-python@v5
2120
with:
2221
python-version: ${{ matrix.python }}
2322
architecture: x64
24-
- name: Cache python modules
25-
uses: actions/cache@v2
26-
with:
27-
path: ~/.cache/pip
28-
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}-demo
2923
- name: Install dependencies
3024
run: |
31-
python -m pip install --upgrade pip
32-
pip install -e ".[demo]" --upgrade
25+
python -m pip install --upgrade uv
26+
uv pip install --system --upgrade -e ".[demo]"
3327
3428
- name: Run demo app
3529
run: |

.github/workflows/doc-status.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
see-page-build-payload:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/setup-python@v4
9+
- uses: actions/setup-python@v5
1010
with:
1111
python-version: 3.9
1212
architecture: x64

.github/workflows/docs.yaml

+4-10
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,17 @@ jobs:
1111
os: [ubuntu-latest]
1212
python: [3.9]
1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v4
1515
with:
1616
persist-credentials: false
17-
- name: Set up Python
18-
uses: actions/setup-python@v1
17+
- uses: actions/setup-python@v5
1918
with:
2019
python-version: ${{ matrix.python }}
2120
architecture: x64
22-
- name: Cache python modules
23-
uses: actions/cache@v2
24-
with:
25-
path: ~/.cache/pip
26-
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}-docs
2721
- name: Install dependencies
2822
run: |
29-
python -m pip install --upgrade pip
30-
pip install -e ".[docs]"
23+
python -m pip install --upgrade uv
24+
uv pip install --system -e ".[docs]"
3125
3226
- name: Build documentation
3327
run: cd docs && bash build.sh

.github/workflows/publish.yml

+10-16
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,15 @@ jobs:
99
if: "!github.event.release.prerelease"
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v2
13-
- uses: actions/setup-python@v4
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-python@v5
1414
with:
1515
python-version: 3.9
1616
architecture: x64
17-
- name: Cache python modules
18-
uses: actions/cache@v2
19-
with:
20-
path: ~/.cache/pip
21-
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}-build
2217
- name: Install dependencies
2318
run: |
24-
python -m pip install --upgrade pip
25-
pip install setuptools wheel twine --upgrade
19+
python -m pip install --upgrade uv
20+
uv pip install --system --upgrade setuptools wheel twine
2621
- name: Build and publish
2722
env:
2823
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
@@ -38,23 +33,22 @@ jobs:
3833
runs-on: ubuntu-latest
3934
needs: pypi
4035
steps:
41-
- uses: actions/checkout@v2
42-
- name: Set up Python
43-
uses: actions/setup-python@v4
36+
- uses: actions/checkout@v4
37+
- uses: actions/setup-python@v5
4438
with:
4539
python-version: 3.9
4640
architecture: x64
4741
- name: Install package
4842
run: |
49-
python -m pip install --upgrade pip
50-
pip install torchcam
43+
python -m pip install --upgrade uv
44+
uv pip install --system torchcam
5145
python -c "import torchcam; print(torchcam.__version__)"
5246
5347
conda:
5448
if: "!github.event.release.prerelease"
5549
runs-on: ubuntu-latest
5650
steps:
57-
- uses: actions/checkout@v2
51+
- uses: actions/checkout@v4
5852
- name: Miniconda setup
5953
uses: conda-incubator/setup-miniconda@v3
6054
with:
@@ -80,7 +74,7 @@ jobs:
8074
runs-on: ubuntu-latest
8175
needs: conda
8276
steps:
83-
- uses: conda-incubator/setup-miniconda@v2
77+
- uses: conda-incubator/setup-miniconda@v3
8478
with:
8579
auto-update-conda: true
8680
python-version: 3.9

.github/workflows/pull_requests.yml

+4-10
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,15 @@ jobs:
88
docs:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v2
12-
- name: Set up Python
13-
uses: actions/setup-python@v4
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-python@v5
1413
with:
1514
python-version: 3.9
1615
architecture: x64
17-
- name: Cache python modules
18-
uses: actions/cache@v2
19-
with:
20-
path: ~/.cache/pip
21-
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}-docs
2216
- name: Install dependencies
2317
run: |
24-
python -m pip install --upgrade pip
25-
pip install -e ".[docs]"
18+
python -m pip install --upgrade uv
19+
uv pip install --system -e ".[docs]"
2620
2721
- name: Build documentation
2822
run: cd docs && bash build.sh

.github/workflows/scripts.yml

+10-22
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,16 @@ jobs:
1515
os: [ubuntu-latest]
1616
python: [3.9]
1717
steps:
18-
- uses: actions/checkout@v2
19-
- name: Set up Python
20-
uses: actions/setup-python@v4
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-python@v5
2120
with:
2221
python-version: ${{ matrix.python }}
2322
architecture: x64
24-
- name: Cache python modules
25-
uses: actions/cache@v2
26-
with:
27-
path: ~/.cache/pip
28-
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}-scripts
2923
- name: Install dependencies
3024
run: |
31-
python -m pip install --upgrade pip
32-
pip install -e . --upgrade
33-
pip install -r scripts/requirements.txt
25+
python -m pip install --upgrade uv
26+
uv pip install --system --upgrade -e .
27+
uv pip install --system -r scripts/requirements.txt
3428
3529
- name: Run analysis script
3630
run: python scripts/cam_example.py --arch resnet18 --class-idx 232 --noblock --method LayerCAM
@@ -43,22 +37,16 @@ jobs:
4337
os: [ubuntu-latest]
4438
python: [3.9]
4539
steps:
46-
- uses: actions/checkout@v2
47-
- name: Set up Python
48-
uses: actions/setup-python@v4
40+
- uses: actions/checkout@v4
41+
- uses: actions/setup-python@v5
4942
with:
5043
python-version: ${{ matrix.python }}
5144
architecture: x64
52-
- name: Cache python modules
53-
uses: actions/cache@v2
54-
with:
55-
path: ~/.cache/pip
56-
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}-scripts
5745
- name: Install dependencies
5846
run: |
59-
python -m pip install --upgrade pip
60-
pip install -e . --upgrade
61-
pip install -r scripts/requirements.txt
47+
python -m pip install --upgrade uv
48+
uv pip install --system --upgrade -e .
49+
uv pip install --system -r scripts/requirements.txt
6250
6351
- name: Run analysis script
6452
run: python scripts/eval_latency.py --arch resnet18 LayerCAM

.github/workflows/style.yml

+16-18
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ jobs:
1414
os: [ubuntu-latest]
1515
python: [3.9]
1616
steps:
17-
- uses: actions/checkout@v2
18-
- uses: actions/setup-python@v4
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-python@v5
1919
with:
2020
python-version: ${{ matrix.python }}
2121
architecture: x64
2222
- name: Run ruff
2323
run: |
24-
pip install ruff==0.2.0
24+
python -m pip install --upgrade uv
25+
uv pip install --system ruff==0.3.0
2526
ruff --version
2627
ruff check --diff .
2728
@@ -32,20 +33,15 @@ jobs:
3233
os: [ubuntu-latest]
3334
python: [3.9]
3435
steps:
35-
- uses: actions/checkout@v2
36-
- uses: actions/setup-python@v4
36+
- uses: actions/checkout@v4
37+
- uses: actions/setup-python@v5
3738
with:
3839
python-version: ${{ matrix.python }}
3940
architecture: x64
40-
- name: Cache python modules
41-
uses: actions/cache@v2
42-
with:
43-
path: ~/.cache/pip
44-
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}
4541
- name: Install dependencies
4642
run: |
47-
python -m pip install --upgrade pip
48-
pip install -e ".[quality]" --upgrade
43+
python -m pip install --upgrade uv
44+
uv pip install --system --upgrade -e ".[quality]"
4945
- name: Run mypy
5046
run: |
5147
mypy --version
@@ -58,14 +54,15 @@ jobs:
5854
os: [ubuntu-latest]
5955
python: [3.9]
6056
steps:
61-
- uses: actions/checkout@v2
62-
- uses: actions/setup-python@v4
57+
- uses: actions/checkout@v4
58+
- uses: actions/setup-python@v5
6359
with:
6460
python-version: ${{ matrix.python }}
6561
architecture: x64
6662
- name: Run ruff
6763
run: |
68-
pip install ruff==0.2.0
64+
python -m pip install --upgrade uv
65+
uv pip install --system ruff==0.3.0
6966
ruff --version
7067
ruff format --check --diff .
7168
@@ -76,14 +73,15 @@ jobs:
7673
os: [ubuntu-latest]
7774
python: [3.9]
7875
steps:
79-
- uses: actions/checkout@v2
80-
- uses: actions/setup-python@v4
76+
- uses: actions/checkout@v4
77+
- uses: actions/setup-python@v5
8178
with:
8279
python-version: ${{ matrix.python }}
8380
architecture: x64
8481
- name: Run pre-commit hooks
8582
run: |
86-
pip install pre-commit
83+
python -m pip install --upgrade uv
84+
uv pip install --system pre-commit
8785
git checkout -b temp
8886
pre-commit install
8987
pre-commit --version

.github/workflows/tests.yml

+6-12
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,17 @@ jobs:
1414
os: [ubuntu-latest]
1515
python: [3.9]
1616
steps:
17-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v4
1818
with:
1919
persist-credentials: false
20-
- name: Set up Python
21-
uses: actions/setup-python@v4
20+
- uses: actions/setup-python@v5
2221
with:
2322
python-version: ${{ matrix.python }}
2423
architecture: x64
25-
- name: Cache python modules
26-
uses: actions/cache@v2
27-
with:
28-
path: ~/.cache/pip
29-
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}-test
3024
- name: Install dependencies
3125
run: |
32-
python -m pip install --upgrade pip
33-
pip install -e ".[test]"
26+
python -m pip install --upgrade uv
27+
uv pip install --system -e ".[test]"
3428
- name: Run unittests
3529
run: pytest --cov=torchcam --cov-report xml tests/
3630
- uses: actions/upload-artifact@v2
@@ -42,7 +36,7 @@ jobs:
4236
runs-on: ubuntu-latest
4337
needs: pytest
4438
steps:
45-
- uses: actions/checkout@v2
39+
- uses: actions/checkout@v4
4640
with:
4741
persist-credentials: false
4842
- uses: actions/download-artifact@v2
@@ -59,7 +53,7 @@ jobs:
5953
matrix:
6054
os: [ubuntu-latest]
6155
steps:
62-
- uses: actions/checkout@v2
56+
- uses: actions/checkout@v4
6357
with:
6458
persist-credentials: false
6559
- name: Check the headers

0 commit comments

Comments
 (0)