Add a Python SDK: flows declared in your own repository

A data scientist keeps their code where it is and decorates it: `@node`
declares a function's ports beside the function, `Flow(name, nodes=[...])`
says which of them make a flow, and `use(fn, wire=..., **settings)` rebinds
one for a single flow. `fluksio sync` uploads the document plus a generated
import shim per node, so the store still holds a complete, runnable,
git-versioned definition while the code it imports stays theirs.

`fluksio login|run|runs` and `flow.submit().wait()` are the client half, over
the run endpoints that already existed. Runs record the user repository's
commit beside the store's, so "what code produced this number" is answerable
on the side that now holds the code.

- `fluksio/sdk/`: ports, decorators, the flow builder and its checks, the shim
  generator, an HTTP client and sync. Standard library only at import, so
  `from fluksio import node` in a training script pulls in no engine.
- `FlowDef.origin` marks a flow code-defined; `Run.origin_commit` carries the
  repository's commit; `POST /modules/refresh` retires the workers without an
  install, which every sync calls — a worker holds the imported package in
  memory, so an edit to it is invisible until the process goes.
- The canvas shows a generated body read-only and names the repository to edit
  instead; a body edited there stops the next sync rather than being discarded.
- The worker's reporter carries inert `Port`, `node`, `use` and `Flow`, since
  the shim imports a module whose first line declares them.
- `examples/myresearch` is the worked example, `make sync-example` uploads it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012ue1tkFWB1bcGy3aWhCKpU
This commit is contained in:
2026-08-23 20:16:08 +02:00
co-authored by Claude Fable 5
parent 0a49b6e947
commit 19bc2810cf
35 changed files with 2693 additions and 142 deletions
+22 -2
View File
@@ -24,11 +24,14 @@ The apperance should be strictly separated from the functionality (which both se
All widgets (and the sidebar rail) should follow the appearance and should be reworked to receive animations through the motion library.
It should be possible to set a background in the dashboard (input, controllable externally via a node. In v1 this can be just an url to an image).
It should be possible to disable the title of a widget.
The dashboard setting should contain a "Touch" toggle, which, when activated, makes all widgets more touch friendly
The dashboard setting should contain a "Touch" toggle, which, when activated, makes all widgets more touch friendly.
All components should react responsive to the size of the widget.
Components and animations should be carefully designed and adhere to high-quality design standards and taste.
A minimal research on dashboard/ component design should be conducted.
Specific changes
- the nested bar should be changed in a multi-row bar with N inputs (and therefore n bars), color separated as the chart widget
- the range picker should go to the right (vertical) of the chart widgeta
- the range picker should go to the right (vertical) of the chart widget to allow for more vertical space of the chart
- the color picker should be changed to a circular color picker (disk with colors, saturation changes towards the center) and a vertical slider for the brightness
### To be sorted
@@ -397,6 +400,23 @@ as an em dash.
## Deferred
- FEAT/SDK: a traced flow body — `@Flow` over a function whose calls to other
nodes build the graph, the way Covalent's lattice does. Rejected for the first
version with reasons in `docs/private/python-api.md` (2.5× the code, two
meanings per decorated function, and several things it cannot express). The
registry holds `Flow` objects rather than modules, so a tracer producing the
same `FlowDef` would slot in without changing anything stored.
- CHORE/SDK: two `use()`s of one function in one flow store two identical node
bodies. `share_node` already models this — `_lib/<name>.py` plus a
`source_ref` — and sync could write the shared shim once. Not done because
editing a shared source bypasses draft/publish, which a generated body should
not.
- FEAT/SDK: `fluksio sync` puts the repository on `sys.path` from inside the
generated body, by absolute path. Right for the machine that synced, and
meaningless in a container — the note in the docs says to install the package
where the node runs. A `--repo-as` flag, or reading the installed location
back from the engine, would close it.
Open on purpose. Each names what should bring it back.
- PERF/UI: the app's entry chunk exceeds the warning threshold. React Flow and Monaco are already lazy; a manualChunks split measured no better, so this needs route-level work on the shell rather than chunking config.