Skip to main content

=================================================== pysimultanui

Python library for creating simple user interfaces for PySimultan

Installation

pysimultanui can be installed using pip:

pip install pysimultanui

Usage

Running the UI

uvicorn is used to run the UI. To run the UI, use the following command:

import pysimultanui as psui
from PySimultan2.taxonomy_maps import TaxonomyMap, Content

# example class to be mapped:


class ExampleClass:
    def __init__(self, *args, **kwargs):
        self.a = kwargs.get('a', None)
        self.b = kwargs.get('b', None)
        self.c = None

    def add(self):
        self.c = self.a + self.b

    def subtract(self):
        self.c = self.a - self.b

    def multiply(self):
        self.c = self.a * self.b


# create content and taxonomy map:
contents = {}

contents['a'] = Content(text_or_key='a_in_simultan',
                        property_name='a',
                        type=None,
                        unit=None,
                        documentation='Content a')

contents['b'] = Content(text_or_key='b_in_simultan',
                        property_name='b',
                        type=None,
                        unit=None,
                        documentation='Content b')

contents['c'] = Content(text_or_key='c_in_simultan',
                        property_name='c',
                        type=None,
                        unit=None,
                        documentation='Content c')

example_class_map = TaxonomyMap(taxonomy_name='PySimultanUI',
                                taxonomy_key='PySimultanUI',
                                taxonomy_entry_name='ExampleClass',
                                taxonomy_entry_key='ExampleClass',
                                content=[contents['a'],
                                         contents['b'],
                                         contents['c']
                                         ],
                                )

# get the mapper:
mapper = psui.core.mapper

# register the class to be mapped:
mapper.register(example_class_map.taxonomy_entry_key,
                ExampleClass,
                taxonomy_map=example_class_map)


# register methods:
cls = mapper.get_mapped_class('ExampleClass')

# get the method mapper:
method_mapper = psui.core.method_mapper

method_mapper.register_method(cls=cls,
                              name='subtract',
                              method=cls.subtract,
                              args=[],
                              kwargs={})

method_mapper.register_method(cls=cls,
                              name='add',
                              method=cls.add,
                              args=[],
                              kwargs={})

method_mapper.register_method(cls=cls,
                              name='multiply',
                              method=cls.multiply,
                              args=[],
                              kwargs={})

# run the UI:
psui.run_ui()

Download files

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

Source Distribution

pysimultanui-1.4.0.tar.gz (57.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pysimultanui-1.4.0-py3-none-any.whl (75.3 kB view details)

Uploaded Python 3

File details

Details for the file pysimultanui-1.4.0.tar.gz.

File metadata

  • Download URL: pysimultanui-1.4.0.tar.gz
  • Upload date:
  • Size: 57.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.9

File hashes

Hashes for pysimultanui-1.4.0.tar.gz
Algorithm Hash digest
SHA256 99fdb42f24231a59a5c31cdd2098ad20051f4cee1664583fa815e21cbdffcfe6
MD5 1475a1ea3da4d31a92808cfb070089eb
BLAKE2b-256 42b3741fb139fcd44dd829b7daca4b822090a4bb2fa125c5210db48ab726b261

See more details on using hashes here.

File details

Details for the file pysimultanui-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: pysimultanui-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 75.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.9

File hashes

Hashes for pysimultanui-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 390e557b993c94eebcd84f40a71e7617c08faed5b709b1bc73f1c7978892392f
MD5 5aa71f44c64a4c7abfbb2fbbdec514ce
BLAKE2b-256 56460f177a9772d85adb3516e0c43f51ceb1c2da8d2af3c7edf180227a285909

See more details on using hashes here.

Release history Release notifications | RSS feed

2.2.1

2 files

2.1.0

2 files

2.0.0

2 files

1.6.5

2 files

1.6.4

2 files

1.6.0

2 files

1.5.10

2 files

1.5.9

2 files

1.5.8

2 files

1.5.7

2 files

1.5.6

2 files

1.5.5

2 files

1.5.4

2 files

1.5.3

2 files

1.5.2

2 files

1.5.1

2 files

1.5.0

2 files

This release

1.4.0 This release

2 files

1.1.1

2 files

1.0.0

2 files

0.3.1

2 files

0.3.0

2 files

0.2.1

2 files

0.2

2 files

0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page