Skip to content

1.9.x train 2026-11-14: mprans modules import what they use (import-order fix) - #1362

Merged
cekees merged 2 commits into
proteustoolkit:1.9.xfrom
cekees:train/1.9.x-2026-11-14
Nov 15, 2026
Merged

cekees merged 2 commits into
proteustoolkit:1.9.xfrom
cekees:train/1.9.x-2026-11-14

Conversation

@cekees

@cekees cekees commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

This pull request was reviewed, and passed CI, as its own pull request on cekees/proteus. This branch merges it onto 1.9.x at d1c4fe2 with one merge commit.

Merge with "Create a merge commit", not squash or rebase, so the commit keeps its hash and the fork's pull request closes itself.

pull request title commits
cekees#284 mprans: import the proteus modules used by attribute (1.9.x) + isolation test 1

Six of the 30 proteus.mprans modules failed on import in a fresh interpreter: Dissipation, Kappa, NCLS, RDLS and SW2D with AttributeError, MCorr with an ImportError on macOS (_dgesc2_). They used proteus.X attributes without importing X, so they worked only when something else had imported it first, as in a full parun run. The change ports the five imports from main (cfe3611), makes MCorr import proteus.Transport before cfemIntegrals, and adds test/test_mprans_import_isolation.py, which imports each module in its own process (30 of 30 pass).

The same guard test goes to main in a separate pull request, since main already has the imports.

Diff against 1.9.x: 7 files changed, 97 insertions(+).

🤖 Generated with Claude Code

cekees and others added 2 commits November 13, 2026 23:43
Dissipation, Kappa, NCLS, RDLS, SW2D and MCorr do `import proteus` and then
name proteus.SubgridError, proteus.StepControl and others as attributes, which
works only if something else imported them first. One pytest process per file
(the LSU QB 1.9.1 module tests) showed it: test_cython_class_attributes
[proteus.mprans.MCorr] failed with "module 'proteus' has no attribute
'StepControl'". Ports cfe3611 (five modules) and main's MCorr imports.

New test/test_mprans_import_isolation.py imports each of the 30 proteus.mprans
modules in its own subprocess.

Before (1.9.x d1c4fe2, 30 modules, each alone): 6 fail, 24 pass.
  Dissipation, Kappa, NCLS, RDLS, SW2D: AttributeError, module 'proteus' has
  no attribute 'SubgridError'
  MCorr: ImportError (macOS) symbol not found '_dgesc2_', once the missing
  imports were added after cfemIntegrals; it needs them before it (see below).
After: 30/30 pass (local macOS arm64, env proteus-hotstart-261025,
PYTHONPATH=worktree, seeded extensions).

Import placement: after each file's existing imports (as cfe3611), except
MCorr, whose first import is cfemIntegrals, which does not link LAPACK itself;
there the block goes right after `import proteus`, with proteus.Transport
first, so LAPACK is loaded before cfemIntegrals.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
….x) + isolation test

From cekees/mprans-imports-19x at 7ec4108 (#284).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@cekees
cekees merged commit 76ed517 into proteustoolkit:1.9.x Nov 15, 2026
4 checks passed
@cekees
cekees deleted the train/1.9.x-2026-11-14 branch November 15, 2026 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant