Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps-dev): bump ruff to 0.3.0 and replace pip with uv #236

Merged
merged 8 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 9 additions & 21 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,50 +15,38 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
python: [3.8, 3.9, '3.10', 3.11]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
architecture: x64
- name: Cache python modules
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}-build
- name: Install package
run: |
python -m pip install --upgrade pip
pip install -e . --upgrade
python -m pip install --upgrade uv
uv pip install --system --upgrade -e .
- name: Import package
run: python -c "import torchcam; print(torchcam.__version__)"

pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9
architecture: x64
- name: Cache python modules
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}-build
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine --upgrade
python -m pip install --upgrade uv
uv pip install --system --upgrade setuptools wheel twine
- run: |
python setup.py sdist bdist_wheel
twine check dist/*

conda:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
Expand Down
14 changes: 4 additions & 10 deletions .github/workflows/demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,15 @@ jobs:
os: [ubuntu-latest]
python: [3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
architecture: x64
- name: Cache python modules
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}-demo
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[demo]" --upgrade
python -m pip install --upgrade uv
uv pip install --system --upgrade -e ".[demo]"

- name: Run demo app
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/doc-status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
see-page-build-payload:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9
architecture: x64
Expand Down
14 changes: 4 additions & 10 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,17 @@ jobs:
os: [ubuntu-latest]
python: [3.9]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v1
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
architecture: x64
- name: Cache python modules
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}-docs
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[docs]"
python -m pip install --upgrade uv
uv pip install --system -e ".[docs]"

- name: Build documentation
run: cd docs && bash build.sh
Expand Down
26 changes: 10 additions & 16 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,15 @@ jobs:
if: "!github.event.release.prerelease"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9
architecture: x64
- name: Cache python modules
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}-build
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine --upgrade
python -m pip install --upgrade uv
uv pip install --system --upgrade setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
Expand All @@ -38,23 +33,22 @@ jobs:
runs-on: ubuntu-latest
needs: pypi
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9
architecture: x64
- name: Install package
run: |
python -m pip install --upgrade pip
pip install torchcam
python -m pip install --upgrade uv
uv pip install --system torchcam
python -c "import torchcam; print(torchcam.__version__)"

conda:
if: "!github.event.release.prerelease"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Miniconda setup
uses: conda-incubator/setup-miniconda@v3
with:
Expand All @@ -80,7 +74,7 @@ jobs:
runs-on: ubuntu-latest
needs: conda
steps:
- uses: conda-incubator/setup-miniconda@v2
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: 3.9
Expand Down
14 changes: 4 additions & 10 deletions .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,15 @@ jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9
architecture: x64
- name: Cache python modules
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}-docs
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[docs]"
python -m pip install --upgrade uv
uv pip install --system -e ".[docs]"

- name: Build documentation
run: cd docs && bash build.sh
Expand Down
32 changes: 10 additions & 22 deletions .github/workflows/scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,16 @@ jobs:
os: [ubuntu-latest]
python: [3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
architecture: x64
- name: Cache python modules
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}-scripts
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e . --upgrade
pip install -r scripts/requirements.txt
python -m pip install --upgrade uv
uv pip install --system --upgrade -e .
uv pip install --system -r scripts/requirements.txt

- name: Run analysis script
run: python scripts/cam_example.py --arch resnet18 --class-idx 232 --noblock --method LayerCAM
Expand All @@ -43,22 +37,16 @@ jobs:
os: [ubuntu-latest]
python: [3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
architecture: x64
- name: Cache python modules
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}-scripts
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e . --upgrade
pip install -r scripts/requirements.txt
python -m pip install --upgrade uv
uv pip install --system --upgrade -e .
uv pip install --system -r scripts/requirements.txt

- name: Run analysis script
run: python scripts/eval_latency.py --arch resnet18 LayerCAM
34 changes: 16 additions & 18 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ jobs:
os: [ubuntu-latest]
python: [3.9]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
architecture: x64
- name: Run ruff
run: |
pip install ruff==0.2.0
python -m pip install --upgrade uv
uv pip install --system ruff==0.3.0
ruff --version
ruff check --diff .

Expand All @@ -32,20 +33,15 @@ jobs:
os: [ubuntu-latest]
python: [3.9]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
architecture: x64
- name: Cache python modules
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[quality]" --upgrade
python -m pip install --upgrade uv
uv pip install --system --upgrade -e ".[quality]"
- name: Run mypy
run: |
mypy --version
Expand All @@ -58,14 +54,15 @@ jobs:
os: [ubuntu-latest]
python: [3.9]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
architecture: x64
- name: Run ruff
run: |
pip install ruff==0.2.0
python -m pip install --upgrade uv
uv pip install --system ruff==0.3.0
ruff --version
ruff format --check --diff .

Expand All @@ -76,14 +73,15 @@ jobs:
os: [ubuntu-latest]
python: [3.9]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
architecture: x64
- name: Run pre-commit hooks
run: |
pip install pre-commit
python -m pip install --upgrade uv
uv pip install --system pre-commit
git checkout -b temp
pre-commit install
pre-commit --version
Expand Down
18 changes: 6 additions & 12 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,17 @@ jobs:
os: [ubuntu-latest]
python: [3.9]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
architecture: x64
- name: Cache python modules
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-python-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}-test
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[test]"
python -m pip install --upgrade uv
uv pip install --system -e ".[test]"
- name: Run unittests
run: pytest --cov=torchcam --cov-report xml tests/
- uses: actions/upload-artifact@v2
Expand All @@ -42,7 +36,7 @@ jobs:
runs-on: ubuntu-latest
needs: pytest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/download-artifact@v2
Expand All @@ -59,7 +53,7 @@ jobs:
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Check the headers
Expand Down
Loading
Loading