matlabengine 25.2.2__tar.gz → 26.1.12__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. {matlabengine-25.2.2 → matlabengine-26.1.12}/PKG-INFO +22 -13
  2. {matlabengine-25.2.2 → matlabengine-26.1.12}/README.md +7 -7
  3. {matlabengine-25.2.2 → matlabengine-26.1.12}/setup.py +23 -8
  4. matlabengine-26.1.12/src/matlab/__init__.py +263 -0
  5. {matlabengine-25.2.2 → matlabengine-26.1.12}/src/matlab/engine/__init__.py +6 -6
  6. {matlabengine-25.2.2 → matlabengine-26.1.12}/src/matlab/engine/matlabengine.py +9 -5
  7. {matlabengine-25.2.2 → matlabengine-26.1.12}/src/matlabengine.egg-info/PKG-INFO +22 -13
  8. matlabengine-25.2.2/src/matlab/__init__.py +0 -49
  9. {matlabengine-25.2.2 → matlabengine-26.1.12}/LICENSE.txt +0 -0
  10. {matlabengine-25.2.2 → matlabengine-26.1.12}/pyproject.toml +0 -0
  11. {matlabengine-25.2.2 → matlabengine-26.1.12}/setup.cfg +0 -0
  12. {matlabengine-25.2.2 → matlabengine-26.1.12}/src/matlab/engine/basefuture.py +0 -0
  13. {matlabengine-25.2.2 → matlabengine-26.1.12}/src/matlab/engine/engineerror.py +0 -0
  14. {matlabengine-25.2.2 → matlabengine-26.1.12}/src/matlab/engine/enginehelper.py +0 -0
  15. {matlabengine-25.2.2 → matlabengine-26.1.12}/src/matlab/engine/enginesession.py +0 -0
  16. {matlabengine-25.2.2 → matlabengine-26.1.12}/src/matlab/engine/fevalfuture.py +0 -0
  17. {matlabengine-25.2.2 → matlabengine-26.1.12}/src/matlab/engine/futureresult.py +0 -0
  18. {matlabengine-25.2.2 → matlabengine-26.1.12}/src/matlab/engine/matlabfuture.py +0 -0
  19. {matlabengine-25.2.2 → matlabengine-26.1.12}/src/matlabengine.egg-info/SOURCES.txt +0 -0
  20. {matlabengine-25.2.2 → matlabengine-26.1.12}/src/matlabengine.egg-info/dependency_links.txt +0 -0
  21. {matlabengine-25.2.2 → matlabengine-26.1.12}/src/matlabengine.egg-info/not-zip-safe +0 -0
  22. {matlabengine-25.2.2 → matlabengine-26.1.12}/src/matlabengine.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: matlabengine
3
- Version: 25.2.2
3
+ Version: 26.1.12
4
4
  Summary: A module to call MATLAB from Python
5
5
  Home-page: https://github.com/mathworks/matlab-engine-for-python/
6
6
  Author: MathWorks
@@ -9,16 +9,27 @@ Project-URL: Documentation, https://www.mathworks.com/help/matlab/matlab-engine-
9
9
  Project-URL: Source, https://github.com/mathworks/matlab-engine-for-python
10
10
  Project-URL: Tracker, https://github.com/mathworks/matlab-engine-for-python/issues
11
11
  Keywords: MATLAB,MATLAB Engine for Python
12
- Platform: UNKNOWN
13
12
  Classifier: Natural Language :: English
14
13
  Classifier: Intended Audience :: Developers
15
14
  Classifier: Programming Language :: Python :: 3.9
16
15
  Classifier: Programming Language :: Python :: 3.10
17
16
  Classifier: Programming Language :: Python :: 3.11
18
17
  Classifier: Programming Language :: Python :: 3.12
19
- Requires-Python: >=3.9, <3.13
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Requires-Python: >=3.9, <3.14
20
20
  Description-Content-Type: text/markdown
21
21
  License-File: LICENSE.txt
22
+ Dynamic: author
23
+ Dynamic: classifier
24
+ Dynamic: description
25
+ Dynamic: description-content-type
26
+ Dynamic: home-page
27
+ Dynamic: keywords
28
+ Dynamic: license
29
+ Dynamic: license-file
30
+ Dynamic: project-url
31
+ Dynamic: requires-python
32
+ Dynamic: summary
22
33
 
23
34
  # MATLAB Engine API for Python
24
35
 
@@ -28,11 +39,11 @@ The MATLAB&reg; Engine API for Python&reg; provides a package to integrate MATLA
28
39
  ## Requirements
29
40
  ### Required MathWorks Products
30
41
  <!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
31
- * MATLAB release R2025b
42
+ * MATLAB release R2026a
32
43
 
33
44
  ### Required 3rd Party Products
34
45
  <!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
