pymwp

A static analyzer of variable value growth for C programs.

https://github.com/statycc/pymwp

Science Score: 85.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 5 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    3 of 8 committers (37.5%) from academic institutions
  • Institutional organization owner
    Organization statycc has institutional domain (spots.augusta.edu)
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.9%) to scientific vocabulary

Keywords

implicit-computational-complexity mwp-analysis program-analysis
Last synced: 4 months ago · JSON representation ·

Repository

A static analyzer of variable value growth for C programs.

Basic Info
Statistics
  • Stars: 6
  • Watchers: 3
  • Forks: 1
  • Open Issues: 6
  • Releases: 21
Topics
implicit-computational-complexity mwp-analysis program-analysis
Created over 4 years ago · Last pushed 5 months ago
Metadata Files
Readme Contributing License Citation Zenodo

README.md

pymwp: MWP analysis in Python

build codecov PyPI - Python Version PyPI DOI

pymwp is a tool for automatically performing static analysis on programs written in C. It analyzes resource usage and determines if a program's variables growth rates are no more than polynomially related to their inputs sizes.

For example,

c int main(int X1, int X2, int X3){ X1 = X2 + X3; X1 = X1 + X1; }

is satisfactory because—between the initial variable values (Xi) and the final values (Xi')—all variables have a polynomially bounded data-flow (omitting constants): X1' ≤ X2+X3 and X2' ≤ X2 and X3' ≤ X3. pymwp derives this bound automatically (⯈ demo).

However, program

c int main(int X1, int X2, int X3){ X1 = 1; while (X2 > 0){ X1 = X1 + X1; } }

fails the analysis, because X1 grows exponentially (X1' = $2^{\texttt{X2}}$). pymwp reports a program is infinite when no polynomial bound can be derived (⯈ demo).

pymwp is inspired by "A Flow Calculus of mwp-Bounds for Complexity Analysis". Try our online demo to see it action. For more details, see pymwp documentation, particularly supported C language features.

Documentation and Demo

The user guide is the ideal place to start for a general and interactive introduction to pymwp.

Installation

Install the latest release from PyPI

pip install pymwp

How to Use

Command-Line Use

To analyze a C file, run in terminal:

pymwp path/to_some_file.c

For a list of available command options and help, run:

pymwp

Use in Python Scripts

You can also use pymwp by importing it in a Python script. See modules documentation for details and examples.

Running from source

If you want to use the latest stable version—possibly ahead of the latest release, and with special evaluation utilities and input examples—use pymwp directly from source.

  1. Clone the repository

    shell git clone https://github.com/statycc/pymwp.git cd pymwp

  2. Set up Python runtime environment of preference

    :a:   Using Python venv↗

    Create and activate a virtual environment (POSIX bash/zsh):

    shell python3 -m venv venv source venv/bin/activate

    Install required packages:

    shell python -m pip install -r requirements.txt

    For development, install dev-dependencies instead:

    shell python -m pip install -r requirements-dev.txt

    :b:   Using Docker↗

    Build a container -- also installs dev-dependencies:

    shell docker build . -t pymwp

    Run the container:

    shell docker run --rm -v "$(pwd):$(pwd)" pymwp

  3. Run the analysis

    From project root run:

    shell python -m pymwp path/to_some_file.c

    for example:

    shell python -m pymwp c_files/basics/if.c

    for all available options and help, run:

    shell python -m pymwp

Evaluation

These options are available when running from source.

make bench # run benchmark of all c_files examples make test # run unit tests on pymwp source code make profile # run cProfile on all c_files examples

Owner

  • Name: Static Analyses of Program Flows: Types and Certificate for Complexity
  • Login: statycc
  • Kind: organization

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: 'pymwp: MWP analysis in Python'
message: >-
  If you use this software, please cite it using the
  metadata from this file.
abstract: >-
  pymwp is a tool for automatically performing static
  analysis on programs written in C. It analyzes resource
  usage and determines if a program's variables growth rates
  are no more than polynomially related to their inputs sizes.
keywords:
  - program analysis
  - mwp-analysis
  - implicit computational complexity
type: software
authors:
  - given-names: Clément
    family-names: Aubert
    affiliation: School of Computer and Cyber Sciences, Augusta University
    orcid: 'https://orcid.org/0000-0001-6346-3043'
  - given-names: Thomas
    family-names: Rubiano
    affiliation: LIPN – UMR 7030 Université Sorbonne Paris Nord
  - given-names: Neea
    family-names: Rusch
    email: nrusch@augusta.edu
    affiliation: School of Computer and Cyber Sciences, Augusta University
    orcid: 'https://orcid.org/0000-0002-7354-5330'
  - given-names: Thomas
    family-names: Seiller
    orcid: 'https://orcid.org/0000-0001-6313-0898'
    affiliation: LIPN – UMR 7030 Université Sorbonne Paris Nord & CNRS
repository-code: https://github.com/statycc/pymwp
repository-artifact: https://zenodo.org/record/7879822
doi: 10.1007/978-3-031-45332-8_14
license: GPL-3.0-or-later

GitHub Events

Total
  • Create event: 15
  • Issues event: 3
  • Release event: 4
  • Watch event: 1
  • Delete event: 11
  • Push event: 63
  • Pull request event: 16
Last Year
  • Create event: 15
  • Issues event: 3
  • Release event: 4
  • Watch event: 1
  • Delete event: 11
  • Push event: 63
  • Pull request event: 16

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 338
  • Total Committers: 8
  • Avg Commits per committer: 42.25
  • Development Distribution Score (DDS): 0.166
Top Committers
Name Email Commits
Neea Rusch n****h@g****m 282
ThomasRuby r****s@g****m 23
caubert a****t@m****r 15
caubert c****t@a****u 8
Clément Aubert C****t@m****r 4
Seiller s****r@l****r 3
Clément Aubert 1****c@u****m 2
Shaena t****o@t****r 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: over 1 year ago

All Time
  • Total issues: 31
  • Total pull requests: 83
  • Average time to close issues: 3 months
  • Average time to close pull requests: about 18 hours
  • Total issue authors: 3
  • Total pull request authors: 3
  • Average comments per issue: 2.58
  • Average comments per pull request: 0.66
  • Merged pull requests: 83
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 11
  • Average time to close issues: about 1 hour
  • Average time to close pull requests: 6 minutes
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 11
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • nkrusch (26)
  • aubertc (8)
  • ThomasRuby (1)
Pull Request Authors
  • nkrusch (116)
  • ThomasRuby (3)
  • aubertc (2)
Top Labels
Issue Labels
enhancement (6) bug (2) wontfix (1) documentation (1)
Pull Request Labels
enhancement (5) documentation (1)

Dependencies

requirements-dev.txt pypi
  • flake8 * development
  • mkdocs ==1.3.1 development
  • mkdocs-include-markdown-plugin ==3.6.1 development
  • mkdocs-material ==8.3.9 development
  • mkdocstrings ==0.19.0 development
  • mkdocstrings-python-legacy ==0.2.3 development
  • pytest * development
  • pytest-cov * development
  • pytest-mock * development
requirements.txt pypi
  • pycparser *
  • pycparser-fake-libc *
setup.py pypi
  • pycparser *
  • pycparser-fake-libc *
.github/workflows/build.yaml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • codecov/codecov-action v2.1.0 composite
.github/workflows/docs.yaml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/pyversion.yaml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/publish.yaml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • ncipollo/release-action v1 composite
  • vimtor/action-zip v1.1 composite
Dockerfile docker
  • python 3.11.5 build
requirements-doc.txt pypi
  • black *
  • mkdocs-include-markdown-plugin ==6.2.2
  • mkdocs-material ==9.5.36
  • mkdocstrings-python ==1.11.1