microoflow 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. microoflow-0.1.0/.gitignore +38 -0
  2. microoflow-0.1.0/LICENSE +22 -0
  3. microoflow-0.1.0/PKG-INFO +165 -0
  4. microoflow-0.1.0/README.md +134 -0
  5. microoflow-0.1.0/docs/api-reference.md +435 -0
  6. microoflow-0.1.0/docs/drag-drop-optimization-plan.md +335 -0
  7. microoflow-0.1.0/docs/v1-issue-tracker.md +87 -0
  8. microoflow-0.1.0/microoflow/__init__.py +38 -0
  9. microoflow-0.1.0/microoflow/__main__.py +7 -0
  10. microoflow-0.1.0/microoflow/app.py +165 -0
  11. microoflow-0.1.0/microoflow/cli.py +150 -0
  12. microoflow-0.1.0/microoflow/events.py +135 -0
  13. microoflow-0.1.0/microoflow/graph.py +194 -0
  14. microoflow-0.1.0/microoflow/py.typed +1 -0
  15. microoflow-0.1.0/microoflow/registry.py +319 -0
  16. microoflow-0.1.0/microoflow/reloader.py +462 -0
  17. microoflow-0.1.0/microoflow/runner.py +775 -0
  18. microoflow-0.1.0/microoflow/server.py +208 -0
  19. microoflow-0.1.0/microoflow/static/index.html +282 -0
  20. microoflow-0.1.0/microoflow/static/sdk/canvas.js +990 -0
  21. microoflow-0.1.0/microoflow/static/sdk/geometry.js +32 -0
  22. microoflow-0.1.0/microoflow/static/sdk/minimap.js +208 -0
  23. microoflow-0.1.0/microoflow/static/sdk/node_menu.js +480 -0
  24. microoflow-0.1.0/microoflow/static/sdk/output_viewer.js +109 -0
  25. microoflow-0.1.0/microoflow/static/sdk/renderers/base.js +174 -0
  26. microoflow-0.1.0/microoflow/static/sdk/renderers/data_view.js +162 -0
  27. microoflow-0.1.0/microoflow/static/sdk/renderers/html.js +694 -0
  28. microoflow-0.1.0/microoflow/static/sdk/renderers/index.js +35 -0
  29. microoflow-0.1.0/microoflow/static/sdk/renderers/markdown.js +622 -0
  30. microoflow-0.1.0/microoflow/static/sdk/renderers/raw_csv.js +50 -0
  31. microoflow-0.1.0/microoflow/static/sdk/renderers/raw_dict.js +123 -0
  32. microoflow-0.1.0/microoflow/static/sdk/renderers/raw_json.js +71 -0
  33. microoflow-0.1.0/microoflow/static/sdk/renderers/raw_list.js +84 -0
  34. microoflow-0.1.0/microoflow/static/sdk/renderers/syntax.js +585 -0
  35. microoflow-0.1.0/microoflow/static/sdk/renderers/table.js +323 -0
  36. microoflow-0.1.0/microoflow/static/sdk/store.js +507 -0
  37. microoflow-0.1.0/microoflow/static/sdk/viewport.js +165 -0
  38. microoflow-0.1.0/microoflow/static/studio/app.js +689 -0
  39. microoflow-0.1.0/microoflow/static/studio.css +1818 -0
  40. microoflow-0.1.0/microoflow/views.py +102 -0
  41. microoflow-0.1.0/pyproject.toml +77 -0
  42. microoflow-0.1.0/tests/conftest.py +9 -0
  43. microoflow-0.1.0/tests/js/canvas_sdk_dom.test.mjs +662 -0
  44. microoflow-0.1.0/tests/js/dom_harness.mjs +1040 -0
  45. microoflow-0.1.0/tests/js/renderers.test.mjs +992 -0
  46. microoflow-0.1.0/tests/js/store_and_geometry.test.mjs +377 -0
  47. microoflow-0.1.0/tests/test_cli.py +435 -0
  48. microoflow-0.1.0/tests/test_edge_cases.py +494 -0
  49. microoflow-0.1.0/tests/test_hot_reload.py +670 -0
  50. microoflow-0.1.0/tests/test_node_menu.py +471 -0
  51. microoflow-0.1.0/tests/test_runtime.py +745 -0
  52. microoflow-0.1.0/tests/test_sdk_js.py +43 -0
  53. microoflow-0.1.0/tests/test_server_and_sse.py +268 -0
  54. microoflow-0.1.0/tests/test_studio_e2e.py +525 -0
  55. microoflow-0.1.0/tests/test_views.py +1003 -0
