Main Content

Python Package Integration

Integrate compiled MATLAB® functions into Python® applications

MATLAB Compiler SDK™ provides Python methods to initialize MATLAB Runtime, invoke compiled MATLAB functions, and manage data that is passed between the Python code and MATLAB Runtime.

For a list of compatible Python versions, see MATLAB Supported Interfaces to Other Languages.

You cannot package MATLAB code that calls Python from MATLAB unless it is called in out-of-process mode.

Functions

expand all

compiler.build.pythonPackageCreate Python package for deployment outside MATLAB (Since R2021a)
compiler.build.PythonPackageOptionsOptions for building Python packages (Since R2021a)
compiler.build.ResultsCompiler build results object (Since R2020b)
compiler.package.installerCreate an installer for files generated by MATLAB Compiler (Since R2020a)
compiler.package.InstallerOptionsOptions for creating MATLAB Compiler package installers (Since R2020a)
myDeployedModule.initializePython module to initialize package and return a handle
myDeployedModule.initialize_runtimePython module to initialize MATLAB Runtime with a list of startup options
myDeployedModule.wait_for_figures_to_closePython module to wait for all graphical figures to close before continuing
myDeployedModule.terminatePython module to close a package
mwpythonStart a Python session using a MATLAB Compiler SDK Python package on macOS

Topics

Requirements and Highlights

Create and Integrate with Python

Sample Applications

Data Conversion