Skip to main content

modelx-cython: Cythonize modelx models

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

What is modelx-cython?

modelx-cython is a Python package for cythonizing exported modelx models.

modelx Ecosystem

Usage

Suppose model in the code below is a modelx Model. The code creates a pure-Python model of model as a Python package named "Model_nomx" in the current directory.

>>> model.export("Model_nomx")

You need a config file and a sample file to translate the model to a Cythonized model and compile it. Create and name them config.py and sample.py respectively, and place them in the directory where Model_nomx is located.

Upon installing modelx-cython, the mx2cy command becomes available as an executable command. In a Python-enabled command prompt or shell, change the current directory with cd to where Model_nomx is located, and run:

mx2cy Model_nomx

This will create a Python package named "Model_nomx_cy", next to the original "Model_nomx".

Command

usage: mx2cy [-h] [--sample SAMPLE] [--spec SPEC | --no-spec] [--setup SETUP] [--translate-only | --compile-only]
             [--log-level LOG_LEVEL]
             model_path

Translate an exported modelx model into Cython and compile it.

positional arguments:
  model_path            Path to an exported modelx model to translate into Cython

options:
  -h, --help            show this help message and exit
  --sample SAMPLE       Path to a sample file to run for collecting type information (default: sample.py)
  --spec SPEC           Path to a spec file for setting parameters (default: spec.py)
  --no-spec             Skip the spec file (default: False)
  --setup SETUP         Path to a setup file for Cython (default: setup.py)
  --translate-only      Perform translation only (default: False)
  --compile-only        Perform compilation only (default: False)
  --log-level LOG_LEVEL
                        Logging level: NOTSET(0), DEBUG(10), INFO(20), WARNING(30), ERROR(40), CRITICAL(50) (default:
                        WARNING)

See Also

How to Install

To install modelx-cython, run the following command from your command prompt:

pip install modelx-cython

If you're on Anaconda, instead above install it from conda-forge:

conda install -c conda-forge modelx-cython

Requirements

modelx-cython requires Python 3.7+.

  • modelx v0.23.0+
  • Cython v3.0.0+
  • setuptools
  • libcst
  • MonkeyType

License

Copyright 2023-2025, Fumito Hamamura

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

modelx_cython-0.0.9.tar.gz (65.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

modelx_cython-0.0.9-py3-none-any.whl (74.1 kB view details)

Uploaded Python 3

File details

Details for the file modelx_cython-0.0.9.tar.gz.

File metadata

  • Download URL: modelx_cython-0.0.9.tar.gz
  • Upload date:
  • Size: 65.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for modelx_cython-0.0.9.tar.gz
Algorithm Hash digest
SHA256 d75dfef2b9f6196e11f6b9714392ab085128dba15ddae4e54dc6e61eaf5f9aec
MD5 31190c134ac7f27892d4eac981f8a4ef
BLAKE2b-256 855dea39de71ab6441c2d12b981cca10399a7988ac8a22c68070f5838e821ef1

See more details on using hashes here.

Provenance

The following attestation bundles were made for modelx_cython-0.0.9.tar.gz:

Publisher: publish-to-pypi.yml on fumitoh/modelx-cython

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file modelx_cython-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: modelx_cython-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 74.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for modelx_cython-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 6e01415a4fc0952080c5db6f06fdd3ec5d4abfbb5fec21869e3ecae29076a499
MD5 da1275eb57e1a23202539dda5e103fe9
BLAKE2b-256 b9280f42bb7c4b646c522fd156f47cc27ddf01021d0b1dce58e54b9f55902edf

See more details on using hashes here.

Provenance

The following attestation bundles were made for modelx_cython-0.0.9-py3-none-any.whl:

Publisher: publish-to-pypi.yml on fumitoh/modelx-cython

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.0.9 This release

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page