House style for Tolquane flows¶
Every example in this repository, and every flow the AI builder writes, follows these rules. The point is that a reader sees the whole flow at a glance.
- One file, one flow. A module docstring says what the flow does in one sentence.
- Small named functions. One per node, four to ten lines, named after what they do
(
fetch,keep_ok,write_title), decorated with@tq.source,@tq.nodeor@tq.sink. No lambdas in the graph line except for trivial arithmetic. - A comment on every node saying what it does and, when it matters, why it is a separate node (I/O bound, needs state, must run in order).
- The graph is one line with
>>, right after the nodes, assigned tographor passed straight totq.run. tq.SKIPfor filters, neverreturn None;Nonetravels.- Classes only for state. A node that accumulates or holds a connection is a class
with
__call__, andon_endfor flushing. - Explicit runtimes.
tq.run(graph)for threads; sayruntime="processes"or a deploy file when that is the intent. Say why in a comment. - Errors are the framework's job. No
try/exceptaround the graph; letNodeErrorname the node. - A
main()guarded byif __name__ == "__main__":so the flow is importable and testable withtq.from_iterableandtq.to_list. - Twenty lines of logic is a lot. If a flow grows past that, split nodes into a module and keep the graph file short.