Skip to content

Support Python >= 3.10 and make heavy dependencies optional (v1.4.0) - #206

Merged
J-Endres merged 2 commits into
mainfrom
relax-python-requirements
Nov 11, 2026
Merged

J-Endres merged 2 commits into
mainfrom
relax-python-requirements

Conversation

@J-Endres

Copy link
Copy Markdown
Collaborator

Relaxes the install requirements so MRzeroCore can be installed in more environments. bifti 0.3.1 now supports Python 3.10, so we can go back from >=3.12 to >=3.10.

Changes

  • Python >=3.10 (was >=3.12). The only newer feature in our code was typing.Self in tissue_dict.py; it is now a string annotation.
  • bifti>=0.3.1. numpy is now declared as a dependency (it is imported everywhere). New minimum versions: nibabel>=5.2, numpy>=1.22.
  • New playground extra: scikit-image and torchkbnufft are no longer installed by default, because MRzeroCore never imports them. The notebooks already install torchkbnufft themselves.
  • New mrd extra: ismrmrd>=1.14.1 is only needed for sig_to_mrd. Its h5py dependency has no wheels for some environments (e.g. Python 3.15) and otherwise has to be built against system HDF5. ismrmrd is imported lazily: import MRzeroCore works without it, and sig_to_mrd raises an ImportError that names pip install mrzerocore[mrd]. The only notebook that uses sig_to_mrd already runs pip install ismrmrd, and so does the playground CI.
  • Version bumped to 1.4.0, with a changelog entry. It is a minor bump because the packages installed by default change.

Testing

A smoke test in fresh uv venvs, using the abi3 wheel built from this branch. It writes a .seq with pypulseq, imports it with pulseq_rs and pydisseqt, saves and reloads a TissueDict via bifti, simulates, runs reco_adjoint, util.simulate, sig_to_mrd and pulseq_plot.

Setup Result
Python 3.10, 3.11, 3.12, 3.13, 3.14, latest dependencies ✅
Python 3.15.0rc2, plain pip install mrzerocore ✅ (sig_to_mrd raises the expected ImportError)
Python 3.12 with [mrd] ✅ including MRD export
Python 3.10 with the minimum versions (torch 1.12, numpy 1.22, scipy 1.8, matplotlib 3.5, nibabel 5.2, pydisseqt 0.1.13, ismrmrd 1.14.1) ✅
Python 3.10 with [playground] ✅

Known issues (not changed here)

  • pydisseqt 0.2.1 cannot parse pulseq 1.5 files (Unsupported pulseq file version: 1.5.0), and has no cp315 wheel (it builds from source if Rust is installed). The default pulseq_rs backend is not affected.
  • sig_to_mrd needs pypulseq >= 1.4 (it uses seq.definitions).
  • CI only runs on Python 3.12. A 3.10 job would keep the new minimum honest.

🤖 Generated with Claude Code

Jonathan Endres and others added 2 commits November 11, 2026 11:21
bifti 0.3.1 supports Python 3.10, so the requirement is relaxed from
>= 3.12 to >= 3.10. Tested in fresh venvs on Python 3.10 - 3.15.

- replace typing.Self (3.11+) with a string annotation
- bump bifti to >= 0.3.1 and declare numpy, which is imported directly
- add tested minimum versions: nibabel >= 5.2, numpy >= 1.22
- move scikit-image and torchkbnufft, which MRzeroCore never imports,
  to the new `playground` extra
- move ismrmrd to the new `mrd` extra (>= 1.14.1, older versions break
  with current xsdata). Its h5py dependency has no wheels for some
  environments, e.g. Python 3.15. ismrmrd is imported lazily, so
  `import MRzeroCore` works without it and sig_to_mrd raises an
  ImportError that names the extra.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@J-Endres
J-Endres force-pushed the relax-python-requirements branch from e8635a8 to da9e847 Compare November 11, 2026 10:21
@J-Endres
J-Endres merged commit 6aeff0f into main Nov 11, 2026
31 of 32 checks passed
@J-Endres
J-Endres deleted the relax-python-requirements branch November 11, 2026 10:24
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Simulation test: main (before) vs. this PR (after)

Sequence Status max mag NRMSE max phase RMSE max runtime Δ
mr0_DREAM_STE_seq ✅ 0.00e+00 0.00e+00 +2.7%
mr0_DWI_SE_EPI ✅ 0.00e+00 0.00e+00 +4.4%
mr0_EPI_2D_seq ✅ 0.00e+00 0.00e+00 +1.2%
mr0_FID_seq ✅ 0.00e+00 0.00e+00 +2.2%
mr0_FLASH_2D_seq ❌ 0.00e+00 0.00e+00 +23.7%
mr0_GRE_to_FLASH ⚠️ – – –
mr0_RARE_2D_seq ✅ 0.00e+00 0.00e+00 +11.3%
mr0_SE_CPMG_seq ✅ 0.00e+00 0.00e+00 +13.1%
mr0_STE_3pulses_5echoes_seq ✅ 6.86e-09 1.49e-08 +4.4%
mr0_TSE_2D_multi_shot_seq ✅ 0.00e+00 0.00e+00 +0.4%
mr0_bSSFP_2D_seq ✅ 0.00e+00 0.00e+00 +9.6%
mr0_diffusion_prep_STEAM_2D_seq ✅ 0.00e+00 0.00e+00 +5.5%
✅ mr0_DREAM_STE_seq: All tests passed.

mr0_DREAM_STE_seq

✅ mr0_DWI_SE_EPI: All tests passed.

mr0_DWI_SE_EPI

✅ mr0_EPI_2D_seq: All tests passed.

mr0_EPI_2D_seq

✅ mr0_FID_seq: All tests passed.

mr0_FID_seq

❌ mr0_FLASH_2D_seq: Runtime deviation too high (23.66%) at acc=0.00500

mr0_FLASH_2D_seq

⚠️ mr0_GRE_to_FLASH: No comparison possible: [Errno 2] No such file or directory: '/home/runner/work/MRzero-Core/MRzero-Core/tests/simulation_test/ref_files/mr0_GRE_to_FLASH.seq.npz'
✅ mr0_RARE_2D_seq: All tests passed.

mr0_RARE_2D_seq

✅ mr0_SE_CPMG_seq: All tests passed.

mr0_SE_CPMG_seq

✅ mr0_STE_3pulses_5echoes_seq: All tests passed.

mr0_STE_3pulses_5echoes_seq

✅ mr0_TSE_2D_multi_shot_seq: All tests passed.

mr0_TSE_2D_multi_shot_seq

✅ mr0_bSSFP_2D_seq: All tests passed.

mr0_bSSFP_2D_seq

✅ mr0_diffusion_prep_STEAM_2D_seq: All tests passed.

mr0_diffusion_prep_STEAM_2D_seq

Workflow run — raw .npz data is attached as artifacts.

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