-
-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(deps-dev): bump ruff from 0.6.1 to 0.8.2 (#291)
* 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
1 parent
4877a04
commit e1182ef
Showing
22 changed files
with
474 additions
and
332 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
14 changes: 12 additions & 2 deletions
14
.github/workflows/pr-labels.yml → .github/workflows/pr-merged.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.