35
- * Python 3.9, 3.10, 3.11, or 3.12
46
+ * Python 3.9, 3.10, 3.11, 3.12, or 3.13
36
47
  * Supported Python versions by MATLAB release can be found [here](https://www.mathworks.com/support/requirements/python-compatibility.html).
37
48
 
38
49
  ---
@@ -43,7 +54,7 @@ The MATLAB&reg; Engine API for Python&reg; provides a package to integrate MATLA
43
54
  MATLAB Engine API for Python can be installed directly from the Python Package Index.
44
55
  <!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
45
56
  ```bash
46
- $ python -m pip install matlabengine==25.2.2
57
+ $ python -m pip install matlabengine==26.1.12
47
58
  ```
48
59
 
49
60
 
@@ -51,7 +62,7 @@ $ python -m pip install matlabengine==25.2.2
51
62
  ### Linux&reg;
52
63
  Prior to installation, check the default install location of MATLAB by calling ```matlabroot``` in a MATLAB Command Window. By default, Linux installs MATLAB at:<br>
53
64
  <!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
54
- ```/usr/local/MATLAB/R2025b```
65
+ ```/usr/local/MATLAB/R2026a```
55
66
 
56
67
  When MATLAB is not installed in the default location, the bin/*architecture* directory within the MATLAB root directory must be added to the environment variable LD_LIBRARY_PATH. The path can be added to the environment variable within the shell startup configuration file (for example, .bashrc for bash shell or .tcshrc for tcsh).
57
68
 
@@ -68,14 +79,14 @@ setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:<matlabroot>/bin/glnxa64
68
79
  MATLAB Engine API for Python can be installed directly from the Python Package Index.
69
80
  <!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
70
81
  ```bash
71
- $ python -m pip install matlabengine==25.2.2
82
+ $ python -m pip install matlabengine==26.1.12
72
83
  ```
73
84
 
74
85
  ### macOS
75
86
  Prior to installation, check the default install location of MATLAB by calling ```matlabroot``` in a MATLAB Command Window. By default, macOS installs MATLAB at:<br>
76
87
 
77
88
  <!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
78
- ```/Applications/MATLAB_R2025b.app```
89
+ ```/Applications/MATLAB_R2026a.app```
79
90
 
80
91
  When MATLAB is not installed in the default location, the bin/*architecture* directory within the MATLAB root directory must be added to the environment variable DYLD_LIBRARY_PATH. The path can be added to the environment variable within the shell startup configuration file (for example, .bashrc for bash shell or .tcshrc for tcsh).
81
92
 
@@ -92,7 +103,7 @@ setenv DYLD_LIBRARY_PATH ${DYLD_LIBRARY_PATH}:<matlabroot>/bin/maci64
92
103
  MATLAB Engine API for Python can be installed directly from the Python Package Index.
93
104
  <!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
94
105
  ```bash
95
- $ python -m pip install matlabengine==25.2.2
106
+ $ python -m pip install matlabengine==26.1.12
96
107
  ```
97
108
 
98
109
  ---
@@ -160,5 +171,3 @@ Linux&reg; is the registered trademark of Linus Torvalds in the U.S. and other c
160
171
  Mac OS is a trademark of Apple Inc., registered in the U.S. and other countries.
161
172
 
162
173
  "Python" and the Python logos are trademarks or registered trademarks of the Python Software Foundation, used by MathWorks with permission from the Foundation.
163
-
164
-
@@ -6,11 +6,11 @@ The MATLAB&reg; Engine API for Python&reg; provides a package to integrate MATLA
6
6
  ## Requirements
7
7
  ### Required MathWorks Products
8
8
  <!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
9
- * MATLAB release R2025b
9
+ * MATLAB release R2026a
10
10
 
11
11
  ### Required 3rd Party Products
12
12
  <!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
13
- * Python 3.9, 3.10, 3.11, or 3.12
13
+ * Python 3.9, 3.10, 3.11, 3.12, or 3.13
14
14
  * Supported Python versions by MATLAB release can be found [here](https://www.mathworks.com/support/requirements/python-compatibility.html).
15
15
 
16
16
  ---
@@ -21,7 +21,7 @@ The MATLAB&reg; Engine API for Python&reg; provides a package to integrate MATLA
21
21
  MATLAB Engine API for Python can be installed directly from the Python Package Index.
22
22
  <!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
23
23
  ```bash
24
- $ python -m pip install matlabengine==25.2.2
24
+ $ python -m pip install matlabengine==26.1.12
25
25
  ```
26
26
 
27
27
 
@@ -29,7 +29,7 @@ $ python -m pip install matlabengine==25.2.2
29
29
  ### Linux&reg;
30
30
  Prior to installation, check the default install location of MATLAB by calling ```matlabroot``` in a MATLAB Command Window. By default, Linux installs MATLAB at:<br>
31
31
  <!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
32
- ```/usr/local/MATLAB/R2025b```
32
+ ```/usr/local/MATLAB/R2026a```
33
33
 
34
34
  When MATLAB is not installed in the default location, the bin/*architecture* directory within the MATLAB root directory must be added to the environment variable LD_LIBRARY_PATH. The path can be added to the environment variable within the shell startup configuration file (for example, .bashrc for bash shell or .tcshrc for tcsh).
35
35
 
@@ -46,14 +46,14 @@ setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:<matlabroot>/bin/glnxa64
46
46
  MATLAB Engine API for Python can be installed directly from the Python Package Index.
47
47
  <!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
48
48
  ```bash
49
- $ python -m pip install matlabengine==25.2.2
49
+ $ python -m pip install matlabengine==26.1.12
50
50
  ```
51
51
 
52
52
  ### macOS
53
53
  Prior to installation, check the default install location of MATLAB by calling ```matlabroot``` in a MATLAB Command Window. By default, macOS installs MATLAB at:<br>
54
54
 
55
55
  <!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
56
- ```/Applications/MATLAB_R2025b.app```
56
+ ```/Applications/MATLAB_R2026a.app```
57
57
 
58
58
  When MATLAB is not installed in the default location, the bin/*architecture* directory within the MATLAB root directory must be added to the environment variable DYLD_LIBRARY_PATH. The path can be added to the environment variable within the shell startup configuration file (for example, .bashrc for bash shell or .tcshrc for tcsh).
59
59
 
@@ -70,7 +70,7 @@ setenv DYLD_LIBRARY_PATH ${DYLD_LIBRARY_PATH}:<matlabroot>/bin/maci64
70
70
  MATLAB Engine API for Python can be installed directly from the Python Package Index.
71
71
  <!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
72
72
  ```bash
73
- $ python -m pip install matlabengine==25.2.2
73
+ $ python -m pip install matlabengine==26.1.12
74
74
  ```
75
75
 
76
76
  ---
@@ -1,4 +1,4 @@
1
- # Copyright 2024 Mathworks, Inc.
1
+ # Copyright 2024-2026 Mathworks, Inc.
2
2
 
3
3
  from setuptools import setup, find_packages
4
4
  from setuptools.command.build_py import build_py
@@ -21,13 +21,13 @@ class _MatlabFinder(build_py):
21
21
  }
22
22
 
23
23
  # MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string)
24
- MATLAB_REL = 'R2025b'
24
+ MATLAB_REL = 'R2026a'
25
25
 
26
26
  # MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string)
27
- MATLAB_VER = '25.2.2'
27
+ MATLAB_VER = '26.1.12'
28
28
 
29
29
  # MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string)
30
- SUPPORTED_PYTHON_VERSIONS = set(['3.9', '3.10', '3.11', '3.12'])
30
+ SUPPORTED_PYTHON_VERSIONS = set(['3.9', '3.10', '3.11', '3.12', '3.13'])
31
31
 
32
32
  # MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string)
33
33
  VER_TO_REL = {
@@ -41,7 +41,8 @@ class _MatlabFinder(build_py):
41
41
  "24.1": "R2024a",
42
42
  "24.2": "R2024b",
43
43
  "25.1": "R2025a",
44
- "25.2": "R2025b"
44
+ "25.2": "R2025b",
45
+ "26.1": "R2026a"
45
46
  }
46
47
 
47
48
  DEFAULT_INSTALLS = {
@@ -104,6 +105,8 @@ class _MatlabFinder(build_py):
104
105
  self.arch = 'maci64'
105
106
  else:
106
107
  raise RuntimeError(self.unsupported_platform.format(platform=self.platform))
108
+
109
+ self._print_if_verbose(f'{self.platform=}; {self.path_env_var_name=}; {self.arch=}')
107
110
 
108
111
  def set_python_version(self):
109
112
  """
@@ -114,12 +117,16 @@ class _MatlabFinder(build_py):
114
117
 
115
118
  if self.python_ver not in self.SUPPORTED_PYTHON_VERSIONS:
116
119
  raise RuntimeError(self.unsupported_python.format(python=self.python_ver, supported=str(self.SUPPORTED_PYTHON_VERSIONS)))
120
+
121
+ self._print_if_verbose(f'{self.python_ver=}')
117
122
 
118
123
  def unix_default_install_exists(self):
119
124
  """
120
125
  Determines whether MATLAB is installed in default UNIX location.
121
126
  """
122
127
  path = self.DEFAULT_INSTALLS[self.platform]
128
+ self._print_if_verbose(f'From unix_default_install_exists: {self.platform=}; {path=}')
129
+ self._print_if_verbose(f'{os.path.exists(path)=}')
123
130
  if not os.path.exists(path):
124
131
  return False
125
132
 
@@ -127,6 +134,8 @@ class _MatlabFinder(build_py):
127
134
  # On Mac, we need to further verify that there is a 'bin/maci64' subdir if the Python is maci64
128
135
  # or a 'bin/maca64' subdir if the Python is maca64.
129
136
  path_to_bin = os.path.join(path, 'bin', self.arch)
137
+ self._print_if_verbose(f'From unix_default_install_exists: {path_to_bin=}')
138
+ self._print_if_verbose(f'{os.path.exists(path_to_bin)=}')
130
139
  if os.path.exists(path_to_bin):
131
140
  # The path exists, and we don't need to do anything further.
132
141
  return True
@@ -143,6 +152,7 @@ class _MatlabFinder(build_py):
143
152
  # location that has the wrong arch. The user can choose whether to change the
144
153
  # Python interpreter or the MATLAB installation so that the arch will match.
145
154
  self.found_matlab_with_wrong_arch_in_default_install = path
155
+ self._print_if_verbose(f'{self.found_matlab_with_wrong_arch_in_default_install}')
146
156
  return False
147
157
 
148
158
  return True
@@ -156,6 +166,7 @@ class _MatlabFinder(build_py):
156
166
  if self.path_env_var_name in os.environ:
157
167
  path_string = os.environ[self.path_env_var_name]
158
168
  path_dirs.extend(path_string.split(os.pathsep))
169
+ self._print_if_verbose(f'{path_dirs=}')
159
170
 
160
171
  if not path_dirs:
161
172
  raise RuntimeError(self.install_or_set_path.format(
@@ -284,6 +295,7 @@ class _MatlabFinder(build_py):
284
295
  raise RuntimeError(f"{self.invalid_version_from_matlab_ver.format(ver=matlab_ver)}")
285
296
  eng_major_minor = self._get_engine_ver_major_minor(self.MATLAB_VER)
286
297
  matlab_ver_major_minor = (matlab_ver_match.group(1), matlab_ver_match.group(2))
298
+ self._print_if_verbose(f'{matlab_ver_major_minor=}; {eng_major_minor=}')
287
299
  return (matlab_ver_major_minor == eng_major_minor)
288
300
 
289
301
  def verify_matlab_release(self, root):
@@ -305,6 +317,7 @@ class _MatlabFinder(build_py):
305
317
  elif child.tag == 'version':
306
318
  major, minor = self._get_engine_ver_major_minor(child.text)
307
319
  self.found_matlab_version = f'{major}.{minor}'
320
+ self._print_if_verbose(f'{matlab_release=}; {self.MATLAB_REL=}')
308
321
  return matlab_release == self.MATLAB_REL
309
322
 
310
323
  def search_path_for_directory_unix(self, arch, path_dirs):
@@ -373,6 +386,7 @@ class _MatlabFinder(build_py):
373
386
  root_file.write(bin_arch + '\n')
374
387
  root_file.write(engine_arch + '\n')
375
388
  root_file.write(extern_bin)
389
+ self._print_if_verbose(f'{file_location=}; {bin_arch=}; {engine_arch=}; {extern_bin=}')
376
390
 
377
391
  def run(self):
378
392
  """
@@ -419,7 +433,7 @@ if __name__ == '__main__':
419
433
  setup(
420
434
  name="matlabengine",
421
435
  # MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string)
422
- version="25.2.2",
436
+ version="26.1.12",
423
437
  description='A module to call MATLAB from Python',
424
438
  author='MathWorks',
425
439
  license="LICENSE.txt, located in this repository",
@@ -447,8 +461,9 @@ if __name__ == '__main__':
447
461
  "Programming Language :: Python :: 3.9",
448
462
  "Programming Language :: Python :: 3.10",
449
463
  "Programming Language :: Python :: 3.11",
450
- "Programming Language :: Python :: 3.12"
464
+ "Programming Language :: Python :: 3.12",
465
+ "Programming Language :: Python :: 3.13"
451
466
  ],
452
467
  # MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string)
453
- python_requires=">=3.9, <3.13"
468
+ python_requires=">=3.9, <3.14"
454
469
  )
@@ -0,0 +1,263 @@
1
+ # Copyright 2021-2025 MathWorks, Inc.
2
+ """
3
+ Array interface between Python and MATLAB
4
+
5
+ This package defines classes and exceptions that create and manage
6
+ multidimensional arrays in Python that are passed between Python and MATLAB.
7
+
8
+ Modules
9
+ -------
10
+ * mcpyarray - type-specific multidimensional array classes for working
11
+ with MATLAB, implemented in C++
12
+ """
13
+
14
+ import os
15
+ import platform
16
+ import sys
17
+ import warnings
18
+ from pkgutil import extend_path
19
+ __path__ = extend_path(__path__, '__name__')
20
+
21
+ _package_folder = os.path.dirname(os.path.realpath(__file__))
22
+ sys.path.append(_package_folder)
23
+
24
+ # This code allows us to put the proper extern/bin/<arch> directory on the Python path
25
+ # to avoid a situation in which some shared libraries are loaded from a MATLAB while
26
+ # others are loaded from a runtime. The first directory on the path that contains
27
+ # the string "bin/<arch>" (with the proper directory separator)
28
+ # will be checked. If it is "extern/bin/<arch>", it will be used as the
29
+ # extern/bin/<arch> directory. Otherwise, we'll go up two directories and down
30
+ # to extern/bin/<arch>.
31
+ class _MiniPathInitializer(object):
32
+ PLATFORM_DICT = {'Windows': 'PATH', 'Linux': 'LD_LIBRARY_PATH', 'Darwin': 'DYLD_LIBRARY_PATH'}
33
+
34
+ def __init__(self):
35
+ self.arch = ''
36
+ self.extern_bin_dir = ''
37
+ self.path_var = ''
38
+ self.system = ''
39
+
40
+ def get_platform_info(self):
41
+ """Ask Python for the platform and architecture."""
42
+ # This will return 'Windows', 'Linux', or 'Darwin' (for Mac).
43
+ self.system = platform.system()
44
+ if not self.system in _MiniPathInitializer.PLATFORM_DICT:
45
+ raise RuntimeError('{0} is not a supported platform.'.format(self.system))
46
+ else:
47
+ # path_var is the OS-dependent name of the path variable ('PATH', 'LD_LIBRARY_PATH', "DYLD_LIBRARY_PATH')
48
+ self.path_var = _MiniPathInitializer.PLATFORM_DICT[self.system]
49
+
50
+ if self.system == 'Windows':
51
+ self.arch = 'win64'
52
+ elif self.system == 'Linux':
53
+ self.arch = 'glnxa64'
54
+ elif self.system == 'Darwin':
55
+ # determine ARM or Intel Mac machine
56
+ if platform.mac_ver()[-1] == 'arm64':
57
+ self.arch = 'maca64'
58
+ else:
59
+ self.arch = 'maci64'
60
+ else:
61
+ raise RuntimeError('Operating system {0} is not supported.'.format(self.system))
62
+
63
+ def get_extern_bin_from_path_element_ending_with_runtime_arch(self, dir_found):
64
+ extern_bin_dir = ''
65
+ path_components = dir_found.split(os.sep)
66
+
67
+ if path_components[-1]:
68
+ last_path_component = path_components[-1]
69
+ possible_extern = -3
70
+ else:
71
+ # The directory name ended with a slash, so the last item in the list was an empty string. Go back one more.
72
+ last_path_component = path_components[-2]
73
+ possible_extern = -4
74
+
75
+ if last_path_component != self.arch:
76
+ output_str = ''.join(('To call deployed MATLAB code on a {0} machine, you must run a {0} version of Python, ',
77
+ 'and your {1} variable must contain an element pointing to "<MR>{2}runtime{2}{0}", ',
78
+ 'where "<MR>" indicates a MATLAB or MATLAB Runtime root. ',
79
+ 'Instead, the value found was as follows: {3}'))
80
+ raise RuntimeError(output_str.format(self.arch, self.path_var, os.sep, dir_found))
81
+
82
+ if (len(path_components) + possible_extern) >= 0 and path_components[possible_extern] == 'extern':
83
+ extern_bin_dir = dir_found
84
+ else:
85
+ mroot = os.path.dirname(os.path.dirname(os.path.normpath(dir_found)))
86
+ extern_bin_dir = os.path.join(mroot, 'extern', 'bin', self.arch)
87
+
88
+ return extern_bin_dir
89
+
90
+ def get_extern_bin_from_py_sys_path(self):
91
+ #Retrieve Python sys.path as a single string, and search for the substring "extern/bin/<arch>" (with
92
+ #the proper directory separator). If it's already present, assume it's the one we want.
93
+ substr_to_find = os.path.join('extern', 'bin', self.arch)
94
+ for item in sys.path:
95
+ if item.find(substr_to_find) != -1:
96
+ return item
97
+ return ''
98
+
99
+ def put_extern_bin_on_py_sys_path(self):
100
+ """
101
+ Look through the system path for the first directory ending with "runtime/<arch>" or
102
+ "bin/<arch>" (with/without trailing slash). Use this to construct a new path ending
103
+ with "extern/bin/<arch>".
104
+ """
105
+
106
+ path_elements = []
107
+ path_elements_orig = ''
108
+ if self.path_var in os.environ:
109
+ path_elements_orig = os.environ[self.path_var]
110
+ # On Windows, some elements of the path may use forward slashes while others use backslashes.
111
+ # Make them all backslashes.
112
+ if self.system == 'Windows':
113
+ path_elements_orig = path_elements_orig.replace('/', '\\')
114
+ path_elements = path_elements_orig.split(os.pathsep)
115
+ if not path_elements:
116
+ if self.system == 'Darwin':
117
+ raise RuntimeError('On the Mac, you must run mwpython rather than python ' +
118
+ 'to start a session or script that imports your package. ' +
119
+ 'For more details, execute "mwpython -help" or see the package documentation.')
120
+ else:
121
+ raise RuntimeError('On {0}, you must set the environment variable "{1}" to a non-empty string. {2}'.format(
122
+ self.system, self.path_var,
123
+ 'For more details, see the package documentation.'))
124
+
125
+ dir_to_search = os.path.join('runtime', self.arch)
126
+ trailing_substrings_to_find = [dir_to_search, dir_to_search + os.sep]
127
+
128
+ # First, look for a path ending with "runtime/<arch>". If found, use it
129
+ # to find a path ending with "extern/bin/<arch>".
130
+ extern_bin_dir = ''
131
+ for elem in path_elements:
132
+ for trailing_substring in trailing_substrings_to_find:
133
+ if elem.endswith(trailing_substring):
134
+ extern_bin_dir = self.get_extern_bin_from_path_element_ending_with_runtime_arch(elem)
135
+ if extern_bin_dir:
136
+ break
137
+
138
+ if not extern_bin_dir:
139
+ # Look for a path ending with "extern/bin/<arch>".
140
+ dir_to_search = os.path.join('extern', 'bin', self.arch)
141
+ trailing_substrings_to_find = [dir_to_search, dir_to_search + os.sep]
142
+
143
+ extern_bin_dir = ''
144
+ for elem in path_elements:
145
+ for trailing_substring in trailing_substrings_to_find:
146
+ if elem.endswith(trailing_substring):
147
+ extern_bin_dir = elem
148
+ if extern_bin_dir:
149
+ break
150
+
151
+ if not extern_bin_dir:
152
+ format_str = 'Could not find an appropriate directory in {0} from which to read binaries. Details::\n{1}'
153
+ raise RuntimeError(format_str.format(self.path_var, path_elements_orig))
154
+
155
+ if not os.path.isdir(extern_bin_dir):
156
+ raise RuntimeError('Could not find the directory {0}'.format(extern_bin_dir))
157
+ self.extern_bin_dir = extern_bin_dir
158
+ sys.path.insert(0, self.extern_bin_dir)
159
+
160
+ def get_python_version():
161
+ # UPDATE_IF_PYTHON_VERSION_ADDED_OR_REMOVED : search for this string in codebase
162
+ # when support for a Python version must be added or removed
163
+ _supported_versions = ['3_9', '3_10', '3_11', '3_12', '3_13']
164
+ _ver = sys.version_info
165
+ _version = '{0}_{1}'.format(_ver[0], _ver[1])
166
+ newer_than_supported = _ver[1] > 12
167
+
168
+ _PYTHONVERSION = None
169
+
170
+ if _version in _supported_versions:
171
+ _PYTHONVERSION = _version
172
+ elif newer_than_supported:
173
+ warnings.warn('Python versions 3.9, 3.10, 3.11, 3.12, and 3.13 are supported, but your version of Python is %s' % _version)
174
+ _PYTHONVERSION = _version
175
+ else:
176
+ raise EnvironmentError("Python %s is not supported." % _version)
177
+
178
+ return _PYTHONVERSION
179
+
180
+ def get_arch_filename():
181
+ _module_folder = os.path.dirname(os.path.realpath(__file__))
182
+ _arch_filename = os.path.join(_module_folder, 'engine', '_arch.txt')
183
+ return _arch_filename
184
+
185
+ def add_dll_dir_on_win(arch, dir_to_add):
186
+ if arch == 'win64':
187
+ if not dir_to_add:
188
+ raise RuntimeError('Cannot add empty DLL directory')
189
+ os.add_dll_directory(dir_to_add)
190
+
191
+ # For the case of Windows, we also need to add the bin/win64 folder to the PATH
192
+ if 'PATH' in os.environ:
193
+ _env = os.environ['PATH']
194
+ os.environ['PATH'] = dir_to_add + os.pathsep + _env
195
+ else:
196
+ os.environ['PATH'] = dir_to_add
197
+
198
+ def get_dirs_from_arch_file_without_import():
199
+ _PYTHONVERSION = get_python_version()
200
+ _arch_filename = get_arch_filename()
201
+ firstExceptionMessage = ''
202
+ if not os.path.isfile(_arch_filename):
203
+ return False
204
+
205
+ try:
206
+ _arch_file = open(_arch_filename,'r')
207
+ _lines = _arch_file.readlines()
208
+ [_arch, _bin_dir,_engine_dir, _extern_bin_dir] = [x.rstrip() for x in _lines if x.rstrip() != ""]
209
+ _arch_file.close()
210
+ sys.path.insert(0,_engine_dir)
211
+ sys.path.insert(0,_extern_bin_dir)
212
+ add_dll_dir_on_win(_arch, _bin_dir)
213
+ except Exception as exc:
214
+ firstExceptionMessage = 'Please contact MathWorks Technical Support for assistance:\nDetails: {}'.format(
215
+ exc)
216
+
217
+ if firstExceptionMessage:
218
+ return False
219
+ else:
220
+ return True
221
+
222
+ def subdir_exists(folder_name, subfolder_name):
223
+ return os.path.exists(os.path.join(folder_name, subfolder_name))
224
+
225
+
226
+ _mpi = _MiniPathInitializer()
227
+ _mpi.get_platform_info()
228
+ extern_bin_dir = ''
229
+ if subdir_exists(_package_folder, 'engine'):
230
+ success = get_dirs_from_arch_file_without_import()
231
+ if not success:
232
+ # Use the location of this file (already stored in _package_folder) to construct _bin_dir, _engine_dir, and _extern_bin_dir,
233
+ # so that they are added to the Python sys.path and the OS path environment variable as necessary.
234
+
235
+ #Use _package_folder <matlabroot>\extern\engines\python\dist\matlab to derive <matlabroot>\bin\win64
236
+ #<matlabroot>\extern\engines\python\dist\matlab\..\..\..\..\..\bin\win64
237
+ _bin_dir = os.path.join(_package_folder, '..', '..', '..', '..' ,'..', 'bin', _mpi.arch)
238
+
239
+ if os.path.exists(_bin_dir):
240
+ add_dll_dir_on_win(_mpi.arch, _bin_dir)
241
+
242
+ #Use _package_folder <matlabroot>\extern\engines\python\dist\matlab to derive <matlabroot>\extern\engines\python\dist\matlab\engine\win64
243
+ _engine_dir = os.path.join(_package_folder, 'engine', _mpi.arch)
244
+ sys.path.insert(0,_engine_dir)
245
+
246
+ #Use _bin_dir <matlabroot>\bin\win64 to derive <matlabroot>\extern\bin\win64
247
+ _extern_bin_dir = os.path.join(_bin_dir, '..', '..', 'extern', 'bin', _mpi.arch)
248
+ sys.path.insert(0,_extern_bin_dir)
249
+ else:
250
+ raise RuntimeError('unable to read {}'.format(get_arch_filename()))
251
+ else:
252
+ extern_bin_dir = _mpi.get_extern_bin_from_py_sys_path()
253
+ if not extern_bin_dir:
254
+ _mpi.put_extern_bin_on_py_sys_path()
255
+ extern_bin_dir = _mpi.extern_bin_dir
256
+
257
+ bin_dir = extern_bin_dir.replace('extern' + os.sep + 'bin', 'bin')
258
+ add_dll_dir_on_win(_mpi.arch, bin_dir)
259
+
260
+
261
+ from matlabmultidimarrayforpython import double, single, uint8, int8, uint16, \
262
+ int16, uint32, int32, uint64, int64, logical, ShapeError, SizeError
263
+
@@ -1,4 +1,4 @@
1
- #Copyright 2014-2024 MathWorks, Inc.
1
+ #Copyright 2014-2025 MathWorks, Inc.
2
2
 
3
3
  """
4
4
  The MATLAB Engine enables you to call any MATLAB statement either synchronously
@@ -30,10 +30,10 @@ import warnings
30
30
  # UPDATE_IF_PYTHON_VERSION_ADDED_OR_REMOVED : search for this string in codebase
31
31
  # when support for a Python version must be added or removed
32
32
 
33
- _supported_versions = ['3_9', '3_10', '3_11', '3_12']
33
+ _supported_versions = ['3_9', '3_10', '3_11', '3_12', '3_13']
34
34
  _ver = sys.version_info
35
35
  _version = '{0}_{1}'.format(_ver[0], _ver[1])
36
- _newer_than_supported = _ver[1] > 12
36
+ _newer_than_supported = _ver[1] > 13
37
37
 
38
38
  _PYTHONVERSION = None
39
39
 
@@ -41,12 +41,12 @@ if _version in _supported_versions:
41
41
  _PYTHONVERSION = _version
42
42
  elif _newer_than_supported:
43
43
  warnings.warn('MATLAB Engine for Python supports Python version'
44
- ' 3.9, 3.10, 3.11, and 3.12, but your version of Python '
44
+ ' 3.9, 3.10, 3.11, 3.12, and 3.13, but your version of Python '
45
45
  'is %s' % _version)
46
- _PYTHONVERSION = _version
46
+ _PYTHONVERSION = _version
47
47
  else:
48
48
  raise EnvironmentError('MATLAB Engine for Python supports Python version'
49
- ' 3.9, 3.10, 3.11, and 3.12, but your version of Python '
49
+ ' 3.9, 3.10, 3.11, 3.12, and 3.13, but your version of Python '
50
50
  'is %s' % _version)
51
51
 
52
52
 
@@ -1,4 +1,4 @@
1
- #Copyright 2014-2017 MathWorks, Inc.
1
+ #Copyright 2014-2025 MathWorks, Inc.
2
2
 
3
3
  """
4
4
  MatlabEngine: The class name of MATLAB Engine. You can call MATLAB software as
@@ -126,11 +126,15 @@ class MatlabWorkSpace(object):
126
126
 
127
127
  _method=MatlabFunc(self._engine(), "assignin")
128
128
  return _method("base", attr, value, nargout=0)
129
-
129
+
130
+ def __str__(self):
131
+ return self.__repr__()
132
+
130
133
  def __repr__(self):
131
- _method = MatlabFunc(self._engine(), "whos")
132
- _method(nargout=0)
133
- return ""
134
+ # 'evalc' evaluates a MATLAB expression, redirecting stdout to a variable.
135
+ # Here, we use it to redirect the stdout of 'whos' to a string.
136
+ _evalcMethodHandle = MatlabFunc(self._engine(), "evalc")
137
+ return _evalcMethodHandle('whos')
134
138
 
135
139
  def __setattr__(self, kw, value):
136
140
  raise AttributeError(pythonengine.getMessage('AttrCannotBeAddedToMWS'))
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: matlabengine
3
- Version: 25.2.2
3
+ Version: 26.1.12
4
4
  Summary: A module to call MATLAB from Python
5
5
  Home-page: https://github.com/mathworks/matlab-engine-for-python/
6
6
  Author: MathWorks
@@ -9,16 +9,27 @@ Project-URL: Documentation, https://www.mathworks.com/help/matlab/matlab-engine-
9
9
  Project-URL: Source, https://github.com/mathworks/matlab-engine-for-python
10
10
  Project-URL: Tracker, https://github.com/mathworks/matlab-engine-for-python/issues
11
11
  Keywords: MATLAB,MATLAB Engine for Python
12
- Platform: UNKNOWN
13
12
  Classifier: Natural Language :: English
14
13
  Classifier: Intended Audience :: Developers
15
14
  Classifier: Programming Language :: Python :: 3.9
16
15
  Classifier: Programming Language :: Python :: 3.10
17
16
  Classifier: Programming Language :: Python :: 3.11
18
17
  Classifier: Programming Language :: Python :: 3.12
19
- Requires-Python: >=3.9, <3.13
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Requires-Python: >=3.9, <3.14
20
20
  Description-Content-Type: text/markdown
21
21
  License-File: LICENSE.txt
22
+ Dynamic: author
23
+ Dynamic: classifier
24
+ Dynamic: description
25
+ Dynamic: description-content-type
26
+ Dynamic: home-page
27
+ Dynamic: keywords
28
+ Dynamic: license
29
+ Dynamic: license-file
30
+ Dynamic: project-url
31
+ Dynamic: requires-python
32
+ Dynamic: summary
22
33
 
23
34
  # MATLAB Engine API for Python
24
35
 
@@ -28,11 +39,11 @@ The MATLAB&reg; Engine API for Python&reg; provides a package to integrate MATLA
28
39
  ## Requirements
29
40
  ### Required MathWorks Products
30
41
  <!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
31
- * MATLAB release R2025b
42
+ * MATLAB release R2026a
32
43
 
33
44
  ### Required 3rd Party Products
34
45
  <!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
35
- * Python 3.9, 3.10, 3.11, or 3.12
46
+ * Python 3.9, 3.10, 3.11, 3.12, or 3.13
36
47
  * Supported Python versions by MATLAB release can be found [here](https://www.mathworks.com/support/requirements/python-compatibility.html).
37
48
 
38
49
  ---
@@ -43,7 +54,7 @@ The MATLAB&reg; Engine API for Python&reg; provides a package to integrate MATLA
43
54
  MATLAB Engine API for Python can be installed directly from the Python Package Index.
44
55
  <!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
45
56
  ```bash
46
- $ python -m pip install matlabengine==25.2.2
57
+ $ python -m pip install matlabengine==26.1.12
47
58
  ```
48
59
 
49
60
 
@@ -51,7 +62,7 @@ $ python -m pip install matlabengine==25.2.2
51
62
  ### Linux&reg;
52
63
  Prior to installation, check the default install location of MATLAB by calling ```matlabroot``` in a MATLAB Command Window. By default, Linux installs MATLAB at:<br>
53
64
  <!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
54
- ```/usr/local/MATLAB/R2025b```
65
+ ```/usr/local/MATLAB/R2026a```
55
66
 
56
67
  When MATLAB is not installed in the default location, the bin/*architecture* directory within the MATLAB root directory must be added to the environment variable LD_LIBRARY_PATH. The path can be added to the environment variable within the shell startup configuration file (for example, .bashrc for bash shell or .tcshrc for tcsh).
57
68
 
@@ -68,14 +79,14 @@ setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:<matlabroot>/bin/glnxa64
68
79
  MATLAB Engine API for Python can be installed directly from the Python Package Index.
69
80
  <!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
70
81
  ```bash
71
- $ python -m pip install matlabengine==25.2.2
82
+ $ python -m pip install matlabengine==26.1.12
72
83
  ```
73
84
 
74
85
  ### macOS
75
86
  Prior to installation, check the default install location of MATLAB by calling ```matlabroot``` in a MATLAB Command Window. By default, macOS installs MATLAB at:<br>
76
87
 
77
88
  <!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
78
- ```/Applications/MATLAB_R2025b.app```
89
+ ```/Applications/MATLAB_R2026a.app```
79
90
 
80
91
  When MATLAB is not installed in the default location, the bin/*architecture* directory within the MATLAB root directory must be added to the environment variable DYLD_LIBRARY_PATH. The path can be added to the environment variable within the shell startup configuration file (for example, .bashrc for bash shell or .tcshrc for tcsh).
81
92
 
@@ -92,7 +103,7 @@ setenv DYLD_LIBRARY_PATH ${DYLD_LIBRARY_PATH}:<matlabroot>/bin/maci64
92
103
  MATLAB Engine API for Python can be installed directly from the Python Package Index.
93
104
  <!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
94
105
  ```bash
95
- $ python -m pip install matlabengine==25.2.2
106
+ $ python -m pip install matlabengine==26.1.12
96
107
  ```
97
108
 
98
109
  ---
@@ -160,5 +171,3 @@ Linux&reg; is the registered trademark of Linus Torvalds in the U.S. and other c
160
171
  Mac OS is a trademark of Apple Inc., registered in the U.S. and other countries.
161
172
 
162
173
  "Python" and the Python logos are trademarks or registered trademarks of the Python Software Foundation, used by MathWorks with permission from the Foundation.
163
-
164
-
@@ -1,49 +0,0 @@
1
- # Copyright 2024 MathWorks, Inc.
2
-
3
- import os
4
- import platform
5
- import sys
6
- import pkgutil
7
-
8
- __path__ = pkgutil.extend_path(__path__, __name__)
9
- package_folder = os.path.dirname(os.path.realpath(__file__))
10
- sys.path.append(package_folder)
11
-
12
- def add_dirs_to_path(bin_dir, engine_dir, extern_dir):
13
- """
14
- Adds MATLAB engine and extern/bin directories to sys.path.
15
- """
16
- path = 'PATH'
17
-
18
- if not os.path.isdir(engine_dir):
19
- raise RuntimeError("Could not find directory: {0}".format(engine_dir))
20
-
21
- if not os.path.isdir(extern_dir):
22
- raise RuntimeError("Could not find directory: {0}".format(extern_dir))
23
-
24
- if platform.system() == 'Windows':
25
- if not os.path.isdir(bin_dir):
26
- raise RuntimeError("Could not find directory: {0}".format(bin_dir))
27
- if path in os.environ:
28
- paths = os.environ[path]
29
- os.environ[path] = bin_dir + os.pathsep + paths
30
- else:
31
- os.environ[path] = bin_dir
32
- if sys.version_info.major >= 3 and sys.version_info.minor >= 8:
33
- os.add_dll_directory(bin_dir)
34
-
35
- sys.path.insert(0, engine_dir)
36
- sys.path.insert(0, extern_dir)
37
-
38
- arch_file = os.path.join(package_folder, 'engine', '_arch.txt')
39
- if not os.path.isfile(arch_file):
40
- raise RuntimeError("The MATLAB Engine for Python install is corrupted. Please try to re-install.")
41
-
42
- with open(arch_file, 'r') as root:
43
- [arch, bin_folder, engine_folder, extern_bin] = [line.strip() for line in root.readlines()]
44
-
45
-
46
- add_dirs_to_path(bin_folder, engine_folder, extern_bin)
47
-
48
- from matlabmultidimarrayforpython import double, single, uint8, int8, uint16, \
49
- int16, uint32, int32, uint64, int64, logical, ShapeError, SizeError
File without changes