Skip to content

Commit bca1843

Browse files
committed
matplotlib: use uv
- replace 'python -m pip' with 'uv pip' - set cache to match uv usage - use uv for CIBW_BUILD_FRONTEND - set UV_EXTRA_INDEX_URL to our GitLab registry, with UV_INDEX_STRATEGY=first-index so PyPI is preferred (where possible) - drop 'allow-prereleases' from setup-uv since this only applies to the setup-python action Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
1 parent f6b759e commit bca1843

2 files changed

Lines changed: 27 additions & 16 deletions

File tree

.github/workflows/build-matplotlib.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
https://github.com/qhull/qhull/raw/2020.2/COPYING.txt
5151
5252
- name: Install dependencies
53-
run: python -m pip install build twine
53+
run: uv pip install build twine
5454

5555
- name: Build sdist
5656
id: sdist
@@ -96,7 +96,10 @@ jobs:
9696
env:
9797
CIBW_BUILD: "cp314-* cp314t-*"
9898
CIBW_ARCHS: "riscv64"
99-
CIBW_ENVIRONMENT: 'PIP_PREFER_BINARY=1 PIP_EXTRA_INDEX_URL=https://gitlab.com/api/v4/projects/riseproject%2Fpython%2Fwheel_builder/packages/pypi/simple'
99+
CIBW_BUILD_FRONTEND: "build[uv]"
100+
CIBW_ENVIRONMENT: >-
101+
UV_EXTRA_INDEX_URL=https://gitlab.com/api/v4/projects/riseproject%2Fpython%2Fwheel_builder/packages/pypi/simple
102+
UV_INDEX_STRATEGY=first-index
100103
101104
- name: Build wheels for CPython 3.13
102105
uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1
@@ -105,7 +108,10 @@ jobs:
105108
env:
106109
CIBW_BUILD: "cp313-*"
107110
CIBW_ARCHS: "riscv64"
108-
CIBW_ENVIRONMENT: 'PIP_PREFER_BINARY=1 PIP_EXTRA_INDEX_URL=https://gitlab.com/api/v4/projects/riseproject%2Fpython%2Fwheel_builder/packages/pypi/simple'
111+
CIBW_BUILD_FRONTEND: "build[uv]"
112+
CIBW_ENVIRONMENT: >-
113+
UV_EXTRA_INDEX_URL=https://gitlab.com/api/v4/projects/riseproject%2Fpython%2Fwheel_builder/packages/pypi/simple
114+
UV_INDEX_STRATEGY=first-index
109115
110116
- name: Build wheels for CPython 3.12
111117
uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1
@@ -114,7 +120,10 @@ jobs:
114120
env:
115121
CIBW_BUILD: "cp312-*"
116122
CIBW_ARCHS: "riscv64"
117-
CIBW_ENVIRONMENT: 'PIP_PREFER_BINARY=1 PIP_EXTRA_INDEX_URL=https://gitlab.com/api/v4/projects/riseproject%2Fpython%2Fwheel_builder/packages/pypi/simple'
123+
CIBW_BUILD_FRONTEND: "build[uv]"
124+
CIBW_ENVIRONMENT: >-
125+
UV_EXTRA_INDEX_URL=https://gitlab.com/api/v4/projects/riseproject%2Fpython%2Fwheel_builder/packages/pypi/simple
126+
UV_INDEX_STRATEGY=first-index
118127
119128
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
120129
with:

.github/workflows/test-matplotlib.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ env:
1717
NO_AT_BRIDGE: 1 # Necessary for GTK3 interactive test.
1818
OPENBLAS_NUM_THREADS: 1
1919
PYTHONFAULTHANDLER: 1
20+
# PyPI first; gitlab riscv64 mirror only on miss (uv first-index strategy).
21+
UV_EXTRA_INDEX_URL: https://gitlab.com/api/v4/projects/riseproject%2Fpython%2Fwheel_builder/packages/pypi/simple
22+
UV_INDEX_STRATEGY: first-index
2023

