Skip to content

Commit c9525c0

Browse files
authored
Merge pull request #48 from spm/dep-runtime
[ENH] spm-runtime dependency
2 parents 9aa9960 + 182c776 commit c9525c0

File tree

3,995 files changed

+90821
-91213
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,995 files changed

+90821
-91213
lines changed

.github/workflows/run_unit_tests.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@ on:
33
workflow_dispatch:
44
workflow_call:
55
push:
6-
paths:
6+
paths:
77
- tests/**
88
- spm/**
9-
- setup.py
9+
- setup.py
1010
- pyproject.toml
1111
pull_request:
12-
12+
1313
env:
1414
MLM_LICENSE_TOKEN: ${{ secrets.MATLAB_BATCH_TOKEN }}
15-
15+
1616
jobs:
1717
run-unit-tests:
1818
runs-on: ${{ matrix.os }}
1919
strategy:
2020
fail-fast: False
2121
matrix:
22-
matlab: ["latest"]
22+
matlab: ["R2025a"]
2323
os: [ubuntu-latest, macos-13, macos-latest, windows-latest]
2424
python-version: ["3.9", "3.10", "3.11", "3.12"]
2525
include:
@@ -41,14 +41,16 @@ jobs:
4141
uses: actions/setup-python@v5
4242
with:
4343
python-version: ${{ matrix.python-version }}
44-
44+
4545
- name: Check out SPM Python
4646
uses: actions/checkout@v4
4747

4848
- name: Install SPM Python
49-
run: python -m pip install -e .
50-
51-
# Setup MATLAB and Runtime
49+
run: |
50+
python -m pip install mpython-core
51+
python -m pip install -e .
52+
53+
# Setup MATLAB and Runtime
5254
- name: Set up MATLAB
5355
uses: matlab-actions/setup-matlab@v2
5456
with:
@@ -73,7 +75,7 @@ jobs:
7375
# sometimes this step hangs when closing matlab, automatically terminating after 2 minutes solves the issue
7476
timeout-minutes: 2
7577
continue-on-error: true
76-
78+
7779
- name: Set environment variable with MATLAB path
7880
shell: bash # Works on Windows as well because of shell: bash
7981
run: |
@@ -90,7 +92,7 @@ jobs:
9092
${{ env.MATLAB_PATH }}/extern/bin/maca64"
9193
export PYTHONHOME=${{ env.pythonLocation }}
9294
mwpython -m unittest discover tests -v
93-
95+
9496
- name: Run tests (Mac Intel)
9597
if: matrix.os_name == 'macOS_Intel'
9698
run: |
@@ -101,7 +103,7 @@ jobs:
101103
${{ env.MATLAB_PATH }}/extern/bin/maci64"
102104
export PYTHONHOME=${{ env.pythonLocation }}
103105
mwpython -m unittest discover tests -v
104-
106+
105107
- name: Run tests (Windows)
106108
if: matrix.os_name == 'Windows'
107109
shell: bash

.mpython/templates/class_header.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
from mpython import Runtime, MatlabClass
1+
from mpython import MatlabClass
2+
from spm._runtime import Runtime, RuntimeMixin
23

34

4-
class <classname>(MatlabClass):
5+
class <classname>(RuntimeMixin, MatlabClass):
56
def __init__(self, *args, **kwargs):
67
<docstring>
78
super().__init__()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from spm._runtime import Runtime

MANIFEST.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
include README.md
22
include LICENSE
33
include AUTHORS.txt
4-
recursive-include spm/_spm *.ctf

pyproject.toml

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,52 @@ description = "Python bindings for the SPM software."
99
readme = "README.md"
1010
license = {file = "LICENSE"}
1111
authors = [
12-
{name = "Johan Medrano", email = "johan.medrano@ucl.ac.uk"},
13-
{name = "Yael Balbastre", email = "y.balbastre@ucl.ac.yk"},
12+
{name = "Johan Medrano", email = "johan.medrano@ucl.ac.uk"},
13+
{name = "Yael Balbastre", email = "y.balbastre@ucl.ac.uk"},
1414
{name = "Yulia Bezsudnova"},
15-
{name = "Arthur Mitchell"},
16-
{name = "Peter Zeidman"},
17-
{name = "Olivia Kowalczyk"} ]
18-
requires-python = ">=3.9,<3.13"
15+
{name = "Arthur Mitchell"},
16+
{name = "Peter Zeidman"},
17+
{name = "Olivia Kowalczyk"},
18+
]
19+
requires-python = ">=3.6,<3.13"
1920
classifiers = [
2021
"Development Status :: 4 - Beta",
2122
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
23+
"Programming Language :: Python :: 3.6",
24+
"Programming Language :: Python :: 3.7",
25+
"Programming Language :: Python :: 3.8",
2226
"Programming Language :: Python :: 3.9",
2327
"Programming Language :: Python :: 3.10",
2428
"Programming Language :: Python :: 3.11",
2529
"Programming Language :: Python :: 3.12",
2630
]
2731
dependencies = [
28-
"numpy",
29-
"mpython-core<=25.4a3"
32+
"mpython-core>=25.4rc1",
33+
"spm-runtime-r2025a == 25.1.1 ; python_version >= '3.9'",
34+
"spm-runtime-r2023a == 25.1.1 ; python_version == '3.8'",
35+
"spm-runtime-r2021b == 25.1.1 ; python_version == '3.7'",
36+
"spm-runtime-r2020b == 25.1.1 ; python_version == '3.6'",
3037
]
3138

39+
[project.optional-dependencies]
40+
latest = ["spm-runtime == 25.1.1"]
41+
R2025a = ["spm-runtime-R2025a == 25.1.1"]
42+
R2024b = ["spm-runtime-R2024b == 25.1.1"]
43+
R2024a = ["spm-runtime-R2024a == 25.1.1"]
44+
R2023b = ["spm-runtime-R2023b == 25.1.1"]
45+
R2023a = ["spm-runtime-R2023a == 25.1.1"]
46+
R2022b = ["spm-runtime-R2022b == 25.1.1"]
47+
R2022a = ["spm-runtime-R2022a == 25.1.1"]
48+
R2021b = ["spm-runtime-R2021b == 25.1.1"]
49+
R2021a = ["spm-runtime-R2021a == 25.1.1"]
50+
R2020b = ["spm-runtime-R2020b == 25.1.1"]
51+
3252
[project.urls]
3353
Repository = "https://github.com/spm/spm-python"
3454

3555
[tool.setuptools.packages]
3656
find = {}
3757

38-
[tool.setuptools.package-data]
39-
spm = ["_spm/_spm.ctf"]
40-
4158
[tool.setuptools.dynamic]
4259
version = {attr = "spm._version.__version__"}
4360

spm/__compat/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@
4040
"spm_read_hdr",
4141
"spm_resss",
4242
"spm_spm_ui",
43-
"spm_tbx_config2cfg",
43+
"spm_tbx_config2cfg"
4444
]

spm/__compat/loadxml.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
from mpython import Runtime
1+
from spm._runtime import Runtime
22

33

44
def loadxml(*args, **kwargs):
55
"""
6-
LOADXML Load workspace variables from disk (XML file).
7-
LOADXML FILENAME retrieves all variables from a file given a full
8-
pathname or a MATLABPATH relative partial pathname (see PARTIALPATH).
9-
If FILENAME has no extension LOAD looks for FILENAME and FILENAME.xml
10-
and treats it as an XML file.
11-
12-
LOAD, by itself, uses the XML file named 'matlab.xml'. It is an error
13-
if 'matlab.xml' is not found.
14-
15-
LOAD FILENAME X loads only X.
16-
LOAD FILENAME X Y Z ... loads just the specified variables. The
17-
wildcard '*' loads variables that match a pattern.
18-
Requested variables from FILENAME are created in the workspace.
19-
20-
S = LOAD(...) returns the contents of FILENAME in variable S. S is
21-
a struct containing fields matching the variables retrieved.
22-
23-
Use the functional form of LOAD, such as LOAD('filename'), when the
24-
file name is stored in a string, when an output argument is requested,
25-
or if FILENAME contains spaces.
26-
27-
See also LOAD, XML2MAT, XMLTREE.
28-
6+
LOADXML Load workspace variables from disk (XML file).
7+
LOADXML FILENAME retrieves all variables from a file given a full
8+
pathname or a MATLABPATH relative partial pathname (see PARTIALPATH).
9+
If FILENAME has no extension LOAD looks for FILENAME and FILENAME.xml
10+
and treats it as an XML file.
11+
12+
LOAD, by itself, uses the XML file named 'matlab.xml'. It is an error
13+
if 'matlab.xml' is not found.
14+
15+
LOAD FILENAME X loads only X.
16+
LOAD FILENAME X Y Z ... loads just the specified variables. The
17+
wildcard '*' loads variables that match a pattern.
18+
Requested variables from FILENAME are created in the workspace.
19+
20+
S = LOAD(...) returns the contents of FILENAME in variable S. S is
21+
a struct containing fields matching the variables retrieved.
22+
23+
Use the functional form of LOAD, such as LOAD('filename'), when the
24+
file name is stored in a string, when an output argument is requested,
25+
or if FILENAME contains spaces.
26+
27+
See also LOAD, XML2MAT, XMLTREE.
28+
2929
3030
[Matlab code]( https://github.com/spm/spm/blob/main/compat/loadxml.m )
3131

spm/__compat/savexml.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
from mpython import Runtime
1+
from spm._runtime import Runtime
22

33

44
def savexml(*args, **kwargs):
55
"""
6-
SAVEXML Save workspace variables to disk in XML.
7-
SAVEXML FILENAME saves all workspace variables to the XML-file
8-
named FILENAME.xml. The data may be retrieved with LOADXML. if
9-
FILENAME has no extension, .xml is assumed.
10-
11-
SAVE, by itself, creates the XML-file named 'matlab.xml'. It is
12-
an error if 'matlab.xml' is not writable.
13-
14-
SAVE FILENAME X saves only X.
15-
SAVE FILENAME X Y Z saves X, Y, and Z. The wildcard '*' can be
16-
used to save only those variables that match a pattern.
17-
18-
SAVE ... -APPEND adds the variables to an existing file.
19-
20-
Use the functional form of SAVE, such as SAVE(filename','var1','var2'),
21-
when the filename or variable names are stored in strings.
22-
23-
See also SAVE, MAT2XML, XMLTREE.
24-
6+
SAVEXML Save workspace variables to disk in XML.
7+
SAVEXML FILENAME saves all workspace variables to the XML-file
8+
named FILENAME.xml. The data may be retrieved with LOADXML. if
9+
FILENAME has no extension, .xml is assumed.
10+
11+
SAVE, by itself, creates the XML-file named 'matlab.xml'. It is
12+
an error if 'matlab.xml' is not writable.
13+
14+
SAVE FILENAME X saves only X.
15+
SAVE FILENAME X Y Z saves X, Y, and Z. The wildcard '*' can be
16+
used to save only those variables that match a pattern.
17+
18+
SAVE ... -APPEND adds the variables to an existing file.
19+
20+
Use the functional form of SAVE, such as SAVE(filename','var1','var2'),
21+
when the filename or variable names are stored in strings.
22+
23+
See also SAVE, MAT2XML, XMLTREE.
24+
2525
2626
[Matlab code]( https://github.com/spm/spm/blob/main/compat/savexml.m )
2727

spm/__compat/spm_add.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
from mpython import Runtime
1+
from spm._runtime import Runtime
22

33

44
def spm_add(*args, **kwargs):
55
"""
6-
Add a series of images - a compiled routine
7-
FORMAT s = spm_add(VI,VO)
8-
VI - Vector of mapped volumes (from spm_map or spm_vol).
9-
VO - Description of output volume that gets passed to
10-
spm_write_plane.m
11-
flags - Flags can be:
12-
'm' - masks the mean to zero or NaN wherever
13-
a zero occurs in the input images.
14-
s - Scalefactor for output image.
15-
__________________________________________________________________________
16-
17-
spm_add computes a sum of a set of image volumes to produce an
18-
integral image that is written to a named file (VI.fname).
19-
20-
A mean can be effected by modifying the scalefactors (and offsets) of
21-
VI (see spm_mean_ui for an example). A weighted sum can be effected by
22-
using different weightings for image scalefactors.
23-
__________________________________________________________________________
24-
6+
Add a series of images - a compiled routine
7+
FORMAT s = spm_add(VI,VO)
8+
VI - Vector of mapped volumes (from spm_map or spm_vol).
9+
VO - Description of output volume that gets passed to
10+
spm_write_plane.m
11+
flags - Flags can be:
12+
'm' - masks the mean to zero or NaN wherever
13+
a zero occurs in the input images.
14+
s - Scalefactor for output image.
15+
__________________________________________________________________________
16+
17+
spm_add computes a sum of a set of image volumes to produce an
18+
integral image that is written to a named file (VI.fname).
19+
20+
A mean can be effected by modifying the scalefactors (and offsets) of
21+
VI (see spm_mean_ui for an example). A weighted sum can be effected by
22+
using different weightings for image scalefactors.
23+
__________________________________________________________________________
24+
2525
2626
[Matlab code]( https://github.com/spm/spm/blob/main/compat/spm_add.m )
2727

0 commit comments

Comments
 (0)