Skip to main content

Execute litegraph.js graphs server-side

Reason this release was yanked:

Broken release

Project description

GraphExec

GraphExec is a tool for executing litegraph.js graphs on a server, with node operations implemented as Python functions.

Slot types can be any Python types, including NumPy arrays and custom, opaque classes.

It runs as a REST back-end for litegraph.js with some aftermarket modifications, or as a command-line tool. Generating JavaScript code for client-side stub nodes (with slots, properties and widgets, but no business logic) is also possible, based on decorators added to the node implementation.

For each node, server-side code can return image results (including Matplotlib figures).

The project is in an alpha development stage; for example, litegraph.js built-in nodes are not implemented, and there is no support for the REST back-end in the upstream library.

screenshot


Usage

With my_node_types.py:

from graphexec import node_type

from .my_implementation import _perlin_noise

@node_type.define("my_package/perlin_noise", "Perlin noise")
@node_type.input("width", "number")
@node_type.input("height", "number")
@node_type.output("map", "numpy.ndarray")
def perlin_noise(width, height):
    return dict(map=_perlin_noise(int(width), int(height)))

NODE_TYPES = [
    perlin_noise,
]
graphexec-generate-js-module -o ../litegraph/src/nodes/my-package-generated.js my_node_types
env PYTHONPATH=. graphexec-server --wwwroot ../litegraph -m my_node_types

Format check

black --diff **.py

Type check

mypy graphexec

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

graphexec-0.0.1.tar.gz (7.0 kB view hashes)

Uploaded Source

Built Distribution

graphexec-0.0.1-py3-none-any.whl (8.9 kB view hashes)

Uploaded 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