[HN Gopher] Show HN: Hyperdiv - Reactive, immediate-mode web UI ...
       ___________________________________________________________________
        
       Show HN: Hyperdiv - Reactive, immediate-mode web UI framework for
       Python
        
       Hello HN,  I'm releasing Hyperdiv (https://hyperdiv.io), a
       framework for rapidly developing reactive browser UIs in Python,
       with immediate-mode syntax and using Shoelace
       (https://shoelace.style) as its built-in component system.  This
       short coding video will give you a good idea of what it is:
       https://www.youtube.com/watch?v=4XJKfxaqvGE  I wrote a brief
       article about the motivation and approach:
       https://hyperdiv.io/intro.html  Hyperdiv doesn't aim to compete
       with serious full-stack frameworks. The core aim was to make it
       easy and fast to prototype apps and build UI-based tools. I was
       originally motivated by internal tools at work -- feeling the need
       to quickly put together UI-based tools to share with both technical
       and non-technical coworkers, without having to stand up and
       maintain a full internal stack.  This is my first major open source
       release. I really appreciate your feedback and support. - Marius
        
       Author : mondrian
       Score  : 57 points
       Date   : 2024-02-20 14:23 UTC (8 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | ipython wrote:
       | Looks cool. How do you see this differing from streamlit?
       | https://streamlit.io/
        
         | mondrian wrote:
         | Thanks! Streamlit is really cool and is obviously mature and
         | successful. It seems to be influenced by Jupyter notebooks and
         | data science practice. It aims to be like Jupyter notebooks but
         | in code? Correct me if I'm wrong.
         | 
         | Hyperdiv is a generic framework with unrestricted layouts (but
         | you can use a template if you want), and a component
         | architecture where all components, whether UI components or
         | internal state, are fundamentally similar and expose stateful
         | props.
        
       | ipsum2 wrote:
       | The code in the intro blog post seems to be broken:
       | 
       | Hyperdiv does this:
       | 
       | def my_ui(hide_text=False): button("Button 1") if show_text:
       | text("Hello") button("Button 2")
        
         | mondrian wrote:
         | Yikes, what browser/os? Had a hard time repro-ing.
        
           | SushiHippie wrote:
           | I think what they mean, is that the function has the argument
           | hide_text, while the if statement uses the variable show_text
           | which is not defined in this scope
        
             | mondrian wrote:
             | Ahh thank you! I fixed it.
        
       | TrickardRixx wrote:
       | Does the task system use threading, multiprocessing, or something
       | else? I.E. can I do IO heavy tasks with this framework?
       | 
       | I'd like to read the docs myself to find out, but it seems like
       | they are not hosted on the website. I can see that I can install
       | the package and run the docs command, but I'd really rather use
       | the web browser I'm already in to explore a new (to me) project's
       | docs.
        
         | mondrian wrote:
         | The task system uses a thread pool as well as an ioloop. So
         | tasks can be normal functions as well as `async def`
         | functions/coroutines.
         | 
         | You can also pass in a custom executor and use processes
         | instead of threads.
         | 
         | Thanks for the feedback wrt docs app.
        
           | TrickardRixx wrote:
           | Thank you for releasing this project. It looks great! I just
           | need to find an excuse to try it out now.
        
       | theboat wrote:
       | looks neat. it would help if you hosted the demo apps rather than
       | expecting the user to install and run them themselves to get a
       | feel for it
       | 
       | https://github.com/hyperdiv/hyperdiv-apps/tree/main
        
         | mondrian wrote:
         | Thanks! I plan on putting the demo apps and docs app online.
        
       | hathawsh wrote:
       | Very cool. That video is impressive, although the audio is
       | superfluous. :-)
       | 
       | Have you tried training an AI chatbot to write Hyperdiv apps? It
       | seems like a good idea, and I'm just wondering whether you've
       | tried it and what the results have been like. I might try it
       | myself.
        
         | mondrian wrote:
         | Thanks! I am really interested in this topic, and I think it's
         | really promising. I've experimented with showing GPT-4 how
         | Hyperdiv works via examples and was impressed by how well it
         | was able to produce new apps, and even infer parts of the API I
         | didn't show it. I want to experiment with feeding the entire
         | API into an LLM.
         | 
         | In general I get the impression that this approach, of teaching
         | an LLM a small self-contained API like Hyperdiv's, can work
         | better/less hallucinatory compared to trying to build apps with
         | very large APIs like the DOM API.
        
         | toomim wrote:
         | > although the audio is superfluous.
         | 
         | It's so funny how subjective that is -- I liked the audio
         | enough to tell the author about it in a DM. Then I come to HN
         | and read that someone disagrees. :)
        
           | flashgordon wrote:
           | Haha - same here. I actualy thought it was a cool audio
           | (though slightly on the louder). Almost feel like there was a
           | rhythm to the developer writing code!
        
       | flashgordon wrote:
       | Holy crap that was cool. Very nice demo. Why would this _not_ be
       | a streamlit competitor. Also some part of me is thinking there
       | would be a huge synergy (yuck i hated using that word) by htmx
       | being involved here somehow?
        
         | mondrian wrote:
         | Thanks!
         | 
         | > htmx being involved
         | 
         | I think it's possible. Hyperdiv uses a custom DOM patching
         | system but I could imagine it being swapped for an existing
         | HTML over the wire tech.
        
         | cauch wrote:
         | or an alternative to nicegui.
         | 
         | I fully agree that it is a great project and that there is
         | plenty of space to have different frameworks with their
         | specialties that allow to choose the best one based on the
         | circumstances.
        
       | cdchn wrote:
       | They hooked me right off the bat with the "intro" clearly stating
       | the "problem" which aligns well with how I view it and reeled me
       | all the way in with "solutions" to those problems that are the
       | exact answers I wanted to see.
       | 
       | The proof is in the pudding but its safe to say I'm ALL THE WAY
       | interested right now.
        
       | physPop wrote:
       | This looks nice. But glaring issue I have is documentation: Don't
       | make people have to pull run code to get at the documentation.
       | Host it somewhere on your website or readthedocs.
        
         | mondrian wrote:
         | Thanks! I appreciate the feedback and plan to host the docs app
         | on the website in the future.
        
       | mattgreenrocks wrote:
       | This is really nice. I like the programming model a lot, even if
       | it has some restrictions compared to typical SPA/SSR model.
       | 
       | Makes me realize how webdev is still just teeming with stupid
       | levels of incidental complexity, and I'm not sure I trust webdevs
       | to actually get us out of the tarpit.
        
       | jchap wrote:
       | this is cool, and a way better executed/more fully featured
       | version of this poc i did a couple weeks ago :) which uses vue
       | under the hood
       | 
       | https://news.ycombinator.com/item?id=39353269
       | 
       | example app: https://github.com/thejchap/pue/blob/main/example.py
       | 
       | good luck! i think there's definitely something here with this
       | kind of thing
        
         | mondrian wrote:
         | Thanks! Pue looks cool, thanks for sharing. I see some
         | similarities to https://reflex.dev in terms of providing a
         | declarative dom expression language with built-in conditionals
         | and loop primitives.
        
       ___________________________________________________________________
       (page generated 2024-02-20 23:00 UTC)