Skip to content

Commit 8ade128

Browse files
authored
Feature/async - v2.0.6 (#76)
## Description This PR represents the final collection of updates needed to address all outstanding issues related to the stated updates for the v2.0.0 major update. ## Related Issues Closes #51, #72, #63, #62, #61, #60 ## Type of Change - [X] Bug fix (non-breaking change that fixes an issue) - [X] New feature (non-breaking change that adds functionality) - [X] Breaking change (fix or feature that would cause existing functionality to change) - [X] Refactor (code change that neither fixes a bug nor adds a feature) - [X] Documentation - [X] Tests ## Checklist - [X] My commits follow the [Angular commit convention](https://www.conventionalcommits.org/) (`feat:`, `fix:`, `refactor:`, etc.) - [X] I have added/updated docstrings with type hints for any new or changed public methods - [X] I have added unit tests that cover my changes (mocked, not requiring a live comlink service) - [X] All existing tests still pass (`python -m pytest tests/ -v`) - [X] Ruff linter passes (`ruff check src/ tests/`) ## Testing Full current suite of pytests and manual spot validation using samples from the examples folder
2 parents 52e74d6 + 440e257 commit 8ade128

124 files changed

Lines changed: 275405 additions & 3027 deletions

File tree

Some content is hidden

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

.github/workflows/ci.yml

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: CI
22

33
on:
44
pull_request:
5-
branches: [main, 2.0-development]
5+
branches: [main, 1.0-maintenance, 2.0-development]
66
push:
77
branches: [main]
88

@@ -54,13 +54,10 @@ jobs:
5454
python-version: "3.12"
5555

5656
- name: Install dependencies
57-
run: uv pip install --system -e "." mypy
57+
run: uv sync --group typecheck
5858

5959
- name: Run mypy
60-
# NOTE: 38 existing errors (mostly implicit Optional). Set continue-on-error
61-
# to false once type annotations are cleaned up (see pyproject.toml TODO).
62-
continue-on-error: true
63-
run: mypy src/swgoh_comlink/
60+
run: uv run mypy src/swgoh_comlink/
6461

6562
# ── Test ───────────────────────────────────────────────────────────────
6663
test:
@@ -82,11 +79,11 @@ jobs:
8279
python-version: ${{ matrix.python-version }}
8380

8481
- name: Install dependencies
85-
run: uv pip install --system -e "." pytest pytest-cov
82+
run: uv sync --group test
8683

8784
- name: Run tests with coverage
8885
run: |
89-
python -m pytest tests/ \
86+
uv run python -m pytest tests/ \
9087
--cov=swgoh_comlink \
9188
--cov-report=term-missing \
9289
--cov-report=xml:coverage.xml \
@@ -99,6 +96,27 @@ jobs:
9996
name: coverage-report
10097
path: coverage.xml
10198

99+
# ── Docs build ────────────────────────────────────────────────────────
100+
docs:
101+
name: Docs
102+
runs-on: ubuntu-latest
103+
steps:
104+
- uses: actions/checkout@v6
105+
106+
- name: Install uv
107+
uses: astral-sh/setup-uv@v7
108+
109+
- name: Set up Python
110+
uses: actions/setup-python@v6
111+
with:
112+
python-version: "3.12"
113+
114+
- name: Install dependencies
115+
run: uv sync --group docs
116+
117+
- name: Build docs
118+
run: uv run mkdocs build
119+
102120
# ── Build verification ─────────────────────────────────────────────────
103121
build:
104122
name: Build
@@ -114,13 +132,10 @@ jobs:
114132
with:
115133
python-version: "3.12"
116134

117-
- name: Install hatch
118-
run: uv pip install --system hatch
119-
120135
- name: Build package
121-
run: hatch build
136+
run: uvx hatch build
122137

123138
- name: Verify wheel contents
124139
run: |
125-
pip install dist/*.whl
140+
uv pip install --system dist/*.whl
126141
python -c "from swgoh_comlink import SwgohComlink; print('Import OK')"

.github/workflows/commitlint.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Commit Lint
22

33
on:
44
pull_request:
5-
branches: [main, 2.0-development]
5+
branches: [main, 1.0-maintenance]
66

77
permissions:
88
contents: read
@@ -26,13 +26,18 @@ jobs:
2626
"extends": ["@commitlint/config-conventional"],
2727
"rules": {
2828
"type-enum": [2, "always", [
29-
"feat", "fix", "refactor", "build", "deps",
29+
"feat", "fix", "refactor", "build", "deps", "bug",
3030
"chore", "docs", "test", "style", "ci", "perf"
3131
]],
3232
"scope-enum": [1, "always", [
33-
"core", "helpers", "deps", "release", "ci"
33+
"core", "helpers", "deps", "release", "ci",
34+
"version", "hmac", "docs", "tests", "examples",
35+
"async", "statcalc"
3436
]],
35-
"subject-max-length": [1, "always", 100]
37+
"subject-max-length": [1, "always", 100],
38+
"header-max-length": [0, "always"],
39+
"body-max-line-length": [0, "always"],
40+
"footer-max-line-length": [0, "always"]
3641
}
3742
}
3843
EOF

.github/workflows/integration.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Integration Tests
2+
3+
on:
4+
pull_request:
5+
branches: [main, 1.0-maintenance]
6+
push:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: integration-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
integration:
19+
name: Integration Tests
20+
runs-on: ubuntu-latest
21+
services:
22+
comlink:
23+
image: ghcr.io/swgoh-utils/swgoh-comlink:latest
24+
env:
25+
APP_NAME: comlink-python-integration-tests
26+
ports:
27+
- 3000:3000
28+
29+
comlink-hmac:
30+
image: ghcr.io/swgoh-utils/swgoh-comlink:latest
31+
env:
32+
APP_NAME: comlink-python-hmac-integration-tests
33+
ACCESS_KEY: ${{ secrets.COMLINK_ACCESS_KEY }}
34+
SECRET_KEY: ${{ secrets.COMLINK_SECRET_KEY }}
35+
ports:
36+
- 3001:3000
37+
38+
steps:
39+
- name: Wait for Comlink services
40+
run: |
41+
for port in 3000 3001; do
42+
echo "Waiting for service on port $port..."
43+
for i in $(seq 1 30); do
44+
if curl -sf http://localhost:$port/readyz > /dev/null 2>&1; then
45+
echo "Service on port $port is ready."
46+
break
47+
fi
48+
if [ $i -eq 30 ]; then
49+
echo "Service on port $port failed to become ready."
50+
exit 1
51+
fi
52+
sleep 2
53+
done
54+
done
55+
56+
- uses: actions/checkout@v6
57+
58+
- name: Install uv
59+
uses: astral-sh/setup-uv@v7
60+
61+
- name: Set up Python
62+
uses: actions/setup-python@v6
63+
with:
64+
python-version: "3.12"
65+
66+
- name: Install dependencies
67+
run: uv sync --group test
68+
69+
- name: Run integration tests
70+
env:
71+
RUN_INTEGRATION_TESTS: "1"
72+
HMAC_ACCESS_KEY: ${{ secrets.COMLINK_ACCESS_KEY }}
73+
HMAC_SECRET_KEY: ${{ secrets.COMLINK_SECRET_KEY }}
74+
run: uv run python -m pytest tests/integration/ -v

.github/workflows/release.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,18 @@ jobs:
3535
with:
3636
python-version: "3.12"
3737

38-
- name: Install dependencies
39-
run: uv pip install --system hatch git-changelog
40-
4138
# Update version
4239
- name: Update version
43-
run: hatch version minor
40+
run: uvx hatch version minor
4441

4542
# Update CHANGELOG.md
4643
- name: Update CHANGELOG.md
47-
run: git-changelog -B auto -Tio CHANGELOG.md -c angular -s build,deps,fix,feat,refactor -n semver
44+
run: uvx git-changelog -B auto -Tio CHANGELOG.md -c angular -s build,deps,fix,feat,refactor -n semver
4845

4946
# Commit version bump and changelog, then tag and push
5047
- name: Commit and tag
5148
run: |
52-
VERSION=$(hatch version)
49+
VERSION=$(uvx hatch version)
5350
git config user.name "github-actions[bot]"
5451
git config user.email "github-actions[bot]@users.noreply.github.com"
5552
git add src/swgoh_comlink/version.py CHANGELOG.md
@@ -61,7 +58,7 @@ jobs:
6158

6259
# Build the package
6360
- name: Build the package
64-
run: hatch build
61+
run: uvx hatch build
6562

6663
# Upload build artifacts for the publish job
6764
- name: Upload build artifacts

.github/workflows/test.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Test
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
test:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v6
19+
20+
- name: Setup Python
21+
uses: actions/setup-python@v6
22+
with:
23+
python-version: "3.12"
24+
25+
- name: Setup uv
26+
uses: astral-sh/setup-uv@v7
27+
28+
- name: Sync dependencies
29+
run: uv sync --group dev --group docs
30+
31+
- name: Run unit tests
32+
run: uv run pytest -q
33+
34+
- name: Build docs
35+
run: uv run mkdocs build

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ stash/
4848
pip-log.txt
4949
pip-delete-this-directory.txt
5050

51+
# Exhaustive tests and support files (owner-only, not distributed)
52+
tests/exhaustive/
53+
scripts/
54+
data/
55+
gameData.json
56+
5157
# Unit test / coverage reports
5258
htmlcov/
5359
.tox/
@@ -61,6 +67,9 @@ coverage.xml
6167
*.py,cover
6268
.hypothesis/
6369
.pytest_cache/
70+
.ruff_cache/
71+
.parity-cache/
72+
parity/.cache-gameData.json
6473
cover/
6574

6675

@@ -176,3 +185,4 @@ cython_debug/
176185
Pipfile*
177186
pyvenv.cfg
178187
/src/swgoh_comlink/tools.py
188+
/docs/exhaustive-tests.md

.pre-commit-config.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Pre-commit hooks mirroring the CI workflow checks.
2+
# Install: pre-commit install
3+
# Run all: pre-commit run --all-files
4+
5+
repos:
6+
# ── General file hygiene ──────────────────────────────────────────────
7+
- repo: https://github.com/pre-commit/pre-commit-hooks
8+
rev: v5.0.0
9+
hooks:
10+
- id: trailing-whitespace
11+
- id: end-of-file-fixer
12+
- id: check-yaml
13+
- id: check-toml
14+
- id: check-added-large-files
15+
- id: debug-statements
16+
17+
# ── Ruff linter & formatter (mirrors CI lint job) ─────────────────────
18+
- repo: https://github.com/astral-sh/ruff-pre-commit
19+
rev: v0.15.4
20+
hooks:
21+
- id: ruff
22+
args: [--fix]
23+
- id: ruff-format
24+
25+
# ── Mypy type checking (mirrors CI type-check job) ────────────────────
26+
- repo: https://github.com/pre-commit/mirrors-mypy
27+
rev: v1.19.1
28+
hooks:
29+
- id: mypy
30+
files: ^src/swgoh_comlink/
31+
additional_dependencies: [httpx>=0.28]
32+
args: [--strict, --ignore-missing-imports]
33+
34+
# ── Commitlint (mirrors CI commitlint job) ────────────────────────────
35+
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
36+
rev: v9.21.0
37+
hooks:
38+
- id: commitlint
39+
stages: [commit-msg]
40+
additional_dependencies: ["@commitlint/config-conventional"]

0 commit comments

Comments
 (0)