Skip to content

Commit d93ae1d

Browse files
authored
Merge pull request #30 from taskbadger/sk/updates
migrate to uv + ruff
2 parents 2b13965 + 0495c3c commit d93ae1d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2020
-2068
lines changed

.github/workflows/publish.yml

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,28 +22,18 @@ jobs:
2222
- 6379:6379
2323
steps:
2424
- name: Checkout code
25-
uses: actions/checkout@v3
25+
uses: actions/checkout@v4
2626
- name: Setup Python
27-
uses: actions/setup-python@v4
27+
uses: actions/setup-python@v5
2828
with:
2929
python-version: "3.9"
30-
- name: Install Poetry
31-
uses: Gr1N/setup-poetry@v8
32-
- uses: actions/cache@v3
33-
with:
34-
path: ~/.cache/pypoetry/virtualenvs
35-
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
36-
- name: Checks
37-
run: |
38-
poetry --version
39-
poetry check --no-interaction
4030
- name: Install deps
41-
run: poetry install --no-interaction
31+
run: uv sync --frozen
4232
- name: Run tests
43-
run: poetry run pytest -v
33+
run: uv run --no-sync pytest -v
34+
- name: Build
35+
run: uv build
4436
- name: Publish to PyPI
4537
env:
46-
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
47-
run: |
48-
poetry config pypi-token.pypi $PYPI_TOKEN
49-
poetry publish --build
38+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
39+
run: uv publish

.github/workflows/release.yml

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,18 @@ jobs:
2424
ports:
2525
- 6379:6379
2626
steps:
27-
- uses: actions/checkout@v3
27+
- uses: actions/checkout@v4
2828
with:
2929
fetch-depth: 0
30-
- uses: actions/setup-python@v4
30+
- uses: actions/setup-python@v5
3131
with:
3232
python-version: "3.9"
33-
- name: Install Poetry
34-
uses: Gr1N/setup-poetry@v8
35-
- uses: actions/cache@v3
33+
- uses: astral-sh/setup-uv@v3
3634
with:
37-
path: ~/.cache/pypoetry/virtualenvs
38-
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
39-
- name: Checks
40-
run: |
41-
poetry --version
42-
poetry check --no-interaction
35+
enable-cache: true
4336
- name: Add version to environment vars
4437
run: |
45-
PROJECT_VERSION=$(poetry version --short)
38+
PROJECT_VERSION=$(uvx dunamai from any --format "{base}")
4639
echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV
4740
- name: Check if tag version matches project version
4841
run: |
@@ -51,18 +44,14 @@ jobs:
5144
echo $PROJECT_VERSION
5245
if [[ "$TAG" != "v$PROJECT_VERSION" ]]; then exit 1; fi
5346
54-
- name: Checks
55-
run: |
56-
poetry --version
57-
poetry check --no-interaction
5847
- name: Install deps
59-
run: poetry install --no-interaction
48+
run: uv sync --frozen
6049
- name: Run tests
61-
run: poetry run pytest -v
50+
run: uv run --no-sync pytest -v
6251
- name: Build
63-
run: poetry build
52+
run: uv build
6453
- name: Create Release Draft
65-
uses: softprops/action-gh-release@v1
54+
uses: softprops/action-gh-release@v2
6655
env:
6756
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6857
with:

.github/workflows/tests.yml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,17 @@ jobs:
3131
- celery-version: ">=5.3,<5.4"
3232
python-version: "3.12"
3333
steps:
34-
- uses: actions/checkout@v3
34+
- uses: actions/checkout@v4
3535
- name: Set up Python ${{ matrix.python-version }}
36-
uses: actions/setup-python@v4
36+
uses: actions/setup-python@v5
3737
with:
3838
python-version: ${{ matrix.python-version }}
39-
- name: Install Poetry
40-
uses: Gr1N/setup-poetry@v8
41-
- uses: actions/cache@v3
39+
- uses: astral-sh/setup-uv@v3
4240
with:
43-
path: ~/.cache/pypoetry/virtualenvs
44-
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
45-
- name: Checks
46-
run: |
47-
poetry --version
48-
poetry check --no-interaction
41+
enable-cache: true
4942
- name: Install project
5043
run: |
51-
poetry install --no-interaction
52-
pip install celery"${{ matrix.celery-version }}"
44+
uv sync --frozen
45+
uv pip install celery"${{ matrix.celery-version }}"
5346
- name: Run tests
54-
run: poetry run pytest -v
47+
run: uv run --no-sync pytest -v

.pre-commit-config.yaml

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,25 @@
11
exclude: ^static/.*|assets/.*|/migrations/.*|\.min\.js$|\.min\.css$|\.css\.map$|\.min\.js$|\.js\.map$|\.svg$
2+
default_language_version:
3+
python: python3.11
24
repos:
3-
- repo: https://github.com/pycqa/isort
4-
rev: 5.12.0
5+
- repo: https://github.com/astral-sh/ruff-pre-commit
6+
rev: v0.2.1
57
hooks:
6-
- id: isort
7-
name: isort (python)
8-
args: ["--filter-files", "--profile", "black", "--line-length=120"]
9-
- repo: https://github.com/psf/black
10-
rev: 23.1.0
11-
hooks:
12-
- id: black
13-
args: ["--line-length=120"]
14-
language_version: python3.10
8+
- id: ruff
9+
args: [ --fix ]
10+
- id: ruff-format
1511
- repo: https://github.com/pre-commit/pre-commit-hooks
1612
rev: v4.4.0
1713
hooks:
1814
- id: check-added-large-files
19-
args: [--maxkb=2048]
15+
args: [ --maxkb=2048 ]
2016
- id: check-toml
21-
types: [toml]
17+
types: [ toml ]
2218
- id: check-yaml
23-
types: [yaml]
19+
types: [ yaml ]
2420
- id: end-of-file-fixer
25-
types: [text]
26-
stages: [commit, push, manual]
21+
types: [ text ]
22+
stages: [ pre-commit, pre-push, manual ]
2723
- id: trailing-whitespace
28-
types: [text]
29-
stages: [commit, push, manual]
30-
- repo: https://github.com/pre-commit/mirrors-prettier
31-
rev: v3.0.0-alpha.4
32-
hooks:
33-
- id: prettier
34-
exclude: taskbadger.yaml
24+
types: [ text ]
25+
stages: [ pre-commit, pre-push, manual ]

examples/demo.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
import os
33

44
import taskbadger as tb
5-
from examples.migration_utils import get_data_chunks, get_total, prepare_migration, process_chunk
5+
from examples.migration_utils import (
6+
get_data_chunks,
7+
get_total,
8+
prepare_migration,
9+
process_chunk,
10+
)
611
from taskbadger import EmailIntegration
712

813

integration_tests/test_celery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
@pytest.fixture(autouse=True)
12-
def check_log_errors(caplog):
12+
def _check_log_errors(caplog):
1313
yield
1414
for when in ("call", "setup", "teardown"):
1515
errors = [r.getMessage() for r in caplog.get_records(when) if r.levelno == logging.ERROR]

0 commit comments

Comments
 (0)