Show HN: PyWebIO – Write interactive web app in script way
github.com
github.com
You can use PyWebIO to build simple web applications or browser-based GUI applications without the need to have knowledge of HTML and JS.
The way of writing PyWebIO applications is more like writing a terminal program. You can think of the browser as a rich text terminal while writing PyWebIO app. If you have a terminal script, you only need to replace the input and output functions with PyWebIO's functions to turn your terminal script to a web application.
Features:
- Support click events, layout and output updates.
- Support integration into existing web project, currently supports Flask, Django, Tornado, aiohttp framework. - Support for asyncio and coroutine.
- Compatible with data visualization libraries, e.g., plotly, bokeh, pyecharts.
Links:
- Demos: http://pywebio-demos.demo.wangweimin.site/
- Documents: https://pywebio.readthedocs.io/en/latest/
PS: I am not a native speaker of English, so the documents may be a bit obscure. If you have any questions, please feel free to discuss on https://github.com/wang0618/PyWebIO/discussions
Great concept for building rapid applications.
I imagine this will let Python devs create small web front ends very easily .
I object! The docs and examples are fantastic.
While it's a little rough around the edges, idom has worked great for us. I look forward to trying out PyWebIO at some point - it targets a different but valid use case.
[0] idom-docs.herokuapp.com/ [1] https://streamlit.io/ [2] https://anvil.works/
Does anyone know something like these in Ruby ecosystem? For heavily invested in RoR apps such rapid prototyping from `irb`/`pry` would be a day saver.
Thanks to the author!
webio_view(task_func)
However, I'm not clear on what task_func is, what arguments it takes, etc. Is there an example of a function like this working with any of the supported web frameworks?
Curious.
In contrast, the way of writing PyWebIO app is more like writing a terminal program, except that the terminal here becomes a browser. The output functions will output content to user in real time, and the input functions will block until the user submit the input form.
I see some immediate applications for this at my job. Much appreciation!
Also does PyWebIO support defining inputs based on other ones? For example, to have a hierarchy of dropdowns (select company --> based on that selection, select employee --> etc).
PyWebIO now support defining inputs based on other ones, but I haven't written this feature into the documentation. Until then, you can solve this problem by splitting inputs with dependencies into multiple forms. (you can use first form to get company and then use another form to get employee)
Edit: actually did. Running apps from a directory was something I was looking for and there was only a third party effort for Streamlit for this - https://pywebio.readthedocs.io/en/latest/platform.html#direc...
Although PyWebIO is indeed a bit crude, the usage scenarios of PyWebIO and streamlit don't exactly overlap.
The idea here is to standardize widgets and use them from scripts. For now, it emulates whiptail command line which provides text widgets.
I may or may not have dropped an /s somewhere on the floor.
More details about deployment will be added to the documentation later.
{"event":"input_event","task_id":"main-140213579376912","data":{"event_name":"blur","name":"weight","value":"21"}}
{"command": "output", "spec": {"type": "markdown", "content": "Your BMI: `1458.3`, Category: `Severely obese`", "sanitize": true, "scope": "#pywebio-scope-ROOT", "position": -1}, "task_id": "main-140213579376912"}