Skip to content

Commit 3148cfb

Browse files
authored
Bumps python version to 3.10 and matlab engine version to 2023a (#138)
* Bumps python version to 3.10 and matlab engine version to 2023a * Adds ability to use "set_fields" with parameter names * Addresses review comment
1 parent d1e8e3b commit 3148cfb

File tree

6 files changed

+17
-12
lines changed

6 files changed

+17
-12
lines changed

.github/workflows/build_wheel.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
env:
1616
CIBW_SKIP: 'pp*'
1717
CIBW_ARCHS: 'auto64'
18-
CIBW_PROJECT_REQUIRES_PYTHON: '>=3.9'
18+
CIBW_PROJECT_REQUIRES_PYTHON: '>=3.10'
1919
CIBW_TEST_REQUIRES: 'pytest'
2020
defaults:
2121
run:

.github/workflows/run_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
fail-fast: false
2121
matrix:
2222
os: [ubuntu-latest, windows-latest, macos-13]
23-
version: ["3.9", "3.13"]
23+
version: ["3.10", "3.13"]
2424
defaults:
2525
run:
2626
shell: bash -l {0}

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ issue has not been reported already) or submitting a pull request.
55

66
Create Developer Environment
77
----------------------------
8-
This project targets Python 3.9 or later. Install an appropriate version of Python and other dependencies
8+
This project targets Python 3.10 or later. Install an appropriate version of Python and other dependencies
99

1010
Then create a fork of the python-RAT repo, and clone the fork
1111

RATapi/classlist.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,15 @@ def extend(self, other: Sequence[T]) -> None:
296296
self._check_unique_name_fields(other)
297297
self.data.extend(other)
298298

299-
def set_fields(self, index: int, **kwargs) -> None:
299+
def set_fields(self, index: Union[int, slice, str, T], **kwargs) -> None:
300300
"""Assign the values of an existing object's attributes using keyword arguments."""
301301
self._validate_name_field(kwargs)
302302
pydantic_object = False
303303

304+
# Find index if name or object is supplied
305+
if isinstance(index, (str, self._class_handle)):
306+
index = self.index(index)
307+
304308
if importlib.util.find_spec("pydantic"):
305309
# Pydantic is installed, so set up a context manager that will
306310
# suppress custom validation errors until all fields have been set.

setup.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def build_libraries(self, libraries):
165165
cmdclass={"build_clib": BuildClib, "build_ext": BuildExt},
166166
libraries=[libevent],
167167
ext_modules=ext_modules,
168-
python_requires=">=3.9",
168+
python_requires=">=3.10",
169169
install_requires=[
170170
"numpy >= 1.20",
171171
"prettytable >= 3.9.0",
@@ -178,13 +178,11 @@ def build_libraries(self, libraries):
178178
':python_version < "3.11"': ["StrEnum >= 0.4.15"],
179179
"Dev": ["pytest>=7.4.0", "pytest-cov>=4.1.0", "ruff>=0.4.10"],
180180
"Matlab_latest": ["matlabengine"],
181-
"Matlab_2024a": ["matlabengine == 24.1.*"],
181+
"Matlab_2025a": ["matlabengine == 25.1.*"],
182+
"Matlab_2024b": ["matlabengine == 24.2.2"],
183+
"Matlab_2024a": ["matlabengine == 24.1.4"],
182184
"Matlab_2023b": ["matlabengine == 23.2.3"],
183185
"Matlab_2023a": ["matlabengine == 9.14.3"],
184-
"Matlab_2022b": ["matlabengine == 9.13.9"],
185-
"Matlab_2022a": ["matlabengine == 9.12.19"],
186-
"Matlab_2021b": ["matlabengine == 9.11.21"],
187-
"Matlab_2021a": ["matlabengine == 9.10.3"],
188186
},
189187
zip_safe=False,
190188
)

tests/test_classlist.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,7 @@ def test_extend_empty_classlist(extended_list: Sequence, one_name_class_list: Cl
729729
assert isinstance(extended_list[-1], class_list._class_handle)
730730

731731

732+
@pytest.mark.parametrize("index", [0, "Alice", InputAttributes(name="Alice")])
732733
@pytest.mark.parametrize(
733734
["new_values", "expected_classlist"],
734735
[
@@ -739,10 +740,12 @@ def test_extend_empty_classlist(extended_list: Sequence, one_name_class_list: Cl
739740
),
740741
],
741742
)
742-
def test_set_fields(two_name_class_list: ClassList, new_values: dict[str, Any], expected_classlist: ClassList) -> None:
743+
def test_set_fields(
744+
two_name_class_list: ClassList, index: Union[int, str], new_values: dict[str, Any], expected_classlist: ClassList
745+
) -> None:
743746
"""We should be able to set field values in an element of a ClassList using keyword arguments."""
744747
class_list = two_name_class_list
745-
class_list.set_fields(0, **new_values)
748+
class_list.set_fields(index, **new_values)
746749
assert class_list == expected_classlist
747750

748751

0 commit comments

Comments
 (0)