Skip to content

Commit

Permalink
build(deps-dev): bump ruff from 0.6.1 to 0.8.2 (#291)
Browse files Browse the repository at this point in the history
* build(deps): bump ruff from 0.6.1 to 0.8.1

Bumps [ruff](https://github.com/astral-sh/ruff) from 0.6.1 to 0.8.1.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](astral-sh/ruff@0.6.1...0.8.1)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* ci(github): add deps sync verification

* style(precommit): bump ruff to 0.8.1

* build(deps-dev): bump ruff to 0.8.2

* docs(makefile): update commands

* style: fix lint

* ci(github): reorganize workflows

* docs(pyproject): update classifier

* docs(makefile): update command

* style(github): fix precommit

* ci(github): fix uv initialization

* ci(github): fix uv

* ci(github): remove legacy command

* docs(makefile): update command for install

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: F-G Fernandez <[email protected]>
  • Loading branch information
dependabot[bot] and frgfm authored Dec 10, 2024
1 parent 4877a04 commit e1182ef
Show file tree
Hide file tree
Showing 22 changed files with 474 additions and 332 deletions.
78 changes: 78 additions & 0 deletions .github/verify_deps_sync.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Copyright (C) 2024, François-Guillaume Fernandez.

# This program is licensed under the Apache License 2.0.
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0> for full license details.

from pathlib import Path

import tomllib
import yaml

PRECOMMIT_PATH = ".pre-commit-config.yaml"
PYPROJECT_PATH = "pyproject.toml"


def main():
# Retrieve & parse all deps files
deps_dict = {}
# UV: Dockerfile, precommit, .github
# Parse precommit
with Path(PRECOMMIT_PATH).open("r") as f:
precommit = yaml.safe_load(f)

for repo in precommit["repos"]:
if repo["repo"] == "https://github.com/astral-sh/uv-pre-commit":
if "uv" not in deps_dict:
deps_dict["uv"] = []
deps_dict["uv"].append({"file": PRECOMMIT_PATH, "version": repo["rev"].lstrip("v")})
elif repo["repo"] == "https://github.com/charliermarsh/ruff-pre-commit":
if "ruff" not in deps_dict:
deps_dict["ruff"] = []
deps_dict["ruff"].append({"file": PRECOMMIT_PATH, "version": repo["rev"].lstrip("v")})

# Parse pyproject.toml
with Path(PYPROJECT_PATH).open("rb") as f:
pyproject = tomllib.load(f)

dev_deps = pyproject["project"]["optional-dependencies"]["quality"]
for dep in dev_deps:
if dep.startswith("ruff=="):
if "ruff" not in deps_dict:
deps_dict["ruff"] = []
deps_dict["ruff"].append({"file": PYPROJECT_PATH, "version": dep.split("==")[1]})
elif dep.startswith("mypy=="):
if "mypy" not in deps_dict:
deps_dict["mypy"] = []
deps_dict["mypy"].append({"file": PYPROJECT_PATH, "version": dep.split("==")[1]})

# Parse github/workflows/...
for workflow_file in Path(".github/workflows").glob("*.yml"):
with workflow_file.open("r") as f:
workflow = yaml.safe_load(f)
if "env" in workflow and "UV_VERSION" in workflow["env"]:
if "uv" not in deps_dict:
deps_dict["uv"] = []
deps_dict["uv"].append({
"file": str(workflow_file),
"version": workflow["env"]["UV_VERSION"].lstrip("v"),
})

# Assert all deps are in sync
troubles = []
for dep, versions in deps_dict.items():
versions_ = {v["version"] for v in versions}
if len(versions_) != 1:
inv_dict = {v: set() for v in versions_}
for version in versions:
inv_dict[version["version"]].add(version["file"])
troubles.extend([
f"{dep}:",
"\n".join(f"- '{v}': {', '.join(files)}" for v, files in inv_dict.items()),
])

if len(troubles) > 0:
raise AssertionError("Some dependencies are out of sync:\n\n" + "\n".join(troubles))


if __name__ == "__main__":
main()
106 changes: 106 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: build

on:
push:
branches: main
pull_request:
branches: main

env:
PYTHON_VERSION: "3.11"
UV_VERSION: "0.5.7"

jobs:
package:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: [3.9, '3.10', 3.11, 3.12]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
architecture: x64
- uses: astral-sh/setup-uv@v4
with:
version: ${{ env.UV_VERSION }}
- name: Install package
run: 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@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: x64
- uses: astral-sh/setup-uv@v4
with:
version: ${{ env.UV_VERSION }}
- name: Install dependencies
run: 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@v4
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
shell: bash -el {0}
run: conda install -y conda-build conda-verify
- name: Build conda
shell: bash -el {0}
run: |
python setup.py sdist
mkdir conda-dist
conda env list
conda build .conda/ -c pytorch --output-folder conda-dist
ls -l conda-dist/noarch/*tar.bz2
demo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: x64
- uses: astral-sh/setup-uv@v4
with:
version: ${{ env.UV_VERSION }}
- name: Install dependencies
run: uv pip install --system --upgrade -e ".[demo]"
- name: Run demo app
run: |
screen -dm streamlit run demo/app.py --server.port 8080
sleep 10 && nc -vz localhost 8080
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: x64
- uses: astral-sh/setup-uv@v4
with:
version: ${{ env.UV_VERSION }}
- name: Build documentation
run: |
make install-docs
make full-docs
- name: Documentation sanity check
run: test -e docs/build/index.html || exit
64 changes: 0 additions & 64 deletions .github/workflows/builds.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/demo.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@ name: GH-Pages Status
on:
page_build

env:
PYTHON_VERSION: "3.11"
UV_VERSION: "0.5.7"

jobs:
see-page-build-payload:
check-gh-pages:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: ${{ env.PYTHON_VERSION }}
architecture: x64
- uses: astral-sh/setup-uv@v4
with:
version: ${{ env.UV_VERSION }}
- name: check status
run: |
import os
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/pr-edited.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: pr-edited

on:
pull_request_target:
types: [opened, reopened, edited, synchronize]
pull_request:
types: [opened, reopened, edited, synchronize]

jobs:
lint-title:
runs-on: ubuntu-latest
permissions: read-all
steps:
- uses: amannn/action-semantic-pull-request@v5
with:
subjectPattern: ^(?![A-Z]).+$
subjectPatternError: |
The subject "{subject}" found in the pull request title "{title}"
didn't match the configured pattern. Please ensure that the subject
doesn't start with an uppercase character.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
name: pr-labels
name: pr-merged

on:
pull_request:
branches: main
types: closed

env:
PYTHON_VERSION: "3.11"
UV_VERSION: "0.5.7"

jobs:
is-properly-labeled:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: x64
- uses: astral-sh/setup-uv@v4
with:
version: ${{ env.UV_VERSION }}
- name: Install requests
run: pip install requests
run: uv pip install --system requests
- name: Process commit and find merger responsible for labeling
id: commit
run: echo "::set-output name=merger::$(python .github/verify_labels.py ${{ github.event.pull_request.number }})"
Expand Down
35 changes: 0 additions & 35 deletions .github/workflows/pull_requests.yml

This file was deleted.

Loading

0 comments on commit e1182ef

Please sign in to comment.