Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Fiatlight Documentation

Fiatlight Architecture

# Necessary imports for this doc page
from fiatlight.fiat_notebook import plantuml_magic, display_markdown_from_file

Class diagrams

fiat_core

This is the foundational package of the fiatlight framework. It focuses on wrapping data and functions with GUI elements to facilitate interaction.

Classes

  • AnyDataWithGui: Wraps any type of data with a GUI. This class manages the data value and its associated callbacks, and it provides methods to serialize/deserialize the data to/from JSON.

  • AnyDataGuiCallbacks: Stores callback functions for AnyDataWithGui, enhancing interactivity by allowing custom widgets and presentations.

  • FunctionWithGui: Encapsulates a function, enriching it with a GUI based on inferred input and output types. It handles function invocation and manages internal states like exceptions and execution flags.

  • ParamWithGui and OutputWithGui: These classes link parameters and outputs of functions to their GUI representations.

  • FunctionNode: Represents a node in a function graph, containing links to other function nodes and managing data flow between them.

  • FunctionNodeLink: Defines a link between outputs of one function node and inputs of another, facilitating data flow in the function graph.

  • FunctionsGraph: Represents a graph of interconnected FunctionNode instances, effectively mapping the entire functional structure.

%plantuml_include class_diagrams/fiat_core.puml
Loading...

fiat_togui

fiat_togui provides functions to register new types (classes, dataclasses, enums) so that they are associated with a GUI.

Functions

  • register_type(type_, gui_type): register a GUI for a given type. gui_type must be a descendant of AnyDataWithGui

  • register_enum(enum_type) and the equivalent decorator enum_with_gui_registration: register an enum

  • register_dataclass and the equivalent decorator dataclass_with_gui_registration: register a dataclass base model

  • register_base_model and the equivalent decorator base_model_with_gui_registration: register a pydantic base model

Classes

  • IntWithGui, FloatWithGui, etc.: provides GUI for primitive types (int, str, float, bool)

  • OptionalWithGui: able to add GUI to Optional[DataType] (if DataType is registered)

%plantuml_include class_diagrams/fiat_togui.puml
Loading...

fiat_runner

fiat_runner is the package that contains the “run” functions:

Free function

fiat_run accepts either a standard function, a list of functions, or a graph of functions. It executes the function(s) and displays the results in a GUI.

  • fiat_run(fn) # fn is a function or a FunctionWithGui

  • fiat_run([fn1, fn2, ...]) # list of functions or FunctionWithGui

  • fiat_run(graph) # A FunctionsGraph

Classes

  • FiatlightGui: The main runtime class that presents a GUI for interacting with a function graph. It orchestrates the execution and user interaction.

  • FiatlightGuiParams: Stores configuration and parameters for the GUI application, such as visibility toggles and other settings.

%plantuml_include class_diagrams/fiat_runner.puml
Loading...

fiat_nodes

fiat_nodes is the package that is able to display a function graph in a node editor (using imgui-node-editor)

As a final user, you will probably not interact with it.

Classes

  • FunctionNodeGui: The GUI representation of a FunctionNode

  • FunctionNodeLinkGui: The GUI representation aspect of a FunctionNodeLink

  • FunctionsGraphGui: The GUI representation of a FunctionsGraph

%plantuml_include class_diagrams/fiat_nodes.puml
Loading...

Full diagram

Below is the full class diagram

%plantuml_include class_diagrams/all.puml
Loading...

Folder structure

Below is the folder structure of the fiatlight framework.

display_markdown_from_file("folder_structure.md")
Loading...