Skip to content

Commit 2fa34fb

Browse files
authored
ci: Modernize build config and add Python 3.14 + 3.14t support (#35)
1 parent 4ad66c1 commit 2fa34fb

11 files changed

Lines changed: 1387 additions & 1020 deletions

File tree

.github/dependabot.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
version: 2
2+
updates:
3+
# Enable version updates for Python dependencies
4+
- package-ecosystem: "pip"
5+
directory: "/"
6+
schedule:
7+
interval: "monthly"
8+
cooldown:
9+
default-days: 7
10+
labels:
11+
- "dependencies"
12+
- "python"
13+
groups:
14+
# Group pytest-related packages
15+
pytest:
16+
patterns:
17+
- "pytest*"
18+
# Group type stubs
19+
type-stubs:
20+
patterns:
21+
- "types-*"
22+
# Group development tools
23+
dev-tools:
24+
patterns:
25+
- "ruff*"
26+
- "mypy"
27+
- "pre-commit"
28+
29+
# Enable version updates for GitHub Actions
30+
- package-ecosystem: "github-actions"
31+
directory: "/"
32+
schedule:
33+
interval: "monthly"
34+
cooldown:
35+
default-days: 7
36+
labels:
37+
- "dependencies"
38+
- "github-actions"

.github/workflows/default.yml

Lines changed: 41 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ on:
1111
- 'main'
1212
workflow_dispatch:
1313

14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
1418
jobs:
1519

1620
pre-commit-check:
@@ -20,30 +24,18 @@ jobs:
2024
- name: Checkout
2125
uses: actions/checkout@v4
2226
- name: Install uv
23-
uses: astral-sh/setup-uv@v4
27+
uses: astral-sh/setup-uv@v5
2428
with:
25-
version: "latest"
29+
enable-cache: true
2630
- name: Set up Python
27-
uses: actions/setup-python@v5
28-
with:
29-
python-version: "3.11"
30-
- name: Cache pre-commit dependencies
31-
id: cache_pre_commit
31+
run: uv python install 3.11
32+
- name: Install dependencies
33+
run: uv sync --frozen
34+
- name: Cache pre-commit
3235
uses: actions/cache@v4
3336
with:
34-
path: |
35-
.pre_commit_venv
36-
~/.cache/pre-commit
37-
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml','~/.cache/pre-commit/*') }}
38-
- name: Install pre-commit
39-
if: steps.cache_pre_commit.outputs.cache-hit != 'true'
40-
run: |
41-
python -m venv .pre_commit_venv
42-
. .pre_commit_venv/bin/activate
43-
pip install --upgrade pip
44-
pip install pre-commit
45-
pre-commit install --install-hooks
46-
pre-commit gc
37+
path: ~/.cache/pre-commit
38+
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
4739
- name: Run pre-commit hooks
4840
run: |
4941
if [ "$GITHUB_EVENT_NAME" == "pull_request" -a -n "$GITHUB_HEAD_REF" ]; then
@@ -52,15 +44,14 @@ jobs:
5244
echo "::add-matcher::.github/workflows/flake8-matcher.json"
5345
echo "::add-matcher::.github/workflows/mypy-matcher.json"
5446
fi
55-
. .pre_commit_venv/bin/activate
56-
pre-commit run --color=always --all-files
47+
uv run pre-commit run --color=always --all-files
5748
5849
test-unit:
5950

6051
runs-on: ubuntu-latest
6152
strategy:
6253
matrix:
63-
python-version: ["3.11", "3.12", "3.13"]
54+
python-version: ["3.11", "3.12", "3.13", "3.14", "3.14t"]
6455
services:
6556
redis:
6657
image: redis:7-alpine
@@ -76,32 +67,29 @@ jobs:
7667
- name: Checkout
7768
uses: actions/checkout@v4
7869
- name: Install uv
79-
uses: astral-sh/setup-uv@v4
70+
uses: astral-sh/setup-uv@v5
8071
with:
81-
version: "latest"
72+
enable-cache: true
8273
- name: Set up Python
83-
uses: actions/setup-python@v5
84-
with:
85-
python-version: ${{ matrix.python-version }}
86-
- name: Install dependencies
87-
run: |
88-
sudo apt install -y libsnappy-dev
89-
uv sync --extra zeromq --extra redis --extra thrift --extra snappy
74+
run: uv python install ${{ matrix.python-version }}
75+
- name: Install system dependencies
76+
run: sudo apt install -y libsnappy-dev
77+
- name: Install Python dependencies
78+
run: uv sync --frozen --extra zeromq --extra redis --extra thrift --extra snappy
9079
- name: Run unit tests
9180
env:
9281
REDIS_HOST: localhost
9382
REDIS_PORT: ${{ job.services.redis.ports[6379] }}
94-
run: |
95-
uv run python -m pytest --cov tests
83+
run: uv run python -m pytest --cov tests
9684
- name: Upload coverage report
97-
uses: codecov/codecov-action@v3
85+
uses: codecov/codecov-action@v5
9886

9987
test-integration:
10088

10189
runs-on: ubuntu-latest
10290
strategy:
10391
matrix:
104-
python-version: ["3.11", "3.12", "3.13"]
92+
python-version: ["3.11", "3.12", "3.13", "3.14", "3.14t"]
10593
services:
10694
redis:
10795
image: redis:7-alpine
@@ -117,23 +105,20 @@ jobs:
117105
- name: Checkout
118106
uses: actions/checkout@v4
119107
- name: Install uv
120-
uses: astral-sh/setup-uv@v4
108+
uses: astral-sh/setup-uv@v5
121109
with:
122-
version: "latest"
110+
enable-cache: true
123111
- name: Set up Python
124-
uses: actions/setup-python@v5
125-
with:
126-
python-version: ${{ matrix.python-version }}
127-
- name: Install dependencies
128-
run: |
129-
sudo apt install -y libsnappy-dev
130-
uv sync --extra zeromq --extra redis --extra thrift --extra snappy
112+
run: uv python install ${{ matrix.python-version }}
113+
- name: Install system dependencies
114+
run: sudo apt install -y libsnappy-dev
115+
- name: Install Python dependencies
116+
run: uv sync --frozen --extra zeromq --extra redis --extra thrift --extra snappy
131117
- name: Run integration tests
132118
env:
133119
REDIS_HOST: localhost
134120
REDIS_PORT: ${{ job.services.redis.ports[6379] }}
135-
run: |
136-
uv run ./scripts/run-integration-tests.sh
121+
run: uv run ./scripts/run-integration-tests.sh
137122

138123
build-distributions:
139124
needs: [pre-commit-check, test-unit, test-integration]
@@ -146,16 +131,13 @@ jobs:
146131
- name: Fetch remote tags
147132
run: git fetch origin 'refs/tags/*:refs/tags/*' -f
148133
- name: Install uv
149-
uses: astral-sh/setup-uv@v4
134+
uses: astral-sh/setup-uv@v5
150135
with:
151-
version: "latest"
136+
enable-cache: true
152137
- name: Set up Python
153-
uses: actions/setup-python@v5
154-
with:
155-
python-version: "3.11"
138+
run: uv python install 3.11
156139
- name: Install dependencies
157-
run: |
158-
uv sync
140+
run: uv sync --frozen
159141
- name: Build packages
160142
run: |
161143
uv run python -c "import callosum; print(callosum.__version__)" | tee version.txt
@@ -193,14 +175,14 @@ jobs:
193175
with:
194176
name: distributions
195177
path: dist
178+
- name: Install uv
179+
uses: astral-sh/setup-uv@v5
196180
- name: Set up Python
197-
uses: actions/setup-python@v5
198-
with:
199-
python-version: "3.11"
181+
run: uv python install 3.11
200182
- name: Extract the release changelog
201183
run: |
202-
python ./scripts/extract-release-changelog.py
203-
python ./scripts/determine-release-type.py
184+
uv run python ./scripts/extract-release-changelog.py
185+
uv run python ./scripts/determine-release-type.py
204186
- name: Publish to GitHub
205187
uses: softprops/action-gh-release@v2
206188
with:

.pre-commit-config.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
11
ci:
22
autoupdate_schedule: quarterly
3+
34
repos:
45
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.5.0
6+
rev: v5.0.0
67
hooks:
78
- id: check-yaml
9+
- id: check-toml
10+
- id: check-json
811
- id: end-of-file-fixer
912
- id: trailing-whitespace
13+
- id: mixed-line-ending
14+
- id: check-added-large-files
15+
args: ['--maxkb=1000']
16+
1017
- repo: https://github.com/astral-sh/ruff-pre-commit
1118
rev: v0.11.13
1219
hooks:
1320
- id: ruff
1421
args: [--fix, --exit-non-zero-on-fix]
1522
- id: ruff-format
23+
1624
- repo: https://github.com/pre-commit/mirrors-mypy
1725
rev: v1.16.0
1826
hooks:

pyproject.toml

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"]
2+
requires = ["setuptools>=75.0.0", "setuptools_scm[toml]>=8.0"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
@@ -24,6 +24,9 @@ classifiers = [
2424
"Operating System :: MacOS :: MacOS X",
2525
"Programming Language :: Python :: 3",
2626
"Programming Language :: Python :: 3.11",
27+
"Programming Language :: Python :: 3.12",
28+
"Programming Language :: Python :: 3.13",
29+
"Programming Language :: Python :: 3.14",
2730
"Topic :: Software Development",
2831
"Topic :: Software Development :: Libraries",
2932
"Topic :: Communications",
@@ -33,7 +36,7 @@ requires-python = ">=3.11"
3336
dependencies = [
3437
"attrs>=21.3.0",
3538
"python-dateutil>=2.8.2",
36-
"msgpack>=1.0.7",
39+
"msgpack>=1.1.2", # Python 3.14 support
3740
"temporenc>=0.1",
3841
"yarl>=1.8.2,!=1.9.0,!=1.9.1,!=1.9.2",
3942
]
@@ -74,29 +77,29 @@ where = ["src"]
7477
[tool.setuptools_scm]
7578
# enables setuptools_scm to provide the dynamic version
7679

77-
[tool.uv]
78-
dev-dependencies = [
79-
# Build dependencies
80-
"build>=1.0.3",
81-
"wheel>=0.41.0",
82-
"twine~=4.0",
83-
"towncrier~=22.12",
84-
# Test dependencies
85-
"Click>=8.0",
86-
"pytest~=8.4.0",
87-
"pytest-asyncio~=1.0.0",
80+
[dependency-groups]
81+
dev = [
82+
# Build tools
83+
"build>=1.2.0",
84+
"wheel>=0.45.0",
85+
"twine>=6.0.0",
86+
"towncrier>=24.0.0",
87+
# Testing
88+
"Click>=8.1.0",
89+
"pytest>=8.4.0",
90+
"pytest-asyncio>=1.0.0",
8891
"pytest-cov>=6.1.1",
8992
"pytest-mock>=3.14.1",
90-
"codecov>=2.1",
91-
# Development dependencies
92-
"pre-commit",
93-
# Lint dependencies
94-
"ruff~=0.11.13",
95-
"ruff-lsp~=0.0.62",
96-
# Typecheck dependencies
97-
"mypy~=1.16.0",
98-
"types-python-dateutil",
99-
"types-redis",
93+
"codecov>=2.1.0",
94+
# Development tools
95+
"pre-commit>=4.0.0",
96+
# Linting
97+
"ruff>=0.11.13",
98+
"ruff-lsp>=0.0.62",
99+
# Type checking
100+
"mypy>=1.16.0",
101+
"types-python-dateutil>=2.9.0",
102+
"types-redis>=4.6.0",
100103
]
101104

102105
[tool.towncrier]

requirements/build.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

requirements/dev.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

requirements/lint.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

requirements/main.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

requirements/test.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

requirements/typecheck.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)