2124
jobs:
2225
test:
@@ -53,7 +56,6 @@ jobs:
5356
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
5457
with:
5558
python-version: ${{ matrix.python-version }}
56-
allow-prereleases: true
5759
activate-environment: true
5860
enable-cache: false
5961

@@ -103,15 +105,15 @@ jobs:
103105
sudo apt-get install -yy --no-install-recommends ffmpeg poppler-utils
104106
sudo apt-get install -yy --no-install-recommends libgirepository-2.0-dev
105107
106-
- name: Cache pip
108+
- name: Cache uv
107109
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
108110
with:
109-
path: ~/.cache/pip
111+
path: ~/.cache/uv
110112
key: |
111-
${{ matrix.os }}-py${{ matrix.python-version }}-pip-${{
113+
${{ matrix.os }}-py${{ matrix.python-version }}-uv-${{
112114
hashFiles('upstream/pyproject.toml', 'upstream/ci/minver-requirements.txt') }}
113115
restore-keys: |
114-
${{ matrix.os }}-py${{ matrix.python-version }}-pip-
116+
${{ matrix.os }}-py${{ matrix.python-version }}-uv-
115117
- name: Cache ccache
116118
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
117119
with:
@@ -136,24 +138,24 @@ jobs:
136138
run: |
137139
# Upgrade pip and setuptools and wheel to get as clean an install as
138140
# possible.
139-
python -m pip install --upgrade pip setuptools wheel
141+
uv pip install --upgrade pip setuptools wheel
140142
141143
# Install dependencies from PyPI.
142144
# Preinstall build requirements to enable no-build-isolation builds.
143-
python -m pip install --upgrade --prefer-binary \
145+
uv pip install --upgrade --prefer-binary \
144146
--group build --group test
145147
146148
# Install optional dependencies from PyPI.
147149
# Sphinx is needed to run sphinxext tests
148-
python -m pip install --upgrade sphinx!=6.1.2
150+
uv pip install --upgrade sphinx!=6.1.2
149151
150152
# GUI toolkits are pip-installable only for some versions of Python
151153
# so don't fail if we can't install them. Make it easier to check
152154
# whether the install was successful by trying to import the toolkit
153155
# (sometimes, the install appears to be successful but shared
154156
# libraries cannot be loaded at runtime, so an actual import is a
155157
# better check).
156-
python -m pip install --upgrade pycairo 'cairocffi>=0.8' 'PyGObject' &&
158+
uv pip install --upgrade pycairo 'cairocffi>=0.8' 'PyGObject' &&
157159
(
158160
python -c 'import gi; gi.require_version("Gtk", "4.0"); from gi.repository import Gtk' &&
159161
echo 'PyGObject 4 is available' || echo 'PyGObject 4 is not available'
@@ -163,11 +165,11 @@ jobs:
163165
)
164166
165167
# PyQt5 has no riscv64 wheels; skip.
166-
python -mpip install --upgrade --only-binary :all: pyqt6 &&
168+
uv pip install --upgrade --only-binary :all: pyqt6 &&
167169
python -c 'import PyQt6.QtCore' &&
168170
echo 'PyQt6 is available' ||
169171
echo 'PyQt6 is not available'
170-
python -mpip install --upgrade --only-binary :all: pyside6 &&
172+
uv pip install --upgrade --only-binary :all: pyside6 &&
171173
python -c 'import PySide6.QtCore' &&
172174
echo 'PySide6 is available' ||
173175
echo 'PySide6 is not available'
@@ -179,7 +181,7 @@ jobs:
179181
180182
export CPPFLAGS='--coverage -fprofile-abs-path'
181183
182-
python -m pip install --no-deps --no-build-isolation --verbose \
184+
uv pip install --no-deps --no-build-isolation --verbose \
183185
--config-settings=setup-args="-DrcParams-backend=Agg" \
184186
--editable .[dev]
185187

0 commit comments

Comments
 (0)