Skip to content

Commit 641c5ca

Browse files
authored
fix(legacy): guard data-model __module__ relabel on immutable static types (#103)
1 parent 8985d40 commit 641c5ca

2 files changed

Lines changed: 27 additions & 6 deletions

File tree

.github/workflows/wheels-legacy.yml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,24 @@
2525
name: wheels-legacy
2626

2727
on:
28-
# MAIN-ONLY build: the legacy cp310/cp311 wheels build on every merge to main —
29-
# like the LTO legs in ci.yml — and via manual dispatch. They NEVER run on PRs,
30-
# so PR latency is unaffected; the slow, lower-priority legacy build is paid only
31-
# post-merge.
28+
# MAIN-ONLY build by default: the legacy cp310/cp311 wheels build on every merge
29+
# to main — like the LTO legs in ci.yml — and via manual dispatch. They do NOT run
30+
# on PRs by default, so PR latency is unaffected; the slow, lower-priority legacy
31+
# build is paid only post-merge.
3232
push:
3333
branches: [main]
3434
workflow_dispatch:
35+
# OPT-IN PR validation: add the `ci:legacy` label to a PR to run the legacy build
36+
# on that PR (and on every subsequent push while the label stays on). Use this to
37+
# validate changes that touch the legacy wheel path (e.g. the data_model module
38+
# shim) BEFORE merge, instead of finding out post-merge. The per-job `if` below
39+
# gates execution on the label being present, so unrelated `labeled` events (any
40+
# other label) are no-ops.
41+
pull_request:
42+
types: [labeled, synchronize, reopened]
3543

3644
concurrency:
37-
group: wheels-legacy-${{ github.ref }}
45+
group: wheels-legacy-${{ github.event.pull_request.number || github.ref }}
3846
cancel-in-progress: true
3947

4048
jobs:
@@ -44,6 +52,10 @@ jobs:
4452
# =========================================================================
4553
linux:
4654
name: legacy linux (manylinux2014, cp310+cp311)
55+
# On PRs, run only when the `ci:legacy` label is present; push/dispatch always run.
56+
if: >-
57+
github.event_name != 'pull_request' ||
58+
contains(github.event.pull_request.labels.*.name, 'ci:legacy')
4759
# Two non-abi3 cp legs compiled back-to-back → heavy. Blacksmith 16-vcpu when
4860
# FVTK_RUNNER_LINUX is set, else github ubuntu-latest. The manylinux2014
4961
# container build width auto-tracks the runner cores.
@@ -121,6 +133,10 @@ jobs:
121133
# =========================================================================
122134
windows:
123135
name: legacy windows (cp310+cp311)
136+
# On PRs, run only when the `ci:legacy` label is present; push/dispatch always run.
137+
if: >-
138+
github.event_name != 'pull_request' ||
139+
contains(github.event.pull_request.labels.*.name, 'ci:legacy')
124140
runs-on: ${{ vars.FVTK_RUNNER_WINDOWS || 'windows-latest' }}
125141
steps:
126142
- uses: actions/checkout@v5

Wrapping/Python/fvtk/util/data_model.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@
5454
vtkPartitionedDataSetCollection,
5555
):
5656
if _vtk_dm_cls.__module__.startswith("fvtk."):
57-
_vtk_dm_cls.__module__ = "vtkmodules." + _vtk_dm_cls.__module__[len("fvtk.") :]
57+
# cp312+ wraps these as heap types (mutable __module__); the cp310/cp311
58+
# legacy wheels wrap them as static (immutable) C types, where the setter
59+
# raises "cannot set '__module__' attribute of immutable type". The relabel
60+
# is cosmetic PyVista-override compat, so skip it where it can't be applied.
61+
with suppress(TypeError):
62+
_vtk_dm_cls.__module__ = "vtkmodules." + _vtk_dm_cls.__module__[len("fvtk.") :]
5863
del _vtk_dm_cls
5964

6065
import weakref

0 commit comments

Comments
 (0)