There are a lot of Python to web app frameworks going around these days but I wanted something that was a little more lightweight that just generates HTML pages and can be embedded in Flask or other Python web servers incrementally.<p>PyVibe uses Python components to construct a page with styling that you can use in Flask, in a static site, or even in Pyodide.
I noticed:<p><script src="<a href="https://cdn.tailwindcss.com"></script>" rel="nofollow">https://cdn.tailwindcss.com"></script></a><p>in the source of the homepage. Just FYI the tailwind people say that's just for dev mode and never deploy that to prod. Instead you gotta run something like:<p>npx tailwindcss -o ../assets/css/tail.min.css --minify<p>and then replace the script with:<p><link rel="stylesheet" type="text/css" href="/assets/css/tail.min.css"><p>"a script referred to as the Tailwind Play CDN. This script is only to be used for learning and experimenting, never for a live site."<p>from <a href="https://www.codeinwp.com/blog/tailwind-css-tutorial/" rel="nofollow">https://www.codeinwp.com/blog/tailwind-css-tutorial/</a>
I love new technology, and this is really cool. I don't want to derail the discussion too much, but I've noticed this trend of "making web dev easier with just Python" - e.g. htmx, pynecone, streamlit, etc. The common theme seems to be magically hiding JS from the developer.<p>Can any python devs who use these tools explain the appeal? Do you just have an aversion to JS? And how do you reconcile that with the fact that, at the end of the day, your code is running in the browser as JS, CSS, and HTML? As soon as you need to debug something, you'll be a fish out of water. To me that sounds like a "worst of both worlds" kind of situation.<p>Is JS really <i>that</i> bad?
As someone who knows Python and always has to google CSS properties and javascript functions, this is a really sweet little project! I'm not going to reach for this if I need to have a website that needs to look a very specific way, but for cranking something out to display some data or documentation, this seems really nice.
Interesting. I’ll try it out with my students. Doing HTML and CSS in a Flask app seems advanced to them. I can recommend a “deploy to PythonAnywhere” guide so users can get it online. That would require your module to be part of PythonAnywhere’s environment.
So cool! Is there support for layouts?<p>Edit: Aw broken link - <a href="https://www.pycob.com/components" rel="nofollow">https://www.pycob.com/components</a><p>Edit: Nevermind, found it - <a href="https://www.pyvibe.com/component_reference.html" rel="nofollow">https://www.pyvibe.com/component_reference.html</a>
The HTML markup in the form example is not valid. Label for attributes correspond to the input's id – not its name.<p>I'd be really hesitant using a technology that abstracts away something as fundamental as HTML. You're putting a lot of faith and trust into a library that will make mistakes that you can't fix.
I'm curious about the performance implications of using a Python-centric approach for creating web pages. Would the generated HTML pages be as efficient and optimized as those created with traditional web development techniques?
I wonder what it would look like if websocket support was added. Perhaps add_* would return Sink objects which would have appropriate update methods that could be called in another thread? But that would require a page.run() function
I'm just not convinced how useful this will be. On one side you're very limited to the default style and list of available components. On the otger side you have to learn a new framework. It seems to me if you invest the time into a static web framework instead, you can design sites like this just as quickly while being able to dig deeper into html and css whenever you need to.
JSX, Vue, or even django templates spoiled me so this imperative Python syntax sends my eyes spinning and I cant even think about reading somebody's nested loops. Has anybody got used to this syntax for complex layouts? Or has anybody made a templating language for this?
I'm planning to add something like this to <a href="https://inventai.xyz" rel="nofollow">https://inventai.xyz</a>. Subscriptions aren't ready, so you can't actually generate anything yet.
It's bit odd. You would want the form to be handled by Django forms system or wtforms in Flask - and having third party package to provice CSS for the classes they used (or you use on a wrapper element).<p>And you can make reusable components with Jinja or Django templates as well.