How linkdlab/funcnodes_core works
Project Type and Purpose
• This is a Python core‐library package (“funcnodes_core”) designed to support the FuncNodes framework.
• It provides the building blocks (nodes, graphs, event management, I/O, plugins, utilities) that let users define, link, and execute computational nodes in a DAG (directed acyclic graph).
High-Level Components
a. Decorator & NodeMaker
• funcnodes_core/decorator: Provides @node decorators.
• nodemaker.py: Turns decorated Python functions into Node objects.
b. Node & Graph Management
• node.py / nodeclass: Core Node class definitions and mixins.
• graph.py: Graph object representing a collection of connected nodes.
c. Data & I/O
• data.py / datapath.py: Abstractions for input/output data and filesystem paths.
• io.py: Read/write nodes, serialization formats.
• utils/serialization.py: Helpers to serialize node states and graphs.
d. Execution & Eventing
• eventmanager.py: Central event bus for node lifecycle events.
• triggerstack.py: Manages triggering and scheduling of node executions.
• utils/testing.py: Mocks or helpers for injecting events during tests.
e. Libraries & Plugins
• lib/lib.py, libfinder.py, libparser.py: Dynamic library discovery and parsing.
• utils/plugins*.py: Plugin registration, plugin–type definitions.
f. Configuration & Setup
• config.py: Global settings.
• _setup.py: Installation and package metadata.
• _logging.py: Centralized logging configuration.
g. Utilities
• utils/functions.py, nodeutils.py, files.py, etc.: Cross‐cutting helper functions.
Relationships & Interactions
• User’s Python function → @node decorator → registered in NodeMaker
• NodeMaker → produces Node instances → registered into NodeSpace
• NodeSpace → constructs Graph with Node objects + edges
• Graph execution → EventManager emits lifecycle events → TriggerStack schedules node computations
• Data modules feed input/output data into nodes; IO modules persist graph and results.
• Plugin system extends Node types or data readers; lib modules discover third‐party libraries.
• Utils and logging are cross‐cutting services used by all components.
Architectural Patterns & Principles
• Modular design: clear separation of concerns (declaration, graph, execution, I/O, plugins).
• Event-driven execution: EventManager and TriggerStack implement reactive scheduling.
• Plugin architecture: dynamic discovery/extension points via libfinder and utils/plugins.
• Testability: testing mocks and fixtures under tests/ plus pytest integration.
Detail Level
• Every major module grouping—do not break down into every file but list representative files.