Pyflow – Visual and modular block programming in Python
github.com
github.com
However, I think this needs some serious brand work to distinguish it from "visual programming," which multiple commenters have already confused it for.
Visual workflow languages work in a bunch of different ways. Nodes, in Blender, is a visual programming environment. Blockly is a visual programming environment. Those nodes in scratch have code behind them!
> An open-source tool for visual and modular block programing (sic) in python
If they wanted to distance it from visual programming, they have done a bad job at it.
I would want 99% of nodes to be single function calls.
I imagine that is the kind of problem this is meant to solve--drawing out and visually solidifying that structure. From this perspective, I'm not sure if there's much apparent value in making the 1 cell <==> 1 function call constraint the default.
* Target language agnostic (this one seems to get mostly there) -- the nodes communicate data/logic flow, you then serialize/deserialize accordingly. * Focus on data flow, not just execution -- IO from nodes, visual indicators of data types (colors or something) * Capable of visually encapsulating complexity -- define flows within flows * Ideally embeddable in web apps (e.g a browser/electron frontend or something)
These are pretty popular to embed in complex "design" oriented applications, especially ones that involve crafting procedures by non-programmers (e.g. artists, data scientists, etc). Examples where this is implemented that come to mind include Blender, Unity, and Unreal.
A core part of the fundamental design of each one of the successful implementations is that they allow efficient code to be crafted by people who don't think they understand code. Making it visual helps engage the brains of certain kinds of people. The "code as text" paradigm is spatially efficient, but it's like a brick wall for some people.
I'm pretty okay with the general shape of code (a nested tree-type structure), but think the possible interactions are unnecessarily awkward by being forced into a text editor.
You ought to be able to effortlessly fold, move around and disable/enable blocks of code. There's not much of a point in allowing indentation or whitespace mistakes and it doesn't usually make much sense to select a part of a token (or often even just a token without the block it's attached to).
These issues can mostly be fixed by representing tokens and lines in a tree-like structure of nodes, for which useful editors already exist.
IDEs try to retrofit these things into their text model (the most advanced one I'm aware of being IntelliJ), with automatic indentation fixing and folding, but even the best attempts aren't even using 20% of the potential.
My most jarring example of how bad IDEs still are at this is folding + disabling (commenting out): When I comment out a block of code because I don't care about it that is folded because I don't care about it, it shows it back to me even though I don't want to see it because I double-don't care about it!
(Side note: I'm aware XCode doesn't do this, but it's far from general)
There is so much effort put into concepts, parsing and whatever, and everything uses trees, because that's the natural way of reasoning about code. Why are we still stuck interfacing with it through an awkwardly serialized version?
Also of note, the language is statically typed, with generics. It handles loops, branches, and functions are first class. Recursion is not supported at present.
In time we also plan to build a LLVM backend, so an intermediate language won't be required. Currently the compiler is written in TS, but as it matures more we intend to make the language compile itself.
If you want to talk, seek me out (I work for Northrop Grumman Australia).
If you want a demo or just time to chat, I'm available at javier at hal9.ai.
Time is a flat circle. I'm sure this has been attempted countless times before, but it never seems to stick around.
[0] https://github.com/AIFanatic/CanvasGraphEngine [1] https://raw.githubusercontent.com/AIFanatic/CanvasGraphEngin...
It's a really interesting platform and his Twitter feed shows you all sorts of interesting and innovative uses he's making of it so far!
See this previous HN thread on the topic (though it's evolved quite a bit since!) -- https://news.ycombinator.com/item?id=26790285
The modelling software I was thinking about is FlexSim by the way
[1] - https://www.ni.com/en-us/support/downloads/tools-network/dow...
PyFlow – Visual scripting framework for Python – NodeRED alternative? - https://news.ycombinator.com/item?id=29955623 - Jan 2022 (53 comments)
?
Both about PyFlow, but the first one should probably not be used. They also changed the license from Apache 2.0 to GPL-3.0 (probably a smart move).
That make this post deserve some time on HN. Glad that someone is breathing fresh air into the project.
This is a problem. If you require users to define dependencies for you, they will make mistakes and things will go wrong in ways that are incredibly difficult to debug. This is already a huge pain point with Jupyter notebooks, and they're only one-dimensional!
Have you considered going the route of Observable notebooks [1]? In an Observable notebook, each cell can export at most one variable. This means that the notebook can automatically determine dependencies statically, run cells in the correct order, and even show the user a viz of dependencies.
On top of that, Pyflow seems to rely on the user to define dependencies between blocks as well. This means that the user would have to both perfectly maintain the convention of one-variable-per-block, but also link every block that touches that variable going forward. Without ever making a mistake. It's such a well-defined graph problem that it's practically made for computers to handle, not fleshy people.
This is why tools are so important: they can impose constraints that allow you to act more freely elsewhere. When I change a cell in Observable or add a reference, I don't have to think. The engine handles dependencies for me, without fail. I can't make an entire class of errors, which means I can just focus on functionality.
1. You don't recalculate other variables if only one needs to update. For example, if a cell exports two variables, and a dependency of one of them updates, you're forced to re-evaluate the whole cell.
2. I think the UX plays out simpler if you limit it to one variable. It basically reads like `myVar = {...}` at the top of the cell. It's a bit trickier if you try to support exporting multiple variables at once.
3. If you find yourself needing to tie several values together, you can still manage it by exporting a single dictionary value!
We used it on financial data. One of our programs was so complex that we fell back on using a text editor to directly edit the XML instead of using the GUI.
The project was published on pypi but for some reason the source code was never published and it is in the same state since 2011, using python 2 and all. I left the place 2 years ago but my colleagues who still work there said it's still mission-critical. A kind of Cobol.
FWIW, there are plenty of graph-based dev tools, especially in the data science & ML world, and they seem to only fit the nerdiest of audiences (like mine!) ; not very practical for most people.
And don't forget about Blender!
blender is closing in
I think Haskell is actually non-strict, and not lazy, for example. It’s important because hard to optimise otherwise!
[0]https://docs.blender.org/manual/en/2.79/render/blender_rende... [1]https://www.rhino3d.com/6/new/grasshopper/ [2]https://blog.vectorworks.net/what-is-marionette-a-look-at-ve... [3]https://dynamobim.org
edit: basic math is a good example.
(a+b) / c * 3 + 7 is very easy to write out in code, but is going to include the following nodes to express
a
b
+
/
c
*
+
7
and lines between them to connect data and functions. Gross. Ue4 technically has a mathematical expression node for this specific case but its one of the more painful things without it.
This will join a crowded graveyard of visual ML tools along with the likes of ML.Net or Azure ML Studio Whatever, KNIME, CreateML, PyCaret, Teachable Machine, etc etc etc.
The pattern is very predictable. Nice demo. Excitement hits real-world problem. Complexity. Implosion.
Diffs will still be a problem though. I wouldn't touch this stuff with a ten foot pole.
there's code. did you click through?
BTW, if anybody gets WebAssemly with PyQt5 working, such that I can made a web page that is QGraphicsView, I would be sooooo happy.
Do you know if the entire build process for the site is available (IE, a simple example I can steal to get a QGraphicsView (C++) in a web page?