# Installation

## Dependencies

The Modelverse reference implementation is relatively dependency-free. As its code is written in Python 2, a working Python 2.7 interpreter is necessary.

To run the tests, this interpreter needs to have the pytest module installed.

To run the statecharts, the SCCD module needs to be installed.

## Installation

The Modelverse is merely a set of scripts, and there is no real installation present. As such, you will only have to download the source code and are ready to use the Modelverse.

0. Install dependencies.

1. Download the Modelverse source code. For example using git:

       git clone https://msdl.uantwerpen.be/git/yentl/modelverse

   Or using your favorite HTTP download tool:

       wget https://msdl.uantwerpen.be/git/yentl/modelverse/archive/master.zip
       unzip master.zip

2. That’s it! You can now run the scripts in the scripts/ directory using Python.

## Tests

To make sure that everything is working correctly, you can execute the tests with the script scripts/run_tests.sh. This test file will execute tests in parallel, using as many cores as it can. Nonetheless, total execution time is still rather slow (e.g., 1200 seconds on a i5-4570 using PyPy).

Executing the tests is as simple as the following command:

    python scripts/run_tests.py

This will run a set of tests for all different projects.

### PyPy

The default way of executing tests is probably through CPython. Note, however, that CPython is a very slow implementation of Python, which makes everything in the Modelverse slower. While it is not impossible to use CPython, using PyPy is highly recommended at the moment! Nonetheless, PyPy is often not the default interpretter present on the system. You will therefore have to explicitly give control to PyPy instead of CPython.

This is fairly simple: all scripts in scripts/ execute their subprocesses using the Python interpreter used to start the script. As such, the following command suffices to execute the Modelverse tests using PyPy:

    pypy scripts/run_tests.py

The problem, however, is that all modules need to be readily installed on PyPy. For SCCD, you can simply install it using PyPy instead of CPython. For pytest, you also need to install all of pytest’s dependencies. The easiest way to do this is through pip, which you also have to install first:

    wget https://bootstrap.pypa.io/get-pip.py
    pypy get-pip.py --user
    pypy -m pip install pytest --user

Afterwards, you can simply run:

    pypy scripts/run_tests.py

To execute the tests using PyPy.