Skip to content

Commit 9fab4b6

Browse files
authored
Merge pull request #13 from taskiq-python/replace-setup-py-with-uv
chore: improve DX in the project
2 parents 45eba53 + 4f02f03 commit 9fab4b6

17 files changed

Lines changed: 2306 additions & 459 deletions

‎.github/workflows/code-check.yml‎

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Tests
2+
on:
3+
push:
4+
branches: [main]
5+
paths-ignore:
6+
- "*.md"
7+
- "docs/**"
8+
pull_request:
9+
branches: [main]
10+
paths-ignore:
11+
- "*.md"
12+
- "docs/**"
13+
14+
permissions:
15+
actions: read
16+
contents: read
17+
pull-requests: read
18+
19+
env:
20+
AWS_DEFAULT_REGION: "us-east-1"
21+
22+
jobs:
23+
test:
24+
runs-on: ${{ matrix.os }}
25+
strategy:
26+
matrix:
27+
os: [ubuntu-latest, macos-latest] # eventually add `windows-latest`
28+
python-version: ["3.10", "3.11", "3.12"]
29+
steps:
30+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
31+
with:
32+
persist-credentials: false
33+
- id: setup-uv
34+
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
35+
with:
36+
enable-cache: true
37+
cache-suffix: ${{ matrix.python-version }}
38+
version: "latest"
39+
python-version: ${{ matrix.python-version }}
40+
- name: Install Dependencies
41+
run: uv sync --all-extras
42+
- name: Run tests
43+
run: uv run pytest

‎.github/workflows/release.yaml‎

Lines changed: 21 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,28 @@
1-
on:
2-
release:
3-
types: [published]
1+
name: Release
42

5-
env:
6-
AWS_DEFAULT_REGION: "us-east-1"
3+
on:
4+
push:
5+
tags:
6+
# Publish on any tag starting with a `v`, e.g. v1.2.3
7+
- v*
78

89
jobs:
9-
test:
10-
runs-on: ubuntu-latest
11-
steps:
12-
- uses: actions/checkout@v2
13-
- uses: actions/setup-python@v2
14-
with:
15-
python-version: "3.10"
16-
- run: pip install -e .[dev]
17-
- run: pytest
18-
19-
test-release:
20-
needs: test
21-
runs-on: ubuntu-latest
22-
23-
steps:
24-
- uses: actions/checkout@v2
25-
26-
- uses: actions/setup-python@v2
27-
with:
28-
python-version: "3.10"
29-
30-
- name: Install dependencies
31-
run: pip install -e .[dev]
32-
33-
- name: Build dist
34-
run: python -m build
35-
36-
- name: Publish release to test PyPi
37-
uses: pypa/gh-action-pypi-publish@release/v1
38-
with:
39-
user: __token__
40-
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
41-
repository_url: https://test.pypi.org/legacy/
42-
43-
release:
44-
needs: test-release
10+
pypi:
11+
name: Publish to PyPI
4512
runs-on: ubuntu-latest
13+
environment:
14+
name: release
15+
permissions:
16+
id-token: write
4617
steps:
47-
- uses: actions/checkout@v2
48-
49-
- uses: actions/setup-python@v2
18+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5019
with:
51-
python-version: "3.10"
52-
53-
- name: Install dependencies
54-
run: pip install -e .[dev]
55-
56-
- name: Build dist
57-
run: python -m build
58-
59-
- name: Publish release to test PyPi
60-
uses: pypa/gh-action-pypi-publish@release/v1
20+
persist-credentials: false
21+
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
6122
with:
62-
user: __token__
63-
password: ${{ secrets.PYPI_API_TOKEN }}
23+
enable-cache: false
24+
python-version: "3.12"
25+
version: "latest"
26+
- run: uv version "${GITHUB_REF_NAME}"
27+
- run: uv build
28+
- run: uv publish --trusted-publishing always --token "${secrets.PYPI_API_TOKEN}"

‎.github/workflows/test.yaml‎

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

‎.gitignore‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,3 @@ version.py
124124
**/.DS_Store
125125
*.swp
126126
*.swo
127-

‎.pre-commit-config.yaml‎

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/compilerla/conventional-pre-commit
5+
rev: v4.3.0
6+
hooks:
7+
- id: conventional-pre-commit
8+
stages: [commit-msg]
9+
10+
- repo: https://github.com/pre-commit/pre-commit-hooks
11+
rev: v6.0.0
12+
hooks:
13+
- id: trailing-whitespace
14+
- id: mixed-line-ending
15+
- id: check-case-conflict
16+
- id: check-ast
17+
- id: check-toml
18+
- id: check-yaml
19+
- id: check-added-large-files
20+
exclude: uv.lock
21+
- id: end-of-file-fixer
22+
23+
- repo: https://github.com/crate-ci/typos
24+
rev: v1.40.0
25+
hooks:
26+
- id: typos
27+
28+
- repo: https://github.com/Yelp/detect-secrets
29+
rev: v1.5.0
30+
hooks:
31+
- id: detect-secrets
32+
args: [
33+
'--exclude-lines', 'look_in_vault',
34+
'--exclude-lines', 'taskiq_postgres',
35+
'--exclude-lines', 'postgresql://postgres:postgres@localhost:5432/postgres',
36+
]
37+
38+
- repo: local
39+
hooks:
40+
- id: ruff
41+
name: Ruff
42+
entry: make ruff
43+
language: python
44+
types: [python]
45+
require_serial: true
46+
verbose: true
47+
pass_filenames: false
48+
49+
- id: mypy
50+
name: Mypy
51+
entry: make mypy
52+
language: python
53+
types: [python]
54+
require_serial: true
55+
verbose: true
56+
pass_filenames: false
57+
58+
- id: bandit
59+
name: bandit
60+
entry: uv run --active --frozen bandit -c pyproject.toml -r src
61+
language: python
62+
types: [python]
63+
require_serial: true
64+
verbose: true
65+
pass_filenames: false
66+
67+
- id: zizmor
68+
name: zizmor
69+
language: python
70+
entry: uv run --active --frozen zizmor .
71+
files: ^\.github
72+
require_serial: true
73+
verbose: true
74+
pass_filenames: false

0 commit comments

Comments
 (0)