Summary
FlowWeaver currently generates Python scripts that depend on the flowweaver package:
from flowweaver.std.io import import_dataset
from flowweaver.std.text import lowercase
While this works for FlowWeaver users, the generated scripts are not truly standalone and require the FlowWeaver SDK to be installed.
The compiler should instead generate completely self-contained Python scripts by automatically bundling only the operations and helper functions required by the compiled pipeline.
The generated script should become the final executable artifact.
Vision
A user should be able to:
- Build a preprocessing pipeline visually.
- Click Compile.
- Receive a single
pipeline.py.
- Copy the file to any machine.
- Run:
without installing FlowWeaver.
FlowWeaver should behave like a compiler and linker rather than a runtime.
Proposed Architecture
Pipeline JSON
│
▼
Compiler
│
▼
Dependency Resolver
│
▼
Operation Linker
│
▼
Import Deduplication
│
▼
Standalone Python Generator
│
▼
pipeline.py
Design Goals
- No
flowweaver.* imports in generated scripts.
- Bundle only the operations used by the pipeline.
- Bundle required helper functions automatically.
- Deduplicate imports.
- Deduplicate helper functions.
- Produce clean, readable Python.
- Keep generated scripts deterministic.
Compiler Responsibilities
The compiler should:
- Analyze every operation used by the pipeline.
- Resolve operation dependencies.
- Resolve helper function dependencies.
- Resolve required imports.
- Merge imports.
- Inline only the required source code.
- Generate a single standalone script.
Example
Current output:
from flowweaver.std.io import import_dataset
from flowweaver.std.dedup import dedup_exact
from flowweaver.std.io import export_csv
raw_dataset = import_dataset(...)
clean_dataset = dedup_exact(raw_dataset)
export_csv(clean_dataset)
Desired output:
import csv
import json
import pathlib
import logging
def import_dataset(...):
...
def dedup_exact(...):
...
def export_csv(...):
...
def main():
...
No FlowWeaver dependency should remain.
Dependency Resolution
The compiler should automatically include:
- Operation source
- Internal helper functions
- Required constants
- Required imports
- Shared utility functions
Unused code must not be included.
Linking Strategy
Treat flowweaver.std as compiler source rather than a runtime library.
flowweaver.std
↓
Operation Parser
↓
Dependency Graph
↓
Reachability Analysis
↓
Dead Code Elimination
↓
Standalone Script
Scope
This issue includes:
- Source collection
- Dependency graph generation
- Import deduplication
- Helper function bundling
- Operation bundling
- Standalone code generation
This issue does not include:
- UI changes
- New preprocessing nodes
- Compiler optimizations
- Pipeline execution changes
Acceptance Criteria
Future Enhancements
- AST-based source extraction.
- Automatic dead code elimination.
- Shared utility deduplication.
- Optional generation of multi-file standalone projects.
- Support for optional external dependency bundling.
Motivation
FlowWeaver's generated Python should be the final product—not a wrapper around the FlowWeaver SDK.
The generated script should be portable, reproducible, shareable, version-controllable, and executable on any machine without requiring FlowWeaver itself.
This architectural change transforms FlowWeaver from a workflow application into a true visual compiler for AI data preprocessing.
Summary
FlowWeaver currently generates Python scripts that depend on the
flowweaverpackage:While this works for FlowWeaver users, the generated scripts are not truly standalone and require the FlowWeaver SDK to be installed.
The compiler should instead generate completely self-contained Python scripts by automatically bundling only the operations and helper functions required by the compiled pipeline.
The generated script should become the final executable artifact.
Vision
A user should be able to:
pipeline.py.without installing FlowWeaver.
FlowWeaver should behave like a compiler and linker rather than a runtime.
Proposed Architecture
Design Goals
flowweaver.*imports in generated scripts.Compiler Responsibilities
The compiler should:
Example
Current output:
Desired output:
No FlowWeaver dependency should remain.
Dependency Resolution
The compiler should automatically include:
Unused code must not be included.
Linking Strategy
Treat
flowweaver.stdas compiler source rather than a runtime library.Scope
This issue includes:
This issue does not include:
Acceptance Criteria
flowweaver.*imports.Future Enhancements
Motivation
FlowWeaver's generated Python should be the final product—not a wrapper around the FlowWeaver SDK.
The generated script should be portable, reproducible, shareable, version-controllable, and executable on any machine without requiring FlowWeaver itself.
This architectural change transforms FlowWeaver from a workflow application into a true visual compiler for AI data preprocessing.