Skip to content

Commit dd0bb71

Browse files
Fix bot workflow upgrading lock file and remove docdict and stubs (#108)
* fix workflow * better * fix * fix * [autofix.ci] apply automated fixes * fix * remove docdict and stubs * update type-hints * fix readme * simplify --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 67d9b11 commit dd0bb71

24 files changed

Lines changed: 232 additions & 966 deletions

.github/labeler.yaml

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/workflows/auto-label.yaml

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/workflows/bot.yaml

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,42 @@
1-
name: bot
1+
name: autofix.ci
22
concurrency:
33
group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }}
44
cancel-in-progress: true
55
on: # yamllint disable-line rule:truthy
6-
pull_request
7-
8-
permissions:
9-
contents: write
10-
pull-requests: write
6+
pull_request:
7+
schedule:
8+
- cron: '0 3 * * *'
9+
workflow_dispatch:
1110

1211
jobs:
1312
uv-lock:
13+
permissions:
14+
contents: write
1415
runs-on: ubuntu-latest
15-
if: github.repository == 'mscheltienne/template-python' # prevent running on forks
1616
steps:
1717
- uses: actions/checkout@v4
18-
with:
19-
token: ${{ secrets.GITHUB_TOKEN }}
2018
- uses: astral-sh/setup-uv@v6
2119
- run: uv lock --upgrade
22-
- name: Commit changes
20+
- uses: autofix-ci/action@v1.3.2
21+
if: ${{ github.event_name == 'pull_request' }}
22+
- name: Push lock file changes
23+
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
2324
run: |
24-
git config --local user.name 'github-actions[bot]'
25-
git config --local user.email 'github-actions[bot]@users.noreply.github.com'
26-
git add uv.lock
27-
git diff --staged --quiet || git commit -m "Update uv.lock"
28-
git push
25+
git config user.name 'github-actions[bot]'
26+
git config user.email 'github-actions[bot]@users.noreply.github.com'
27+
if [ -n "$(git status --porcelain)" ]; then
28+
git add uv.lock
29+
git commit -m "Upgrade uv.lock"
30+
git push origin main
31+
fi
2932
3033
auto-merge:
3134
needs: uv-lock
35+
permissions:
36+
contents: write
37+
pull-requests: write
3238
runs-on: ubuntu-latest
33-
if: (github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'pre-commit-ci[bot]') && github.repository == 'mscheltienne/template-python'
39+
if: ${{ github.event_name == 'pull_request' && (github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'pre-commit-ci[bot]') }}
3440
steps:
3541
- name: Enable auto-merge for bot PRs
3642
run: gh pr merge --auto --squash "$PR_URL"

.github/workflows/stubs.yaml

Lines changed: 0 additions & 34 deletions
This file was deleted.

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ following steps are required:
1818
- [ ] Enable `pre-commit.ci` on https://pre-commit.ci/
1919
- [ ] Edit `README.md`
2020
- [ ] Edit `MANIFEST.in`
21-
- [ ] Edit the package import in `tools/stubgen.py`
2221
- [ ] Remove the conda-forge recipe from the ignored files in ``.yamllint.yaml``
2322
- [ ] Edit the triggers in the release workflow, setup PyPI trusted publishing, and
2423
remove the publishing URL to test PyPI

template/__init__.pyi

Lines changed: 0 additions & 5 deletions
This file was deleted.

template/_commands/tests/test_main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
from __future__ import annotations
2+
13
from click.testing import CliRunner
24

35
from ..main import run
46

57

6-
def test_main():
8+
def test_main() -> None:
79
"""Test the main package entry-point."""
810
runner = CliRunner()
911
result = runner.invoke(run, ["--help"])

template/_commands/tests/test_sys_info.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import pytest
24
from click.testing import CliRunner
35

template/utils/__init__.pyi

Lines changed: 0 additions & 2 deletions
This file was deleted.

template/utils/_checks.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
import numpy as np
1212

13-
from ._docs import fill_doc
14-
1513
if TYPE_CHECKING:
1614
from typing import Any
1715

@@ -179,13 +177,17 @@ def check_value(
179177
)
180178

181179

182-
@fill_doc
183180
def ensure_verbose(verbose: Any) -> int:
184181
"""Ensure that the value of verbose is valid.
185182
186183
Parameters
187184
----------
188-
%(verbose)s
185+
verbose : int | str | bool | None
186+
Sets the verbosity level. The verbosity increases gradually between
187+
``"CRITICAL"``, ``"ERROR"``, ``"WARNING"``, ``"INFO"`` and ``"DEBUG"``. If
188+
``None`` is provided, the verbosity is set to ``"WARNING"``. If a bool is
189+
provided, the verbosity is set to ``"WARNING"`` for ``False`` and to ``"INFO"``
190+
for ``True``.
189191
190192
Returns
191193
-------

0 commit comments

Comments
 (0)