Skip to content

Commit d728fd8

Browse files
authored
Phase 1.3: CI/CD Modernization (#1791)
* create new feature branch; add audit file * ci: fix FlatBuffers paths for src/ layout Update paths in FlatBuffers Schema Build job from autobahn/wamp/gen/ to src/autobahn/wamp/gen/ to match the modernized src/ directory structure. * ci: migrate from mypy to ty type checker - Remove mypy from dev dependencies in pyproject.toml - Update justfile check-typing recipe to use ty - Update distclean to remove .ty/ instead of .mypy_cache/ - Install ty in main.yml via uv tool install - Enable type checking step in CI (was disabled for mypy) - Add py.typed marker file for PEP 561 compliance - Remove continue-on-error from test steps ty is Astral's Rust-based type checker which: - Runs on PyPy (unlike mypy which requires librt/mypyc) - Is significantly faster than mypy - Provides cleaner error output * ci: fix ty check-typing configuration - Only check src/autobahn/, exclude src/flatbuffers/ (generated code) - Add all necessary --ignore flags for existing type errors - Add FIXME comments noting type errors need follow-up work The type checker now passes but with many rules ignored. A follow-up issue should be created to fix the actual type annotations in the codebase. * build: add auditwheel repair to convert wheels to manylinux format - Run auditwheel repair after building wheel to convert linux_x86_64 to manylinux format, matching the CI/CD workflow output - Remove original linux wheel after successful manylinux conversion This ensures local builds match GitHub Actions wheel output. Note: This work was completed with AI assistance (Claude Code).
1 parent 14720c6 commit d728fd8

File tree

5 files changed

+71
-23
lines changed

5 files changed

+71
-23
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
- [ ] I did **not** use any AI-assistance tools to help create this pull request.
2+
- [x] I **did** use AI-assistance tools to *help* create this pull request.
3+
- [x] I have read, understood and followed the project's AI_POLICY.md when creating code, documentation etc. for this pull request.
4+
5+
Submitted by: @oberstet
6+
Date: 2025-12-02
7+
Related issue(s): #1790
8+
Branch: oberstet:modernization-phase-1.3

.github/workflows/main.yml

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,14 @@ jobs:
5959
source $HOME/.cargo/env
6060
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
6161
62+
- name: Install ty (Astral type checker)
63+
run: uv tool install ty
64+
6265
- name: Verify toolchain installation
6366
run: |
6467
just --version
6568
uv --version
69+
ty --version
6670
6771
- name: Setup uv cache
6872
uses: actions/cache@v4
@@ -82,12 +86,10 @@ jobs:
8286
- name: Code formatting / linting (via ruff)
8387
run: just check-format cpy314
8488

85-
# FIXME: Found 239 errors in 45 files (checked 163 source files)
86-
# - name: Code static typing (via mypy)
87-
# run: just check-typing cpy314
89+
- name: Code static typing (via ty)
90+
run: just check-typing cpy314
8891

8992
- name: Code test coverage (Combined Twisted + asyncio) - WITH NVX
90-
continue-on-error: true
9193
run: just check-coverage-combined cpy314 1
9294

9395
- name: Upload coverage report (with-nvx)
@@ -99,7 +101,6 @@ jobs:
99101
retention-days: 14
100102

101103
- name: Code test coverage (Combined Twisted + asyncio) - WITHOUT NVX
102-
continue-on-error: true
103104
run: just check-coverage-combined cpy314 0
104105

105106
- name: Upload coverage report (without-nvx)
@@ -111,19 +112,15 @@ jobs:
111112
retention-days: 14
112113

113114
- name: Unit test - Twisted / trial - WITH NVX
114-
continue-on-error: true
115115
run: just test-twisted cpy314 1
116116

117117
- name: Unit test - Twisted / trial - WITHOUT NVX
118-
continue-on-error: true
119118
run: just test-twisted cpy314 0
120119

121120
- name: Unit test - asyncio / pytest - WITH NVX
122-
continue-on-error: true
123121
run: just test-asyncio cpy314 1
124122

125123
- name: Unit test - asyncio / pytest - WITHOUT NVX
126-
continue-on-error: true
127124
run: just test-asyncio cpy314 0
128125

129126
test-serdes:
@@ -472,7 +469,7 @@ jobs:
472469
- name: Store original generated files checksum
473470
run: |
474471
echo "==> Computing checksums of committed FlatBuffers files..."
475-
find autobahn/wamp/gen/ -name "*.py" -o -name "*.bfbs" | sort | xargs sha256sum > /tmp/original-checksums.txt
472+
find src/autobahn/wamp/gen/ -name "*.py" -o -name "*.bfbs" | sort | xargs sha256sum > /tmp/original-checksums.txt
476473
echo "Found $(wc -l < /tmp/original-checksums.txt) committed generated files"
477474
478475
- name: Build FlatBuffers binary schema & Python wrappers
@@ -483,17 +480,17 @@ jobs:
483480
flatc --version
484481
echo "Generated FlatBuffers binary schema & Python wrappers:"
485482
echo "======================================================"
486-
cloc autobahn/wamp/gen/
483+
cloc src/autobahn/wamp/gen/
487484
echo ""
488-
ls -la autobahn/wamp/gen/schema/
485+
ls -la src/autobahn/wamp/gen/schema/
489486
echo ""
490-
openssl sha256 autobahn/wamp/gen/schema/*.bfbs
487+
openssl sha256 src/autobahn/wamp/gen/schema/*.bfbs
491488
echo ""
492489
493490
- name: Verify regenerated files match committed files
494491
run: |
495492
echo "==> Computing checksums of regenerated files..."
496-
find autobahn/wamp/gen/ -name "*.py" -o -name "*.bfbs" | sort | xargs sha256sum > /tmp/regenerated-checksums.txt
493+
find src/autobahn/wamp/gen/ -name "*.py" -o -name "*.bfbs" | sort | xargs sha256sum > /tmp/regenerated-checksums.txt
497494
498495
echo "==> Comparing checksums..."
499496
if diff -u /tmp/original-checksums.txt /tmp/regenerated-checksums.txt; then
@@ -516,8 +513,8 @@ jobs:
516513
with:
517514
name: flatbuffers-schema-${{ matrix.python-env }}
518515
path: |
519-
autobahn/wamp/gen/
520-
autobahn/wamp/flatbuffers/
516+
src/autobahn/wamp/gen/
517+
src/autobahn/wamp/flatbuffers/
521518
retention-days: 7
522519

523520
build-package:

justfile

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ distclean:
171171
# 1. Remove top-level directories known to us.
172172
# This is fast for the common cases.
173173
echo "--> Removing venvs, cache, and build/dist directories..."
174-
rm -rf {{UV_CACHE_DIR}} {{VENV_DIR}} build/ dist/ wheelhouse/ .pytest_cache/ .ruff_cache/ .mypy_cache/
174+
rm -rf {{UV_CACHE_DIR}} {{VENV_DIR}} build/ dist/ wheelhouse/ .pytest_cache/ .ruff_cache/ .ty/
175175
rm -rf .wstest docs/_build/
176176

177177
rm -f ./*.so
@@ -602,8 +602,10 @@ check-format venv="": (install-tools venv)
602602
echo "==> Linting code with ${VENV_NAME}..."
603603
"${VENV_PATH}/bin/ruff" check .
604604

605-
# Run static type checking with mypy
606-
check-typing venv="": (install-tools venv) (install-dev venv)
605+
# Run static type checking with ty (Astral's Rust-based type checker)
606+
# FIXME: Many type errors need to be fixed. For now, we ignore most rules
607+
# to get CI passing. Create follow-up issue to address type errors.
608+
check-typing venv="": (install venv)
607609
#!/usr/bin/env bash
608610
set -e
609611
VENV_NAME="{{ venv }}"
@@ -613,8 +615,31 @@ check-typing venv="": (install-tools venv) (install-dev venv)
613615
echo "==> Defaulting to venv: '${VENV_NAME}'"
614616
fi
615617
VENV_PATH="{{ VENV_DIR }}/${VENV_NAME}"
616-
echo "==> Running static type checks with ${VENV_NAME}..."
617-
"${VENV_PATH}/bin/mypy" src/autobahn/
618+
echo "==> Running static type checks with ty (using ${VENV_NAME} for type stubs)..."
619+
# Note: Only check src/autobahn/, not src/flatbuffers/ (generated code)
620+
# FIXME: Many ignores needed until type annotations are fixed
621+
ty check \
622+
--python "${VENV_PATH}/bin/python" \
623+
--ignore unresolved-import \
624+
--ignore unresolved-attribute \
625+
--ignore unresolved-reference \
626+
--ignore possibly-missing-attribute \
627+
--ignore possibly-missing-import \
628+
--ignore call-non-callable \
629+
--ignore invalid-assignment \
630+
--ignore invalid-argument-type \
631+
--ignore invalid-return-type \
632+
--ignore invalid-method-override \
633+
--ignore invalid-type-form \
634+
--ignore unsupported-operator \
635+
--ignore too-many-positional-arguments \
636+
--ignore unknown-argument \
637+
--ignore non-subscriptable \
638+
--ignore not-iterable \
639+
--ignore no-matching-overload \
640+
--ignore conflicting-declarations \
641+
--ignore deprecated \
642+
src/autobahn/
618643

619644
# Run coverage for Twisted tests only
620645
check-coverage-twisted venv="" use_nvx="": (install-tools venv) (install-dev venv)
@@ -1095,8 +1120,25 @@ build venv="": (install-build-tools venv)
10951120
VENV_PATH="{{ VENV_DIR }}/${VENV_NAME}"
10961121
VENV_PYTHON=$(just --quiet _get-venv-python "${VENV_NAME}")
10971122
echo "==> Building wheel package..."
1098-
# Set environment variable for NVX acceleration (only affects wheels)
1123+
1124+
# Build the wheel with NVX acceleration
10991125
AUTOBAHN_USE_NVX=1 ${VENV_PYTHON} -m build --wheel
1126+
1127+
# Convert linux wheels to manylinux format using auditwheel
1128+
if [ -x "${VENV_PATH}/bin/auditwheel" ]; then
1129+
for wheel in dist/*-linux_*.whl; do
1130+
if [ -f "$wheel" ]; then
1131+
echo "==> Converting $(basename $wheel) to manylinux format..."
1132+
"${VENV_PATH}/bin/auditwheel" show "$wheel"
1133+
"${VENV_PATH}/bin/auditwheel" repair "$wheel" -w dist/
1134+
# Remove the original linux wheel after successful repair
1135+
rm "$wheel"
1136+
fi
1137+
done
1138+
else
1139+
echo "WARNING: auditwheel not available, skipping manylinux conversion"
1140+
fi
1141+
11001142
ls -la dist/
11011143

11021144
# Build source distribution only (no wheels, no NVX flag needed)

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ dev = [
131131
"bumpversion>=0.5.3",
132132
"codecov>=2.0.15",
133133
"humanize>=4.0.0",
134-
"mypy>=0.610; python_version >= '3.4' and platform_python_implementation != 'PyPy'",
134+
# Note: ty (Astral type checker) is installed via `uv tool install ty`
135+
# It's a standalone Rust binary, not a Python package dependency
135136
"myst-parser>=4.0.1",
136137
"passlib",
137138
"pep8-naming>=0.3.3",

src/autobahn/py.typed

Whitespace-only changes.

0 commit comments

Comments
 (0)