# pymwp: MWP analysis in Python
[![build](https://github.com/statycc/pymwp/actions/workflows/build.yaml/badge.svg)](https://github.com/statycc/pymwp/actions/workflows/build.yaml)
[![codecov](https://codecov.io/gh/statycc/pymwp/branch/main/graph/badge.svg?token=4v3zRbkAjM)](https://codecov.io/gh/statycc/pymwp)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pymwp)](https://pypi.org/project/pymwp/)
[![PyPI](https://img.shields.io/pypi/v/pymwp)](https://pypi.org/project/pymwp/)
[![DOI](https://zenodo.org/badge/355822953.svg)](https://zenodo.org/badge/latestdoi/355822953)
<!--
do not remove start and end comments (e.g. "include-start", "include-end").
They are markers for what to include in the docs, but feel free to edit
the inner content.
-->
<!--desc-start-->
pymwp is a tool for automatically performing static analysis on programs written in C.
It is inspired by [_"A Flow Calculus of mwp-Bounds for Complexity Analysis"_](https://doi.org/10.1145/1555746.1555752).
It analyzes resource usage and determines if a program's variables growth rates are no more than polynomially related to their inputs sizes.
Try our online [demo](https://statycc.github.io/pymwp/demo/) to see it action.
For more details on usage and behavior, see pymwp [documentation](https://statycc.github.io/pymwp/), particularly [supported C language features](https://statycc.github.io/pymwp/features/).
<!--desc-end-->
## Documentation and Demo
Refer to **[statycc.github.io/pymwp](https://statycc.github.io/pymwp/)** for a documentation, an [online demo](https://statycc.github.io/pymwp/demo/), and a presentation of [examples](https://statycc.github.io/pymwp/examples/).
<!--include-start-->
## Installation
Install the latest release from PyPI
```
pip install pymwp
```
## How to Use
To analyze a C file, run:
```
pymwp path/to_some_file.c
```
For all available options and help, run:
```
pymwp --help
```
You can also use pymwp by importing it in a Python script:
```python
from pymwp import Polynomial
from pymwp.matrix import identity_matrix, show
matrix = identity_matrix(3)
matrix[0][1] = Polynomial('m')
matrix[1][0] = Polynomial('w')
matrix[2][1] = Polynomial('p')
show(matrix)
```
See [modules documentation](https://statycc.github.io/pymwp/analysis/) for available methods.
## Running from source
If you want to use the latest stable version (possibly ahead of
latest release), use the version from source following these steps.
1. Clone the repository
```
git clone https://github.com/statycc/pymwp.git
```
2. Set up Python environment (use [`venv`](https://docs.python.org/3/library/venv.html))
install required packages
```
python -m pip install -r requirements.txt
```
Note: for development purposes install dev dependencies instead:
```
python -m pip install -r requirements-dev.txt
```
3. Run the analysis
From project root run:
```
python -m pymwp path/to_some_file.c
```
for example:
```
python -m pymwp c_files/basics/if.c
```
for all available options and help, run:
```
python -m pymwp
```
<!--include-end-->
Raw data
{
"_id": null,
"home_page": "https://github.com/statycc/pymwp",
"name": "pymwp",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "",
"author": "Cl\u00e9ment Aubert, Thomas Rubiano, Neea Rusch, Thomas Seiller",
"author_email": "nrusch@augusta.edu",
"download_url": "https://files.pythonhosted.org/packages/e5/09/5bb1ca4eeec0a0c11fb69b1b46053799f362f1c42abcd01fa3edb5acba83/pymwp-0.4.2.tar.gz",
"platform": null,
"description": "# pymwp: MWP analysis in Python\n\n[![build](https://github.com/statycc/pymwp/actions/workflows/build.yaml/badge.svg)](https://github.com/statycc/pymwp/actions/workflows/build.yaml)\n[![codecov](https://codecov.io/gh/statycc/pymwp/branch/main/graph/badge.svg?token=4v3zRbkAjM)](https://codecov.io/gh/statycc/pymwp)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pymwp)](https://pypi.org/project/pymwp/)\n[![PyPI](https://img.shields.io/pypi/v/pymwp)](https://pypi.org/project/pymwp/)\n[![DOI](https://zenodo.org/badge/355822953.svg)](https://zenodo.org/badge/latestdoi/355822953)\n\n\n<!--\n do not remove start and end comments (e.g. \"include-start\", \"include-end\").\n They are markers for what to include in the docs, but feel free to edit \n the inner content.\n-->\n\n<!--desc-start-->\n\npymwp is a tool for automatically performing static analysis on programs written in C.\nIt is inspired by [_\"A Flow Calculus of mwp-Bounds for Complexity Analysis\"_](https://doi.org/10.1145/1555746.1555752).\nIt analyzes resource usage and determines if a program's variables growth rates are no more than polynomially related to their inputs sizes.\nTry our online [demo](https://statycc.github.io/pymwp/demo/) to see it action.\nFor more details on usage and behavior, see pymwp [documentation](https://statycc.github.io/pymwp/), particularly [supported C language features](https://statycc.github.io/pymwp/features/).\n\n<!--desc-end--> \n\n## Documentation and Demo\n\nRefer to **[statycc.github.io/pymwp](https://statycc.github.io/pymwp/)** for a documentation, an [online demo](https://statycc.github.io/pymwp/demo/), and a presentation of [examples](https://statycc.github.io/pymwp/examples/).\n\n<!--include-start-->\n\n## Installation\n\nInstall the latest release from PyPI\n\n```\npip install pymwp\n```\n\n## How to Use\n\nTo analyze a C file, run:\n\n```\npymwp path/to_some_file.c\n```\n\nFor all available options and help, run:\n\n```\npymwp --help\n```\n\n\nYou can also use pymwp by importing it in a Python script:\n\n```python\nfrom pymwp import Polynomial\nfrom pymwp.matrix import identity_matrix, show\n\nmatrix = identity_matrix(3)\nmatrix[0][1] = Polynomial('m')\nmatrix[1][0] = Polynomial('w')\nmatrix[2][1] = Polynomial('p')\n\nshow(matrix)\n```\n\nSee [modules documentation](https://statycc.github.io/pymwp/analysis/) for available methods.\n\n\n\n\n## Running from source\n\nIf you want to use the latest stable version (possibly ahead of \nlatest release), use the version from source following these steps.\n\n1. Clone the repository\n\n ```\n git clone https://github.com/statycc/pymwp.git\n ``` \n\n2. Set up Python environment (use [`venv`](https://docs.python.org/3/library/venv.html))\n\n install required packages\n\n ```\n python -m pip install -r requirements.txt\n ``` \n \n Note: for development purposes install dev dependencies instead: \n \n ```\n python -m pip install -r requirements-dev.txt\n ```\n\n3. Run the analysis\n\n From project root run:\n \n ```\n python -m pymwp path/to_some_file.c\n ```\n\n for example:\n \n ```\n python -m pymwp c_files/basics/if.c\n ```\n \n for all available options and help, run:\n \n ```\n python -m pymwp\n ```\n\n<!--include-end--> \n\n\n",
"bugtrack_url": null,
"license": "GPLv3",
"summary": "Implementation of MWP analysis on C code in Python.",
"version": "0.4.2",
"project_urls": {
"Archive": "https://doi.org/10.5281/zenodo.7879822",
"Bug Tracker": "https://github.com/statycc/pymwp/issues",
"Documentation": "https://statycc.github.io/pymwp/",
"Homepage": "https://github.com/statycc/pymwp",
"Source Code": "https://github.com/statycc/pymwp"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "17725abdf6e7ff25b0eae398d4eeaa143fb86cac769070acc893ea6e2eee8711",
"md5": "d9f8a402a3515eb7f403a8ebabd1ac54",
"sha256": "4e5e792155ab59503c78562dc604a1c3a1b180a15c3700be2cfbc3655e93a7ec"
},
"downloads": -1,
"filename": "pymwp-0.4.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d9f8a402a3515eb7f403a8ebabd1ac54",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 54669,
"upload_time": "2023-05-08T15:42:03",
"upload_time_iso_8601": "2023-05-08T15:42:03.223128Z",
"url": "https://files.pythonhosted.org/packages/17/72/5abdf6e7ff25b0eae398d4eeaa143fb86cac769070acc893ea6e2eee8711/pymwp-0.4.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e5095bb1ca4eeec0a0c11fb69b1b46053799f362f1c42abcd01fa3edb5acba83",
"md5": "b516f92baf5c1f19cd257a72cb882b72",
"sha256": "28ed3e2c8937e0125f61995740d57454a451772a1a0a2e860ea6353fd799575e"
},
"downloads": -1,
"filename": "pymwp-0.4.2.tar.gz",
"has_sig": false,
"md5_digest": "b516f92baf5c1f19cd257a72cb882b72",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 60412,
"upload_time": "2023-05-08T15:42:05",
"upload_time_iso_8601": "2023-05-08T15:42:05.049897Z",
"url": "https://files.pythonhosted.org/packages/e5/09/5bb1ca4eeec0a0c11fb69b1b46053799f362f1c42abcd01fa3edb5acba83/pymwp-0.4.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-08 15:42:05",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "statycc",
"github_project": "pymwp",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "pymwp"
}