@@ -0,0 +1,38 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ *.egg-info/
7
+ .Python
8
+ build/
9
+ dist/
10
+ wheels/
11
+
12
+ # Virtual environments
13
+ .venv/
14
+ venv/
15
+ env/
16
+
17
+ # Testing & tooling caches
18
+ .pytest_cache/
19
+ .mypy_cache/
20
+ .ruff_cache/
21
+ .coverage
22
+ htmlcov/
23
+
24
+ # Local workflow exports
25
+ *.flow.json
26
+
27
+ # Secrets & credentials
28
+ .env
29
+ .env.*
30
+ .pypirc
31
+
32
+ # Editor & OS files
33
+ .vscode/
34
+ .idea/
35
+ Thumbs.db
36
+ .DS_Store
37
+
38
+
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Avishek Sharma
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
@@ -0,0 +1,165 @@
1
+ Metadata-Version: 2.5
2
+ Name: microoflow
3
+ Version: 0.1.0
4
+ Summary: Lightweight pure-Python visual workflow runtime and zero-bundler Studio for Pydantic nodes.
5
+ Project-URL: Homepage, https://github.com/avisheksharmacoder/microoflow
6
+ Project-URL: Repository, https://github.com/avisheksharmacoder/microoflow
7
+ Project-URL: Documentation, https://github.com/avisheksharmacoder/microoflow/blob/main/docs/api-reference.md
8
+ Project-URL: Issues, https://github.com/avisheksharmacoder/microoflow/issues
9
+ Author-email: Avishek Sharma <avisheksharmacoder@gmail.com>
10
+ License: MIT
11
+ License-File: LICENSE
12
+ Keywords: dag,pipeline,pydantic,studio,visual-programming,workflow
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Typing :: Typed
24
+ Requires-Python: >=3.10
25
+ Requires-Dist: pydantic<3.0,>=2.7
26
+ Provides-Extra: dev
27
+ Requires-Dist: build>=1.2; extra == 'dev'
28
+ Requires-Dist: pytest>=8.0; extra == 'dev'
29
+ Requires-Dist: twine>=5.0; extra == 'dev'
30
+ Description-Content-Type: text/markdown
31
+
32
+ # Microoflow
33
+
34
+ Lightweight pure-Python visual workflow runtime and zero-bundler web Studio built around plain Pydantic `BaseModel` nodes.
35
+
36
+ The **o** in Micro-**o**-flow means **Optimized.**
37
+
38
+ Microoflow is designed to entirely change how you program workflows. Now, you can do it in native Python, No third type, No syntax, No BS. Just Pure, Simple, Pythonic Code only.
39
+
40
+ Oh yes, you get a Studio too. Damn right 😎.
41
+
42
+
43
+ - **Python:** `>= 3.10`
44
+ - **Core dependency:** `pydantic >= 2.7, < 3.0`
45
+ - **Zero frontend build tooling:** Vanilla HTML, CSS, and ES modules bundled directly inside the package
46
+
47
+
48
+ # Features 🐍
49
+ 1. **Zero dependencies:** No dependencies, No cross platform bundling, No OS native views, No C/C++/Rust runtimes, No multi-gigabyte downloads, No Docker files, No foreign tool installations, No Npm, No Crap Boostrapping.
50
+ 2. **Dead Simple Design:** Made for users first, Python developers second. There is no third type.
51
+ 3. **Pythonic:** You use standard python features (Classes, Pydantic, Typing) to define your workflows. Nothing else.
52
+ 4. **No Syntax:** All you need to write is 1 class, 1 function for one Node. LOL.
53
+ 4. **Modern UI:** Smooth Fluid UX, User Friendly Interface for Low Cognitive Design Load.
54
+ 5. **Live Feedback:** Change Python code, your Workflows update in real time, without any browser Reload.
55
+ 6. **Fast and Lightweight:** Uses Python, Pydanctic, HTML, CSS and Vanilla JavaScript only. No Webpack, No Vite, No Rollup, No Parcel, No Bundler at all.
56
+ 7. **Export and Share:** Save your workflows as JSON files and share them with others.
57
+ 8. **Theme Support:** Choose between Light and Dark themes. AI themes coming soon.
58
+ 9. **Node Customization:** 100% Customizable Nodes to fit your needs at any scale.
59
+ 10. **Open Source:** Open source, Free, no Paywalls 🤑.
60
+
61
+
62
+ ## Installation
63
+
64
+ ```bash
65
+ pip install microoflow
66
+ ```
67
+
68
+ ## Quickstart
69
+
70
+ Define workflow steps as standard `pydantic.BaseModel` classes with `input*` / `output*` fields and a synchronous or `async` `execute(self)` method:
71
+
72
+ ```python
73
+ import urllib.request
74
+ from pydantic import BaseModel
75
+ from microoflow import App, HTMLView
76
+
77
+ class UrlInput(BaseModel):
78
+ """Provides a normalized URL."""
79
+
80
+ input_url: str = "https://example.com"
81
+ output_url: str
82
+
83
+ def execute(self) -> None:
84
+ url = self.input_url.strip()
85
+ if not url.startswith(("http://", "https://")):
86
+ url = f"https://{url}"
87
+ self.output_url = url
88
+
89
+ class WebScraper(BaseModel):
90
+ """Fetches raw HTML from a URL."""
91
+
92
+ input_url: str
93
+ output_html: str
94
+
95
+ def execute(self) -> None:
96
+ req = urllib.request.Request(
97
+ self.input_url.strip(),
98
+ headers={"User-Agent": "Microoflow/1.0"},
99
+ )
100
+ with urllib.request.urlopen(req, timeout=10) as resp:
101
+ self.output_html = resp.read().decode("utf-8", errors="replace")
102
+
103
+
104
+ class HtmlViewer(HTMLView, BaseModel):
105
+ """Displays the scraped HTML natively in Studio."""
106
+
107
+ input_html: str
108
+
109
+
110
+ app = App(title="Web Scraper").register(
111
+ UrlInput,
112
+ WebScraper,
113
+ HtmlViewer
114
+ )
115
+
116
+ if __name__ == "__main__":
117
+ app.start()
118
+ ```
119
+
120
+ Launch the studio via Studio CLI
121
+ ```python
122
+ microoflow serve main:app
123
+ ```
124
+
125
+ ## Output
126
+ ![Microoflow Studio](https://raw.githubusercontent.com/avisheksharmacoder/microoflow/main/images/microoflow-studio.png)
127
+
128
+ ## CLI
129
+
130
+ ```bash
131
+ # Start Studio with automatic Python & static hot reloading
132
+ microoflow serve main:app
133
+
134
+ # Custom host/port, headless browser opt-out, or disable reloader
135
+ microoflow serve main:app --host 0.0.0.0 --port 9000 --no-browser --no-reload
136
+
137
+ # Execute a saved .flow.json workflow headlessly (exits 0 on pass, 1 on failure)
138
+ microoflow run main:app workflow.flow.json
139
+
140
+ # Also runnable as a Python module
141
+ python -m microoflow serve main:app
142
+ python -m microoflow --version
143
+ ```
144
+
145
+ ## Other Features
146
+
147
+ - **Pydantic Node Contract**: Every `input*` field becomes a left-side input port and every `output*` field becomes a right-side output port (up to 5 per side), supporting `int`, `float`, `str`, `bool`, `list`, `dict`, `Any`, `Optional[T]`, `Annotated[T, ...]`, `Field(default_factory=...)`, and both sync and `async def execute(self)`.
148
+ - **Compile-Time & Runtime Type Safety**: Blocks cycles, self-loops, and incompatible wires (`int -> float` widening allowed; `bool -> int` and mismatched types blocked) before execution, and enforces strict `TypeAdapter` validation across connections.
149
+ - **Zero-Bundler Visual Studio**: Searchable node palette (drag or double-click to spawn), smooth pan/zoom canvas, magnetic Bezier wiring, mini-map, canvas edit lock, and Dark/Light themes with Sans/Mono/Rounded font presets.
150
+ - **Node Menu & Settings Modal**: Right-click any node to run its subgraph (`target_node_id`), open per-instance **Node Settings** (also accessible via double-click on a node card), or delete it.
151
+ - **Native Output View Mixins (`*View`)**: Inherit alongside `pydantic.BaseModel` in either base-class order for rich inline cards and expandable modal viewers with pure-JS syntax highlighting:
152
+ - `MarkdownView` (`str`, `any`) — GFM Markdown renderer + highlighted source toggle
153
+ - `HTMLView` (`str`, `any`) — Sanitized `<iframe sandbox="">` preview + highlighted HTML/CSS/JS source toggle
154
+ - `CsvView` (`str`, `any`) — Line-numbered CSV view with delimiter/dimension summary
155
+ - `JsonView` (`str`, `dict`, `list`, `any`) — Formatted & syntax-highlighted JSON view
156
+ - `DictView` (`dict`, `any`) — Structured key/value tree + raw JSON toggle
157
+ - `ListView` (`list`, `any`) — Indexed sequence view + raw JSON toggle
158
+ - `TableView` (`str`, `list`, `dict`, `any`) — Sticky-header table with modal search/sort and CSV/JSON raw toggle
159
+ - `DataView` (`str`, `int`, `float`, `bool`, `any`) — Native display for scalars, `None`, `tuple`, and arbitrary Python objects
160
+ - **DAG Runtime & Live SSE Telemetry**: Executes topologically with mutable input isolation across wires, downstream error skipping, cooperative cancellation (`POST /api/stop` / `runner.stop()`), per-node `stdout`/`stderr` capture, and `/api/inspect/{run_id}/{node_id}`.
161
+ - **Headless Execution**: Run saved `.flow.json` graphs from Python via `app.run_file("workflow.flow.json")` or `app.runner.run_sync(payload)`.
162
+
163
+ ## License
164
+
165
+ MIT License — see `LICENSE` for details.
@@ -0,0 +1,134 @@
1
+ # Microoflow
2
+
3
+ Lightweight pure-Python visual workflow runtime and zero-bundler web Studio built around plain Pydantic `BaseModel` nodes.
4
+
5
+ The **o** in Micro-**o**-flow means **Optimized.**
6
+
7
+ Microoflow is designed to entirely change how you program workflows. Now, you can do it in native Python, No third type, No syntax, No BS. Just Pure, Simple, Pythonic Code only.
8
+
9
+ Oh yes, you get a Studio too. Damn right 😎.
10
+
11
+
12
+ - **Python:** `>= 3.10`
13
+ - **Core dependency:** `pydantic >= 2.7, < 3.0`
14
+ - **Zero frontend build tooling:** Vanilla HTML, CSS, and ES modules bundled directly inside the package
15
+
16
+
17
+ # Features 🐍
18
+ 1. **Zero dependencies:** No dependencies, No cross platform bundling, No OS native views, No C/C++/Rust runtimes, No multi-gigabyte downloads, No Docker files, No foreign tool installations, No Npm, No Crap Boostrapping.
19
+ 2. **Dead Simple Design:** Made for users first, Python developers second. There is no third type.
20
+ 3. **Pythonic:** You use standard python features (Classes, Pydantic, Typing) to define your workflows. Nothing else.
21
+ 4. **No Syntax:** All you need to write is 1 class, 1 function for one Node. LOL.
22
+ 4. **Modern UI:** Smooth Fluid UX, User Friendly Interface for Low Cognitive Design Load.
23
+ 5. **Live Feedback:** Change Python code, your Workflows update in real time, without any browser Reload.
24
+ 6. **Fast and Lightweight:** Uses Python, Pydanctic, HTML, CSS and Vanilla JavaScript only. No Webpack, No Vite, No Rollup, No Parcel, No Bundler at all.
25
+ 7. **Export and Share:** Save your workflows as JSON files and share them with others.
26
+ 8. **Theme Support:** Choose between Light and Dark themes. AI themes coming soon.
27
+ 9. **Node Customization:** 100% Customizable Nodes to fit your needs at any scale.
28
+ 10. **Open Source:** Open source, Free, no Paywalls 🤑.
29
+
30
+
31
+ ## Installation
32
+
33
+ ```bash
34
+ pip install microoflow
35
+ ```
36
+
37
+ ## Quickstart
38
+
39
+ Define workflow steps as standard `pydantic.BaseModel` classes with `input*` / `output*` fields and a synchronous or `async` `execute(self)` method:
40
+
41
+ ```python
42
+ import urllib.request
43
+ from pydantic import BaseModel
44
+ from microoflow import App, HTMLView
45
+
46
+ class UrlInput(BaseModel):
47
+ """Provides a normalized URL."""
48
+
49
+ input_url: str = "https://example.com"
50
+ output_url: str
51
+
52
+ def execute(self) -> None:
53
+ url = self.input_url.strip()
54
+ if not url.startswith(("http://", "https://")):
55
+ url = f"https://{url}"
56
+ self.output_url = url
57
+
58
+ class WebScraper(BaseModel):
59
+ """Fetches raw HTML from a URL."""
60
+
61
+ input_url: str
62
+ output_html: str
63
+
64
+ def execute(self) -> None:
65
+ req = urllib.request.Request(
66
+ self.input_url.strip(),
67
+ headers={"User-Agent": "Microoflow/1.0"},
68
+ )
69
+ with urllib.request.urlopen(req, timeout=10) as resp:
70
+ self.output_html = resp.read().decode("utf-8", errors="replace")
71
+
72
+
73
+ class HtmlViewer(HTMLView, BaseModel):
74
+ """Displays the scraped HTML natively in Studio."""
75
+
76
+ input_html: str
77
+
78
+
79
+ app = App(title="Web Scraper").register(
80
+ UrlInput,
81
+ WebScraper,
82
+ HtmlViewer
83
+ )
84
+
85
+ if __name__ == "__main__":
86
+ app.start()
87
+ ```
88
+
89
+ Launch the studio via Studio CLI
90
+ ```python
91
+ microoflow serve main:app
92
+ ```
93
+
94
+ ## Output
95
+ ![Microoflow Studio](https://raw.githubusercontent.com/avisheksharmacoder/microoflow/main/images/microoflow-studio.png)
96
+
97
+ ## CLI
98
+
99
+ ```bash
100
+ # Start Studio with automatic Python & static hot reloading
101
+ microoflow serve main:app
102
+
103
+ # Custom host/port, headless browser opt-out, or disable reloader
104
+ microoflow serve main:app --host 0.0.0.0 --port 9000 --no-browser --no-reload
105
+
106
+ # Execute a saved .flow.json workflow headlessly (exits 0 on pass, 1 on failure)
107
+ microoflow run main:app workflow.flow.json
108
+
109
+ # Also runnable as a Python module
110
+ python -m microoflow serve main:app
111
+ python -m microoflow --version
112
+ ```
113
+
114
+ ## Other Features
115
+
116
+ - **Pydantic Node Contract**: Every `input*` field becomes a left-side input port and every `output*` field becomes a right-side output port (up to 5 per side), supporting `int`, `float`, `str`, `bool`, `list`, `dict`, `Any`, `Optional[T]`, `Annotated[T, ...]`, `Field(default_factory=...)`, and both sync and `async def execute(self)`.
117
+ - **Compile-Time & Runtime Type Safety**: Blocks cycles, self-loops, and incompatible wires (`int -> float` widening allowed; `bool -> int` and mismatched types blocked) before execution, and enforces strict `TypeAdapter` validation across connections.
118
+ - **Zero-Bundler Visual Studio**: Searchable node palette (drag or double-click to spawn), smooth pan/zoom canvas, magnetic Bezier wiring, mini-map, canvas edit lock, and Dark/Light themes with Sans/Mono/Rounded font presets.
119
+ - **Node Menu & Settings Modal**: Right-click any node to run its subgraph (`target_node_id`), open per-instance **Node Settings** (also accessible via double-click on a node card), or delete it.
120
+ - **Native Output View Mixins (`*View`)**: Inherit alongside `pydantic.BaseModel` in either base-class order for rich inline cards and expandable modal viewers with pure-JS syntax highlighting:
121
+ - `MarkdownView` (`str`, `any`) — GFM Markdown renderer + highlighted source toggle
122
+ - `HTMLView` (`str`, `any`) — Sanitized `<iframe sandbox="">` preview + highlighted HTML/CSS/JS source toggle
123
+ - `CsvView` (`str`, `any`) — Line-numbered CSV view with delimiter/dimension summary
124
+ - `JsonView` (`str`, `dict`, `list`, `any`) — Formatted & syntax-highlighted JSON view
125
+ - `DictView` (`dict`, `any`) — Structured key/value tree + raw JSON toggle
126
+ - `ListView` (`list`, `any`) — Indexed sequence view + raw JSON toggle
127
+ - `TableView` (`str`, `list`, `dict`, `any`) — Sticky-header table with modal search/sort and CSV/JSON raw toggle
128
+ - `DataView` (`str`, `int`, `float`, `bool`, `any`) — Native display for scalars, `None`, `tuple`, and arbitrary Python objects
129
+ - **DAG Runtime & Live SSE Telemetry**: Executes topologically with mutable input isolation across wires, downstream error skipping, cooperative cancellation (`POST /api/stop` / `runner.stop()`), per-node `stdout`/`stderr` capture, and `/api/inspect/{run_id}/{node_id}`.
130
+ - **Headless Execution**: Run saved `.flow.json` graphs from Python via `app.run_file("workflow.flow.json")` or `app.runner.run_sync(payload)`.
131
+
132
+ ## License
133
+
134
+ MIT License — see `LICENSE` for details.