4 ms·
Say more. Are you wanting “Node-RED but for Python”? Or the non-UI parts that are accessible programmatically? I’ve had similar interests and realized I essent
by halfcat 2y ago
Say more. Are you wanting “Node-RED but for Python”? Or the non-UI parts that are accessible programmatically?
I’ve had similar interests and realized I essentially needed two things:
1. Something like “FastAPI without the HTTP parts”. Basically a request/response cycle with middleware functionality, where we run a registered Python callable in response to a JSON request, but where that JSON request can be from any source, like “pulled from a queue” or read from the command line, instead of “pushed from a web browser”. For that I essentially pieced together a basic task registration decorator class with pydantic’s `validate_call` decorator and let pydantic handle the serialization/deserialization. There are libraries like FastAPI, typer, Celery and others that do this, but they’re all tightly coupled with specific transports. I want to be able to delegate to a developer “build a function that takes this JSON and performs this task and returns JSON”, but not with HTTP (FastAPI), and I don’t want to be required to add Redis to run some small task (Celery), and I do want the task to be callable by CLI (typer), but not only CLI. It seems like there are all of these tools but none of them are loosely coupled enough to do this in a straightforward way.
2. Some way to run a directed acyclic graph (DAG) of those registered tasks. There are lots of tools that do this in varying degrees of heaviness (Airflow, Luigi, Dagster, etc), but for a lightweight solution this is built into Python with graphlib’s TopologicalSorter. But the point here would be, whichever one of these you pick, it helps to have #1 available in a way that allows for generic “running approved Python functions from JSON”.
So I sort of have those parts of it roughed out, but now I’d also like a better UI for it, for instance to allow for a more high level dashboard red/yellow/green status of things, or to enable a less technical user to adjust the schedule of a registered task, and so on. Django’s admin portal is a first step her but ultimately we’d need something more interactive to make it a team effort where more employees can contribute without needing to know Python.
- Towaway69 2y agoNodeRED has a very simple json format to describe flows - basically an array of objects with each object describing a node and its connection. If there were to be a commonality of formats between various node-based programming environments then an interchange between backends and frontends would be possible. I was thinking of creating a python interpreter for node red flows but stopped at things such as jsonata support and mustache template engine. NodeRED does make much use of its underlying NodeJS roots.