@@ -58,17 +58,54 @@ jobs:
5858 ~/Library/Caches/pip
5959 ~/.cache/pip
6060 ~/AppData/Local/pip/Cache
61- key : cibw-pip-${{ matrix.os }}-${{ hashFiles('pyproject.toml') }}
61+ ~/Library/Caches/cibuildwheel
62+ ~/.cache/cibuildwheel
63+ ~/AppData/Local/pypa/cibuildwheel/Cache
64+ key : cibw-${{ matrix.os }}-${{ hashFiles('pyproject.toml') }}
6265 restore-keys : |
63- cibw-pip- ${{ matrix.os }}-
66+ cibw-${{ matrix.os }}-
6467
65- - uses : pypa/cibuildwheel@v3.3.1
68+ - uses : astral-sh/setup-uv@v7
69+
70+ - name : Pre-cache virtualenv for cibuildwheel
71+ shell : bash
72+ run : |
73+ # cibuildwheel downloads virtualenv.pyz from GitHub which can hit 429 rate limits.
74+ # Pre-download with GITHUB_TOKEN auth (5000 req/hr vs 60 unauthenticated).
75+ # Versions must match cibuildwheel v2.22 virtualenv.toml.
76+ case "$RUNNER_OS" in
77+ Windows) CACHE_DIR="$(cygpath "$USERPROFILE/AppData/Local/pypa/cibuildwheel/Cache")" ;;
78+ macOS) CACHE_DIR="$HOME/Library/Caches/cibuildwheel" ;;
79+ *) CACHE_DIR="$HOME/.cache/cibuildwheel" ;;
80+ esac
81+ mkdir -p "$CACHE_DIR"
82+ for VERSION in 20.27.1 20.21.1; do
83+ FILE="$CACHE_DIR/virtualenv-${VERSION}.pyz"
84+ if [ ! -f "$FILE" ]; then
85+ echo "Downloading virtualenv-${VERSION}.pyz..."
86+ curl -fsSL --retry 5 --retry-delay 10 --retry-all-errors \
87+ -H "Authorization: Bearer $GITHUB_TOKEN" \
88+ "https://raw.githubusercontent.com/pypa/get-virtualenv/${VERSION}/public/virtualenv.pyz" \
89+ -o "$FILE"
90+ else
91+ echo "virtualenv-${VERSION}.pyz already cached"
92+ fi
93+ done
94+ env :
95+ GITHUB_TOKEN : ${{ github.token }}
96+
97+ - uses : pypa/cibuildwheel@v2.22
6698 env :
6799 CIBW_ARCHS_MACOS : universal2
68100 CIBW_ARCHS_WINDOWS : AMD64 ARM64
69- CIBW_BEFORE_BUILD : pip install pytest networkx --prefer-binary
70- CIBW_SKIP : " pp* *musllinux* *_i686 cp314t-win*"
71- CIBW_TEST_SKIP : " *macosx* *win* *aarch64 cp314t-*"
101+ CIBW_BEFORE_BUILD : >
102+ python3 -m ensurepip --upgrade &&
103+ python3 -m pip install -U pip setuptools wheel &&
104+ python3 -m pip install --prefer-binary pytest networkx
105+ CIBW_SKIP : " pp* *musllinux* *_i686"
106+ CIBW_TEST_SKIP : " *macosx* *win* *aarch64"
107+ # Use uv to avoid transient GitHub rate limits during build
108+ CIBW_BUILD_FRONTEND : " build[uv]"
72109
73110 - name : Verify clean directory
74111 run : git diff --exit-code
0 commit comments