Documentation

Welcome to the Py-Engineering documentation. If you're new to these docs, we recommend you to check what Py-Engineering is all about. Watch the introduction movie "How it works" and checkout some examples. If you think anything is missing or unclear, let us know. Ready to start, but no Py-Engineering account yet? Request a demo!

Please stay tuned as we keep on working on a detailed documentation page.

Getting started

No need to install anything. Py-Engineering is a web-application. You only need an account and/or an API key. If you don’t have one, reach out to someone in your company who can provide you one or request a demo by mailing to info@py-engineering.com.

Example of a login page on https://www.py-engineering.com. Depending on the platform your account belongs to, this login page might have a different URL and look-and-feel.

How it works

The general concept is that you write a Python function that prints output like you would do on your local machine. By defining input variables in Py-Engineering.com, this function is instantly accessible as web-app or API. By running the tool in the web-app or trough the API, the Python functions is executed in our cloud environment. See what this looks like in the introduction video below or check out the Tutorials.

Output

Tags

Start tag End tag HTML substitution
_bold[ or _b[ _bold] or _b] <b> ... </b>
_italic[ or _i[ _italic] or _i] <i> ... </i>
_underline[ or _u[ _underline] or _u] <u> ... </u>
_superscript[ or _sup[ _superscript] or _sup] <sup> ... </sup>
_subscript[ or _sub[ _subscript] or _sub] <sub> ... </sub>
_code_inline[ or _ci[ _code_inline] or _ci] <code> ... </code>
_code_block[ or _cb[ _code_block] or _cb] <pre> ... </pre>
Tag HTML substitution
_info <p class="text-info my-1"><span class="fa fa-fw fa-info-circle"></span> ...</p>
_warning <p class="text-warning my-1"><span class="fa fa-fw fa-exlamation-circle"></span> ...</p>
_danger <p class="text-danger my-1"><span class="fa fa-fw fa-times-circle"></span> ...</p>
_success <p class="text-success my-1"><span class="fa fa-fw fa-check-circle"></span> ...</p>
_header <h6>...</h6>
_small <small><...</small>

Output formatting

Tag HTML substitution
_BOLD <b>{}</b>
_ITALIC <i>{}</i>
_UNDERLINE <u>{}</u>
_SUPERSCRIPT <sup>{}</sup>
_SUBSCRIPT <sub>{}</sub>
_CODE <code>{}</code>
_PREFORMATTED <pre>{}</pre>
_INFO <p class="text-info my-1"><span class="fa fa-fw fa-info-circle"></span> {}</p>
_WARNING <p class="text-warning my-1"><span class="fa fa-fw fa-exclamation-circle"></span> {}</p>
_DANGER <p class="text-danger my-1"><span class="fa fa-fw fa-times-circle"></span> {}</p>
_SUCCESS <p class="text-success my-1"><span class="fa fa-fw fa-check-circle"></span> {}</p>
_HEADER <h6 class="pt-2">{}</h6>
_SMALL <small>{}</small>

Tags can be used either at the start of a line that should be formatted or using brackets to indicate start- and end position.

An example:


def main_function(input_dict):

    # Single line, starting a tag
    print('_HEADER Header')
    print('The rest of this line _UNDERLINE will be underlined on a new line.')
    for tag in ['INFO', 'WARNING', 'DANGER', 'SUCCESS']:
        print(f"_{tag} {tag.title()}")

    # Inline with [..]
    print('_BOLD[This] is bold and _ITALIC[this] is italic.')
    print('The tags _BOLD[_ITALIC[_UNDERLINE[can be combined]]]')

    # Multiple lines with [..]
    print('_PREFORMATTED[')
    print('Multiple lines')
    print('can be formatted')
    print('using brackets [ and _]')
    print('_SMALL Note that an endbracket within a tag needs to be escaped with a _CODE[ _ ]')
    print(']')
                                    

This will format the output:

Handle files

Tag HTML substitution
_IMAGE <img src="{file_url}" alt="{file_name}" class="img-fluid"><br>
_DOWNLOAD_LINK <a href="{}">{}</a>
_DOWNLOAD_BUTTON <a href="{}" class="btn btn-outline-secondary btn-sm"><span class="fa-fw fal fa fa-download"></span> {}</a><br>

An example:

import xlsxwriter
import matplotlib.pyplot as plt


def main_function(input_dict):
    file_name = 'example'

    fig, ax = plt.subplots()

    fruits = ['apple', 'blueberry', 'cherry', 'orange']
    counts = [40, 100, 30, 55]
    bar_labels = ['red', 'blue', '_red', 'orange']
    bar_colors = ['tab:red', 'tab:blue', 'tab:red', 'tab:orange']

    ax.bar(fruits, counts, label=bar_labels, color=bar_colors)

    ax.set_ylabel('fruit supply')
    ax.set_title('Fruit supply by kind and color')
    ax.legend(title='Fruit color')

    plt.savefig(file_name)

    workbook = xlsxwriter.Workbook(file_name)
    worksheet = workbook.add_worksheet()
    worksheet.write('A1', 'Hello world')
    workbook.close()

    print("Show image:")
    print(f"_IMAGE[{file_name}.png]")
    print(f"Use a link like _DOWNLOAD_LINK[{file_name}.xlsx] to download a file. Or create a button:")
    print(f"\n_DOWNLOAD_BUTTON[{file_name}.xlsx]")

This will provide an image, link and download button like: