modelx-cython


Namemodelx-cython JSON
Version 0.0.5 PyPI version JSON
download
home_pageNone
SummaryCythonize modelx models.
upload_time2025-01-12 06:24:23
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] [--setup SETUP] [--translate-only | --compile-only] 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)
  --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)
```

## 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, 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/0d/b9/1f3e148a81750d4093e03b2afc322199c8a35bf1e6311120841e9be2ab85/modelx_cython-0.0.5.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] [--setup SETUP] [--translate-only | --compile-only] 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  --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```\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, 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.5",
    "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": "",
            "digests": {
                "blake2b_256": "968c3c34a55209309ee38b13c0249bb5fa5f2d6861a859c4d387f415d094496e",
                "md5": "ca1bdbc5e953b492aef1608943306f94",
                "sha256": "0c866f0b5b80dd10e5c0d90d34c7f6d92c76f51b69c54f1a977785b39fddef2d"
            },
            "downloads": -1,
            "filename": "modelx_cython-0.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ca1bdbc5e953b492aef1608943306f94",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 38027,
            "upload_time": "2025-01-12T06:24:20",
            "upload_time_iso_8601": "2025-01-12T06:24:20.428386Z",
            "url": "https://files.pythonhosted.org/packages/96/8c/3c34a55209309ee38b13c0249bb5fa5f2d6861a859c4d387f415d094496e/modelx_cython-0.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0db91f3e148a81750d4093e03b2afc322199c8a35bf1e6311120841e9be2ab85",
                "md5": "241f929e6ca9fb3a34667b79eb07743b",
                "sha256": "f2f9e1a127381cd35b954f80e1112666e81766d5c8cdab99c6bb04d5db0d7084"
            },
            "downloads": -1,
            "filename": "modelx_cython-0.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "241f929e6ca9fb3a34667b79eb07743b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 33111,
            "upload_time": "2025-01-12T06:24:23",
            "upload_time_iso_8601": "2025-01-12T06:24:23.105197Z",
            "url": "https://files.pythonhosted.org/packages/0d/b9/1f3e148a81750d4093e03b2afc322199c8a35bf1e6311120841e9be2ab85/modelx_cython-0.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-12 06:24:23",
    "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: 0.40140s