Skip to content

MPython-Package-Factory/mpython-core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MPython logo.

MPython Core

PyPI - Python Version PyPI - License PyPI - Version

MPython Core provides Python bindings for MATLAB projects, enabling seamless integration of MATLAB functionalities into Python workflows. This package is designed to facilitate the creation of bindings for MATLAB projects, allowing users to interact with MATLAB objects, functions, and arrays directly from Python.

Features

  • MATLAB Integration: Interact with MATLAB objects, functions, and arrays directly from Python.
  • Custom Data Types: Includes Python representations of MATLAB data types such as Cell, Struct, Array, and SparseArray.
  • Delayed Arrays: Support for delayed evaluation of MATLAB arrays.
  • Sparse Matrix Support: Handles MATLAB sparse matrices using scipy.sparse (if available).
  • Object-Oriented Design: Provides a clean and extensible API for working with MATLAB projects.

Installation

To install MPython-Core, use pip:

pip install mpython-core

Requirements

  • Python 3.9 - 3.13
  • MATLAB Runtime (if MATLAB is not installed)
  • NumPy
  • Optional: SciPy (for sparse matrix support)

Usage

Example: Working with MATLAB Data Types

from mpython import Cell, Struct, Array

# Create a MATLAB cell array
cell = Cell.from_any([[1, 2], [3, 4]])

# Create a MATLAB struct
struct = Struct(a=Array([1, 2, 3]), b="example")

# Access struct fields
print(struct.a)
print(struct["b"])

Development

Setting Up the Development Environment

  1. Clone the repository:

    git clone https://github.com/MPython-Package-Factory/mpython-core.git
    cd mpython-core
  2. Create a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install dependencies:

    pip install -r requirements.txt

Running Tests

To run the test suite:

pytest

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bugfix.
  3. Submit a pull request with a clear description of your changes.

License

This project is licensed under the GNU General Public License v2 (GPLv2).

Authors

Links

About

Core Python elements for wrapped MPython packages

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages