Write a node
Every node in Curio, the built-ins included, comes from a package: a folder whose manifest.json declares one or more node templates. You can add your own in two ways: a Python node reuses Curio's code editor and needs no build step, while a node with its own interface is a React hook written in TypeScript and compiled into a bundle.
A Python node
- Drop a Python Computation node on the canvas and write your Python in its editor. What the connection on input circle 0 delivers arrives as
input_0, on circle 1 asinput_1, and so on, and whatever youreturnbecomes this node's output. Run it until it does what you want. - Click the cog in the node header to open Node settings, and set the label, the port types and the editor mode.
- Click Save as package node…, pick New package…, give the package a name and save.
The node now belongs to your package, in your own store under .curio/users/: it stays in the palette after a restart, its imports are recorded as the package's dependencies, and Curio generates its id. To pick your own reverse-domain id, start from files in a git clone (see Contribute): python scripts/new_package.py me.roughness writes a valid packages/me.roughness@1/ with a Python starter, to add from the Node Catalog drawer.

A node from a Python function
A package that ships Python modules beside its templates gives you a node for any of their functions, with no code to write:
- Open the Node Catalog drawer and click New node from a Python function in its footer.
- Pick the function. The list holds the functions the modules of your installed packages offer: the names each module's
__all__lists, or else its public functions. - For each parameter, choose what it gets: a widget, whose type Curio suggests from the parameter's annotation or default; a fixed value, written as Python writes it; an input of the node; or its default.
- Name the node, choose the package it goes into, and click Create node.

The node joins the project's palette. Its code imports the function and returns its call, with the widgets and inputs as chips:
from deep_umbra import season_factor
return season_factor(season=[!! season !!])Each function a module offers says what it does in the first paragraph of its docstring: this dialog shows it under the function, and a node made from the function takes it as its description. Write that paragraph as reST, ``name`` or :func:`name` for code and *name* for a parameter, which Curio shows in the code font and in italics, never the marks. A folder's __init__.py can offer what its other modules define, as deep_umbra offers accumulated_shadow and season_factor. Build a package says where else these functions show.
A node with its own interface
A custom node replaces the code editor with controls you design, in a React hook that renders inside the node body. Save as package node never includes the compiled bundle such a node needs, so this kind is written as files in a git clone:
python scripts/new_package.py me.mynode --with-ui
cd utk_curio/frontend/urban-workflows
npm run build:packagesnpm run build:packages compiles the sources/index.tsx of every package under packages/ whose manifest declares behaviorScript, as the scaffold's does, into the file behaviorScript names. After the first build, add the package to a dataflow from the Node Catalog drawer. Curio runs your installed copy, not the files in packages/, and refreshes that copy when those files change, so reload the page after each rebuild.
Reading upstream data
In a Python node, each input circle is its own variable: input_0 for the first, input_1 for the second, and so on. Each holds a Python object such as a DataFrame, a GeoDataFrame, a value, a list or a dict, and a circle with no connection is None. Read a Data Catalog dataset with curio_load_data("<dataset id>"), using the id without its @ version, not a file path, so the dataflow keeps working for others. curio_data_path("<dataset id>") gives the dataset's file, for a reader of your own. Functions node code calls lists every function Curio gives node code, with its arguments.
In a custom node, data.input usually holds a reference to a stored result, not the data. Fetch it from the backend at window.curio.backendUrl with the user's session token, not process.env.BACKEND_URL, which bakes in your own machine's address. A DataFrame arrives as one array per column, while hand-written data may key each column by row, so accept both. The example package's resolveInput handles every shape.
What to watch for
- A custom node that shows a plain code editor has a bundle that failed to load, which the browser console reports, or mismatched keys: the template's
behavior, the key passed toregisterBehaviorand the manifest'sbehaviorScriptpath must agree. - Build with
npm run build:packages, not the fullnpm run build, and never bundle your own copy of React. - After editing a package in place, refresh its hashes with
python scripts/regen_integrity.py packages/<id>@<major>.
Sharing it
Export the package with the download icon on its row in the Node Catalog dropdown of the Tools panel. You get one <packageId>@<major>.curio.zip that carries a custom node's compiled bundle, so whoever installs it needs no build step. To check that it stands on its own, remove the package and import the archive. Build a package covers archives, dependencies, publishing and versions.

