modelx-cython


Namemodelx-cython JSON
Version 0.0.7 PyPI version JSON
download
home_pageNone
SummaryCythonize modelx models.
upload_time2025-09-04 15:14:47
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseLGPLv3
keywords finance quants actuary
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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.

[modelx]:(https://github.com/fumitoh/modelx)

## What is modelx-cython?

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

![modelx Ecosystem](https://raw.githubusercontent.com/fumitoh/modelx-cython/main/doc/source/images/modelx-ecosystem.png)

## 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.

```python
>>> 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

* [modelx GitHub Repository](https://github.com/fumitoh/modelx)
* [modelx Documentation](https://docs.modelx.io)
* [modelx Blog](https://modelx.io/allposts)

## 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)](https://github.com/fumitoh/modelx-cython/blob/master/LICENSE.txt).


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "modelx-cython",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "finance, quants, actuary",
    "author": null,
    "author_email": "Fumito Hamamura <fumito.ham@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/c2/de/265e69ad7e5a20fa8c801ddb5d22e7d533260220d1e1152c7fe6dd73ae7c/modelx_cython-0.0.7.tar.gz",
    "platform": null,
    "description": "# modelx-cython: Cythonize modelx models\n\n**Important:**\nmodelx-cython is currently highly experimental and is released only for early adopters with advanced software engineering skills to explore its capability.\n\n[modelx]:(https://github.com/fumitoh/modelx)\n\n## What is modelx-cython?\n\nmodelx-cython is a Python package for cythonizing exported [modelx] models.\n\n![modelx Ecosystem](https://raw.githubusercontent.com/fumitoh/modelx-cython/main/doc/source/images/modelx-ecosystem.png)\n\n## Usage\n\nSuppose `model` in the code below is a modelx Model.\nThe code creates a pure-Python model of `model` as a Python package named \"Model_nomx\" in the current directory.\n\n```python\n>>> model.export(\"Model_nomx\")\n```\n\nYou need a config file and a sample file to translate the model to a Cythonized model and compile it. \nCreate and name them `config.py` and `sample.py` respectively, and place them in the directory where *Model_nomx* is located.\n\nUpon installing modelx-cython, the `mx2cy` command becomes available as an executable command.\nIn a Python-enabled command prompt or shell, change the current directory with `cd` to where *Model_nomx* is located, and run:\n\n```\nmx2cy Model_nomx\n```\n\nThis will create a Python package named \"Model_nomx_cy\", next to the original \"Model_nomx\".\n\n## Command\n\n```\nusage: mx2cy [-h] [--sample SAMPLE] [--spec SPEC | --no-spec] [--setup SETUP] [--translate-only | --compile-only]\n             [--log-level LOG_LEVEL]\n             model_path\n\nTranslate an exported modelx model into Cython and compile it.\n\npositional arguments:\n  model_path            Path to an exported modelx model to translate into Cython\n\noptions:\n  -h, --help            show this help message and exit\n  --sample SAMPLE       Path to a sample file to run for collecting type information (default: sample.py)\n  --spec SPEC           Path to a spec file for setting parameters (default: spec.py)\n  --no-spec             Skip the spec file (default: False)\n  --setup SETUP         Path to a setup file for Cython (default: setup.py)\n  --translate-only      Perform translation only (default: False)\n  --compile-only        Perform compilation only (default: False)\n  --log-level LOG_LEVEL\n                        Logging level: NOTSET(0), DEBUG(10), INFO(20), WARNING(30), ERROR(40), CRITICAL(50) (default:\n                        WARNING)\n```\n\n## See Also\n\n* [modelx GitHub Repository](https://github.com/fumitoh/modelx)\n* [modelx Documentation](https://docs.modelx.io)\n* [modelx Blog](https://modelx.io/allposts)\n\n## How to Install\n\nTo install modelx-cython, run the following command from your command prompt:\n\n```\npip install modelx-cython\n```\n\nIf you're on Anaconda, instead above install it from conda-forge:\n\n```\nconda install -c conda-forge modelx-cython\n```\n\n## Requirements\n\nmodelx-cython requires Python 3.7+.\n\n- modelx v0.23.0+\n- Cython v3.0.0+\n- setuptools\n- libcst\n- MonkeyType\n\n## License\n\nCopyright 2023-2025, Fumito Hamamura\n\nmodelx is free software; you can redistribute it and/or\nmodify it under the terms of\n[GNU Lesser General Public License v3 (LGPLv3)](https://github.com/fumitoh/modelx-cython/blob/master/LICENSE.txt).\n\n",
    "bugtrack_url": null,
    "license": "LGPLv3",
    "summary": "Cythonize modelx models.",
    "version": "0.0.7",
    "project_urls": {
        "Documentation": "https://docs.modelx.io",
        "Homepage": "https://modelx.io",
        "Repository": "https://github.com/fumitoh/modelx-cython.git"
    },
    "split_keywords": [
        "finance",
        " quants",
        " actuary"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "060bff4e16a932dd398a9f789d17f4110b0335edfcf9e4c37a4738feebe91b3f",
                "md5": "5480477a7a1d1a475e86d9c311d27ab1",
                "sha256": "9eddb0510497a141eb6f2bab50637ed7e54f6949ae1dad1b7729b1224d0682ff"
            },
            "downloads": -1,
            "filename": "modelx_cython-0.0.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5480477a7a1d1a475e86d9c311d27ab1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 44018,
            "upload_time": "2025-09-04T15:14:46",
            "upload_time_iso_8601": "2025-09-04T15:14:46.415952Z",
            "url": "https://files.pythonhosted.org/packages/06/0b/ff4e16a932dd398a9f789d17f4110b0335edfcf9e4c37a4738feebe91b3f/modelx_cython-0.0.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c2de265e69ad7e5a20fa8c801ddb5d22e7d533260220d1e1152c7fe6dd73ae7c",
                "md5": "ebc51efe54bd69f9412f05859b6a13cd",
                "sha256": "be4a9e358c725c31169fe9a57ae94ed87bd70343622487f6c9976a4e6ba0b249"
            },
            "downloads": -1,
            "filename": "modelx_cython-0.0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "ebc51efe54bd69f9412f05859b6a13cd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 36924,
            "upload_time": "2025-09-04T15:14:47",
            "upload_time_iso_8601": "2025-09-04T15:14:47.865578Z",
            "url": "https://files.pythonhosted.org/packages/c2/de/265e69ad7e5a20fa8c801ddb5d22e7d533260220d1e1152c7fe6dd73ae7c/modelx_cython-0.0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-04 15:14:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "fumitoh",
    "github_project": "modelx-cython",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "modelx-cython"
}
        
Elapsed time: 2.54148s