Sim2lBuilder Stats
| Latest Release |
|
| PyPI Downloads |
|
Simtool Builder
Introduction
sim2lbuilder is an utility library to create Graphical User interfaces on Jupyter notebooks. sim2lbuilder is based on ipywidgets, and allow users to describe Apps based on their inputs, outputs and layout. Callback functions can also be referenced to be triggered by events on the widgets sim2lbuilder can display described tools as widgets, or generate python code to be modified.
Installation
pip install sim2lbuilder
Usage
schema = {
'inputs': {
'n1': { 'type': 'IntText', 'value': 1},
'n2': { 'type': 'IntText', 'value': 3}
},
'outputs': {
'sol': { 'type': 'IntText'},
},
'layout': {
'type': 'HBox',
'children' : {
'n1': None,
'n2': None,
'button' : {
'type': 'Button',
'click': 'SUM',
'description': '=',
},
'sol': None
}
}
}
from sim2lbuilder import WidgetConstructor
s = WidgetConstructor(schema)
def SUM (w):
w.outputs["sol"].value = w.inputs["n1"].value + w.inputs["n2"].value
s.SUM = SUM
s.assemble()
SUM(s)
display(s)
Create a Sim2l GUI (Widget)
from sim2lbuilder import WidgetConstructor, GetSimtoolDefaultSchema
from simtool import searchForSimTool, getSimToolInputs, Run
schema = GetSimtoolDefaultSchema("meltingkim")
def RunSimTool(widget, *kargs):
stl = searchForSimTool("meltingkim")
inputs =getSimToolInputs(stl)
for i,w in widget.inputs.items():
inputs[i].value = w.value
r =Run(stl, inputs)
for outk, out in widget.outputs.items():
with out:
print(r.read(outk))
s = WidgetConstructor(schema)
s.RunSimTool = RunSimTool
s.assemble()
s
Create a Sim2l GUI (Generate Code)
from sim2lbuilder import WidgetConstructor, GetSimtoolDefaultSchema
from simtool import searchForSimTool, getSimToolInputs, Run
schema = GetSimtoolDefaultSchema("meltingkim")
def RunSimTool(widget, *kargs):
stl = searchForSimTool("meltingkim")
inputs =getSimToolInputs(stl)
for i,w in widget.inputs.items():
inputs[i].value = w.value
r =Run(stl, inputs)
for outk, out in widget.outputs.items():
with out:
print(r.read(outk))
s = WidgetConstructor(schema, format="file")
s.RunSimTool = RunSimTool
s.assemble()
s
Create a Sim2l GUI (Print Code)
from sim2lbuilder import WidgetConstructor, GetSimtoolDefaultSchema
from simtool import searchForSimTool, getSimToolInputs, Run
schema = GetSimtoolDefaultSchema("meltingkim")
def RunSimTool(widget, *kargs):
stl = searchForSimTool("meltingkim")
inputs =getSimToolInputs(stl)
for i,w in widget.inputs.items():
inputs[i].value = w.value
r =Run(stl, inputs)
for outk, out in widget.outputs.items():
with out:
print(r.read(outk))
s = WidgetConstructor(schema, format="text")
s.RunSimTool = RunSimTool
s.assemble()
s
Create a Sim2l App (Javascript)
from sim2lbuilder import *
schema = GetSimtoolDefaultSchema("introtosimtools")
s = UIDLConstructor(schema, drawer_width=350, width="100%", height="600px")
s.assemble(
jupyter_notebook_url=jupyter_notebook_url,
)
Create a Sim2l App - Jupyter widget (ipywidget)
from sim2lbuilder import *
schema = GetSimtoolDefaultSchema("introtosimtools")
s = UIDLConstructor(schema, drawer_width=350, width="100%", height="600px")
s.assemble(
jupyter_notebook_url=jupyter_notebook_url,
uidl_local = True,
copy_libraries=True,
widget = False,
)
Metadata
Release files for sim2lbuilder 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sim2lbuilder-0.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Release files / sim2lbuilder-0.0.7-py3-none-any.whl
| Download URL | sim2lbuilder-0.0.7-py3-none-any.whl |
|---|---|
| Size | 29.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
91c442949418d4550cca33995809f96ebf610c597065ce66ad9e3fc6de7169cb
|
|
BLAKE2b-256 checksum How to use checksums |
08128e411f254041402ff20677dc85b7129b0950c41fbac047bcca480e4596e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.0 importlib_metadata/6.0.0 pkginfo/1.8.2 requests/2.28.2 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.9.7
|
Security for sim2lbuilder 0.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.