This repo is a simple example of wrapping Matlab projects in Python using Matlab Compiler and MPython
This requires Matlab Compiler, as well as a version of Matlab Runtime compatible with your version of Matlab.
1. Clone mpython-template.
git clone git@github.com:MPython-Package-Factory/mpython-template.git YOUR_PROJECT_NAME
cd YOUR_PROJECT_NAME
2. Edit mpython/wrap_project.py...
...to target the right project URL and configure the name of the Python package
python_package_name = 'example_project';
matlab_project_url = 'https://github.com/MPython-Package-Factory/example-project-matlab.git';
cd .mpython # Move to .mpython
matlab -batch "wrap_project" # Create the Python wrapper
cd .. # Move back to the main folder
python3 -m pip install -e . # Install the package in developper mode
python3 -c "import example_project"
MPython will generate Python code using certain templates for common code structures (e.g., function signature or class definition).
A full list of the existing templates can be found in mpython/templates.
You can customize these defaults templates by copying them to your .mpython/templates and editing them (as for this custom docstring template).