modelx-cython: Cythonize modelx models#

modelx-cython is a Python package that translates modelx models exported as pure-Python packages into Cython packages and compiles them into native extension modules, so that the models run faster and use less memory.

Warning

modelx-cython is currently highly experimental and is released only for early adopters with advanced software engineering skills to explore its capability.

modelx Ecosystem

modelx-cython installs the mx2cy command. Given a model exported by modelx’s Model.export method, mx2cy runs a user-supplied sample script to observe the types that flow through the model, rewrites the model’s source code with Cython type annotations, and compiles the result into a new package that can be imported in place of the original.

$ mx2cy Model_nomx

Documentation contents#

See also#

License#

Copyright 2023-2026, Fumito Hamamura

modelx-cython is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License v3 (LGPLv3).

Portions of modelx-cython are derived from MonkeyType, which is distributed under a BSD-style license.