Skip to content

Commit ff617d5

Browse files
committed
Merge branch 'main' into feat/mcp
2 parents ef71e88 + e0113ae commit ff617d5

34 files changed

Lines changed: 1852 additions & 224 deletions

.github/workflows/build-ultraplot.yml

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,15 @@ jobs:
5353
with:
5454
fetch-depth: 0
5555

56+
- name: Prepare compatible test environment
57+
run: >-
58+
python3 tools/ci/version_support.py
59+
--matplotlib-version '${{ inputs.matplotlib-version }}'
60+
--environment-output '${{ runner.temp }}/ultraplot-environment.yml'
61+
5662
- uses: mamba-org/setup-micromamba@v3.2.1
5763
with:
58-
environment-file: ./environment.yml
64+
environment-file: ${{ runner.temp }}/ultraplot-environment.yml
5965
init-shell: bash
6066
condarc-file: ./.github/micromamba-condarc.yml
6167
post-cleanup: none
@@ -69,6 +75,14 @@ jobs:
6975
- name: Build Ultraplot
7076
run: |
7177
pip install --no-build-isolation --no-deps .
78+
python - <<'PY'
79+
import sys
80+
import matplotlib, mpltern, pycirclize
81+
assert sys.version_info[:2] == tuple(map(int, '${{ inputs.python-version }}'.split('.')))
82+
assert matplotlib.__version__.startswith('${{ inputs.matplotlib-version }}.')
83+
print('Python executable:', sys.executable)
84+
print('Matplotlib:', matplotlib.__version__)
85+
PY
7286
7387
compare-baseline:
7488
name: Compare baseline Python ${{ inputs.python-version }} with MPL ${{ inputs.matplotlib-version }}
@@ -100,9 +114,15 @@ jobs:
100114
101115
- uses: actions/checkout@v7
102116

117+
- name: Prepare compatible test environment
118+
run: >-
119+
python3 tools/ci/version_support.py
120+
--matplotlib-version '${{ inputs.matplotlib-version }}'
121+
--environment-output '${{ runner.temp }}/ultraplot-environment.yml'
122+
103123
- uses: mamba-org/setup-micromamba@v3.2.1
104124
with:
105-
environment-file: ./environment.yml
125+
environment-file: ${{ runner.temp }}/ultraplot-environment.yml
106126
init-shell: bash
107127
condarc-file: ./.github/micromamba-condarc.yml
108128
post-cleanup: none
@@ -128,11 +148,26 @@ jobs:
128148
echo "base_sha=${BASE_SHA}" >> "${GITHUB_OUTPUT}"
129149
echo "Resolved baseline ref=${BASE_REF} sha=${BASE_SHA}"
130150
151+
- name: Check baseline version support
152+
id: baseline-support
153+
run: |
154+
git show '${{ steps.baseline-ref.outputs.base_sha }}:pyproject.toml' > '${{ runner.temp }}/baseline-pyproject.toml'
155+
python tools/ci/version_support.py \
156+
--baseline-pyproject '${{ runner.temp }}/baseline-pyproject.toml' \
157+
--python-version '${{ inputs.python-version }}' \
158+
--matplotlib-version '${{ inputs.matplotlib-version }}' >> "$GITHUB_OUTPUT"
159+
160+
- name: Explain unavailable baseline
161+
if: steps.baseline-support.outputs.baseline-supported != 'true'
162+
run: |
163+
echo '::notice::Image comparison skipped: the base commit does not support this Python/Matplotlib pair. PR tests still run in the coverage job.'
164+
echo 'Image comparison skipped for Python ${{ inputs.python-version }} / Matplotlib ${{ inputs.matplotlib-version }}: base commit ${{ steps.baseline-ref.outputs.base_sha }} does not support this pair. The coverage job still tests the PR on this pair.' >> "$GITHUB_STEP_SUMMARY"
165+
131166
# Cache Baseline Figures (Restore step)
132167
- name: Cache Baseline Figures
133168
id: cache-baseline
134169
uses: actions/cache@v6
135-
if: ${{ env.IS_PR }}
170+
if: env.IS_PR == 'true' && steps.baseline-support.outputs.baseline-supported == 'true'
136171
with:
137172
path: ./ultraplot/tests/baseline # The directory to cache
138173
# Key is based on OS, Python/Matplotlib versions, and the base commit SHA
@@ -143,7 +178,7 @@ jobs:
143178
# Conditional Baseline Generation (Only runs on cache miss)
144179
- name: Generate baseline from main
145180
# Skip this step if the cache was found (cache-hit is true)
146-
if: steps.cache-baseline.outputs.cache-hit != 'true' || !env.IS_PR
181+
if: steps.baseline-support.outputs.baseline-supported == 'true' && (steps.cache-baseline.outputs.cache-hit != 'true' || env.IS_PR != 'true')
147182
run: |
148183
mkdir -p ultraplot/tests/baseline
149184
echo "TEST_MODE=${TEST_MODE}"
@@ -219,6 +254,7 @@ jobs:
219254
220255
# Image Comparison (Uses cached or newly generated baseline)
221256
- name: Image Comparison Ultraplot
257+
if: steps.baseline-support.outputs.baseline-supported == 'true'
222258
run: |
223259
set -uo pipefail
224260
# This workflow runs in a login shell (bash -el), which executes

.github/workflows/main.yml

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,16 @@ jobs:
188188
--progress-bar no
189189
190190
coverage:
191-
name: Coverage
191+
name: Coverage Python ${{ matrix.python-version }} / MPL ${{ matrix.matplotlib-version }}
192192
runs-on: ubuntu-latest
193193
needs:
194194
- run-if-changes
195-
if: always() && needs.run-if-changes.outputs.run == 'true' && github.event_name == 'pull_request'
195+
- get-versions
196+
if: always() && needs.run-if-changes.outputs.run == 'true' && needs.get-versions.result == 'success' && github.event_name == 'pull_request'
197+
strategy:
198+
fail-fast: false
199+
matrix:
200+
include: ${{ fromJson(needs.get-versions.outputs.test-matrix) }}
196201
defaults:
197202
run:
198203
shell: bash -el {0}
@@ -206,16 +211,22 @@ jobs:
206211
with:
207212
fetch-depth: 0
208213

214+
- name: Prepare compatible coverage environment
215+
run: >-
216+
python3 tools/ci/version_support.py
217+
--matplotlib-version '${{ matrix.matplotlib-version }}'
218+
--environment-output '${{ runner.temp }}/ultraplot-environment.yml'
219+
209220
- uses: mamba-org/setup-micromamba@v3.2.1
210221
with:
211-
environment-file: ./environment.yml
222+
environment-file: ${{ runner.temp }}/ultraplot-environment.yml
212223
init-shell: bash
213224
condarc-file: ./.github/micromamba-condarc.yml
214225
post-cleanup: none
215226
create-args: >-
216227
--verbose
217-
python=3.10
218-
matplotlib=3.9
228+
python=${{ matrix.python-version }}
229+
matplotlib=${{ matrix.matplotlib-version }}
219230
cache-environment: true
220231
cache-downloads: false
221232

@@ -225,6 +236,16 @@ jobs:
225236
226237
- name: Run full coverage suite
227238
run: |
239+
python - <<'PY'
240+
import sys
241+
from importlib.metadata import version
242+
import matplotlib, mpltern, pycirclize
243+
assert sys.version_info[:2] == tuple(map(int, '${{ matrix.python-version }}'.split('.')))
244+
assert matplotlib.__version__.startswith('${{ matrix.matplotlib-version }}.')
245+
print('Python executable:', sys.executable)
246+
for package in ('matplotlib', 'mpltern', 'pycirclize', 'cartopy'):
247+
print(f'{package}: {version(package)}')
248+
PY
228249
pytest -q --tb=short --disable-warnings -n auto -p pytest_cov \
229250
--cov=ultraplot --cov-branch --cov-context=test \
230251
--cov-report=xml:coverage.xml --cov-report= \
@@ -235,7 +256,7 @@ jobs:
235256
with:
236257
token: ${{ secrets.CODECOV_TOKEN }}
237258
files: ./coverage.xml
238-
name: codecov-pr-python3.10-mpl3.9
259+
name: codecov-pr-python${{ matrix.python-version }}-mpl${{ matrix.matplotlib-version }}
239260

240261
build:
241262
needs:
@@ -261,6 +282,7 @@ jobs:
261282
build-success:
262283
needs:
263284
- build
285+
- coverage
264286
- run-if-changes
265287
- stubs
266288
if: always()
@@ -270,7 +292,7 @@ jobs:
270292
if [[ '${{ needs.run-if-changes.outputs.run }}' == 'false' ]]; then
271293
echo "No changes detected, tests skipped."
272294
else
273-
if [[ '${{ needs.build.result }}' == 'success' && '${{ needs.stubs.result }}' == 'success' ]]; then
295+
if [[ '${{ needs.build.result }}' == 'success' && '${{ needs.stubs.result }}' == 'success' && ( '${{ needs.coverage.result }}' == 'success' || '${{ needs.coverage.result }}' == 'skipped' ) ]]; then
274296
echo "All tests passed successfully!"
275297
else
276298
echo "Tests failed!"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ docs/_static/*
2626
!docs/_static/alias-explorer-v3.js
2727
!docs/_static/alias-map.svg
2828
!docs/_static/why_plots/
29+
!docs/_static/example_plots/
30+
!docs/_static/example_plots/data_aware_example.svg
2931
*.html
3032
docs/gallery/
3133
docs/sg_execution_times.rst

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,11 @@ repos:
1414
rev: 26.5.1
1515
hooks:
1616
- id: black
17+
18+
- repo: https://github.com/tombi-toml/tombi-pre-commit
19+
rev: v1.5.2
20+
hooks:
21+
- id: tombi-format
22+
args: ["--offline"]
23+
- id: tombi-lint
24+
args: ["--offline"]

INSTALL.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ pyCirclize-based plots require the optional ``circos`` extra:
1818
1919
The ``docs`` extra also includes pyCirclize for building the documentation.
2020

21+
To install all optional dependency groups (``circos``, ``docs``, and ``stats``):
22+
23+
.. code-block:: bash
24+
25+
pip install 'ultraplot[all]'
26+
2127
Likewise, an existing installation of ultraplot can be upgraded to the latest version with:
2228

2329
.. code-block:: bash

README.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@ pyCirclize-based plots require the optional ``circos`` extra:
112112
113113
The ``docs`` extra also includes pyCirclize for building the documentation.
114114

115+
To install all optional dependency groups (``circos``, ``docs``, and ``stats``):
116+
117+
.. code-block:: bash
118+
119+
pip install 'ultraplot[all]'
120+
115121
Likewise, an existing installation of UltraPlot can be upgraded
116122
to the latest version with:
117123

0 commit comments

Comments
 (0)