stackml 1.0.8
stackml is a transpiler for stackml to generate output for different backend as diagram, drawio, map.
License: MIT license

## StackML-cli
![continuous_integration](https://github.com/Stackitect/stackml-cli/workflows/continuous_integration/badge.svg)
![publish_to_Pypi](https://github.com/Stackeo-io/stackml-cli/workflows/publish_to_Pypi/badge.svg)

stackml is a transpiler for stackml to generate output for different backend as diagram, drawio, map.

The implementation is compatible with python3.6

## Usage

1. Installation of application

```bash
pip install stackml
```

2. Run the application

You can run the application with the following command

```bash
stackml

Usage: stackml [OPTIONS] COMMAND [ARGS]...

Options:
  --version  Show the version and exit.
  --help  Show this message and exit.

Commands:
  check    check stackml file architecture
  compile  compile stackml file using a specific backend
  init     initialize a stackml project

Usage: stackml compile [OPTIONS] COMMAND [ARGS]...

  compile stackml file using a specific backend

Options:
  -i, --input TEXT                the file to compile
  -d, --disable-syntax-verification
                                  ignore syntax verification
  -h, --help                      Show this message and exit.

Commands:
  diagram    compile stackml file for
  drawio     compile stackml file for drawio




Usage: stackml compile diagram [OPTIONS]

  compile Stackml file for diagram

  Example:     Stackml compile -i architecture.stkml diagram -t 1 -o img

Options:
  -t, --type [1|2|3]  the diagram type {Architecture ,Topology or Map}
                      [required]

  -i, --icons TEXT    the icon folder {it contains [Node_Id].png files}
  -o, --output TEXT   the output file  [required]
  -h, --help          Show this message and exit.



Usage: stackml compile drawio [OPTIONS]

  compile Stackml file for Drawio

  Example:     Stackml compile -i architecture.stkml Drawio -l 1 -o Drawio

Options:
  -l, --level [1|2]  the diagram view level {System View or Layer View}
                     [required]

  -i, --icons TEXT   the icon folder {it contains [Node_Id].png files}
  -o, --output TEXT  the output file  [required]
  -h, --help         Show this message and exit.




stackml check --input architecture

Usage: stackml check [OPTIONS]

  check stackml project

Options:
  -i, --input TEXT               the stackml project to check
  --disable-syntax-verification  ignore syntax verification
  --help                         Show this message and exit.


stackml init

Usage: stackml init [OPTIONS]

  initialize a Stackml project

Options:
  -i, --input TEXT    the file to compile to Stackml
  -b, --backend TEXT  the file backend [drawio]
  -p, --path TEXT     the Stackml project directory
  -h, --help          Show this message and exit.


```

3. Diagram Examples
    -   System Diagram
          ```
          stackml compile -i Examples/example.stkml diagram -t 1 -o Examples/results/diagram/Type1/level1 --icons Examples/icons/
          ```
          Result :
          ![](https://stackml.stackeo.io/_images/level1.png)

    -   Deployment Topology Diagram
          ```
          stackml compile -i Examples/example.stkml diagram -t 2 -o Examples/results/Type2/diagram/level1 --icons Examples/icons/
          ```
          Result :
          ![](https://stackml.stackeo.io/_images/level11.png)

    -   Deployment Map
          ```
          stackml compile -i Examples/example.stkml diagram -t 3 -o Examples/results/Type2/diagram/level2.html --icons Examples/icons/
          ```
          Result :

           [![](https://stackml.stackeo.io/_static/results/type3.png)](https://stackml.stackeo.io/_static/results/level2_2.html)




4. Drawio Examples

    - level 1 :
      ```
      stackml compile -i Examples/example.stkml drawio -l 1 -o Examples/results/Type1/level1
      ```
      Result :
      [![](https://stackml.stackeo.io/_static/results/level1.png)](https://stackml.stackeo.io/_static/results/level1.html)

    - level 2 :
      ```
      stackml compile -i Examples/example.stkml drawio -l 2 -o Examples/results/Type1/level2
      ```
      Result :
      [![](https://stackml.stackeo.io/_static/results/level2.png)](https://stackml.stackeo.io/_static/results/level2.html)


## The latest version

You can find the latest version to ...

```bash
git clone https://github.com/Stackitect/stackml-cli.git
```

## Developper guideline

### Add a dependency

Write the dependency in ``setup.py``. As it's the distribution standard for pypi,
I prefer to keep ``setup.py`` as single source of truth.

I encourage avoiding using instruction as ``pipenv install requests`` to register
a new library. You would have to write your dependency in both ``setup.py`` and ``Pipfile``.

### Install development environment

Use make to instanciate a python virtual environment in ./venv and install the
python dependencies.

```bash
make install_requirements_dev
```

### Update release dependencies

Use make to instanciate a python virtual environment in ./venv and freeze
dependencies version on requirement.txt.

```bash
make update_requirements
```

### Activate the python environment

When you setup the requirements, a `venv` directory on python 3 is created.
To activate the venv, you have to execute :

```bash
make activate
```

### Run the linter and the unit tests

Before commit or send a pull request, you have to execute `pylint` to check the syntax
of your code and run the unit tests to validate the behavior.

```bash
make lint
make tests
```