Skip to main content

A Django app providing Rest APIs to create CosApp system.

Project description

CosApp Creator

cosapp_creator is a Django application providing a web interface to create CosApp systems.

Installation

You can install cosapp_creator using pip or conda

# Using pip
pip install cosapp_creator
# Using conda
conda install -c conda-forge cosapp_creator

Getting started

cosapp_creator provides the cosapp-creator command to interact with the web server.

  • Before starting the application for the first time, you need to create the database:
cosapp-creator migrate
  • To start the application in production mode, you need to have gunicorn installed:
# Start the web server at the default 8000 port
cosapp-creator start

cosapp-creator uses gunicorn to serve the Django application, any arguments after start will be passed to gunicorn. You can refer to gunicorn documentation for advanced configuration, for example, to start the application with 4 workers:

cosapp-creator start --workers 4

By default, the frontend will connect to the API server at http://127.0.0.1:8000, you can modify this URL by setting the variable COSAPP_CREATOR_API before starting up the server:

# Start the web server at a custom port
COSAPP_CREATOR_API=http://127.0.0.1:1234 cosapp-creator start -b 0.0.0.0:1234
  • To start the application in development mode:
cosapp-creator runserver
  • To show all available commands:
cosapp-creator -h

Using the application

alt text

Import package

The first step in creating an assembly is to import a package. To do so, the "Import Package/Assembly" button must be clicked, and the JSON file describing the Python module must be imported. This file can be generated by the parse_module function in CoSApp.

Use resulting code

Clicking on "Generate code" will display a frame containing the code to create the object class in the graph. To use it, this code needs to be executed in a Python environment in which the modules used by the assembly are installed. This code will create the class. To instantiate an object, systemName = ClassName('systemName') has to be added after the code for the class.

# Code generated by CoSApp Creator
from cosapp.base import System
import module

class Assembly(System):
    def setup(self):
        self.add_child(module.SystemClass('sys1'))
        self.add_child(module.SystemClass('sys2'))

    def compute(self):
        pass

# Instanciate object
assembly = Assembly('assembly')

Change assembly or child system names

In order to change the name of the assembly or the name of any child system, the old name must be double-clicked. An input field will appear, and it will be possible to write a new name. To confirm it, it is possible to click "Enter" or to just click outside of the field.

alt text

Get details on ports

A description of a port in a child system will be shown by hovering over it with the mouse. If more details are needed, it is possible to click on the port, and a more detailed description will be shown.

Port description before clicking :

alt text

Port description after click :

alt text

Kwargs

It is possible to change the value of each kwargs in a system by right-clicking this system. However, if the value of a kwarg changes the structure of a system, this change will ne be reflected in CoSApp Creator, and it may cause bugs.

alt text

Pullings

The assembly inputs and outputs are represented by these two nodes.

alt text

New pullings are created by linking any port from a child system to the white symbol.

It is also possible to link two children inputs to one parent input, by linking one parent port to two children.

alt text

Loops and mathematical problem

Each system's mathematical problem, if it exists, can be viewed by hovering over its sigma symbol.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cosapp_creator-0.1.0.tar.gz (713.3 kB view hashes)

Uploaded Source

Built Distribution

cosapp_creator-0.1.0-py2.py3-none-any.whl (497.5 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page