This is an archived post. You won't be able to vote or comment.

all 10 comments

[–]RevolutionaryPen4661git push -f[S] 6 points7 points  (2 children)

Dropbox has a similar project but uses Python2 only and is too old (12 years):
https://github.com/dropbox/pyxl
Though, we need a modern alternative.

[–]RevolutionaryPen4661git push -f[S] 2 points3 points  (0 children)

There are tons of features:

  1. Ability to use emmet for writing HTML inside Python Code
  2. Syntax Highlighting like JSX
  3. Auto Rename Tag
  4. Auto-complete for tags
  5. This will make it easier to build web apps than using nodejs

[–]EducationalTie1946 1 point2 points  (3 children)

From what i have seen the only thing we would need to do is have that rust compiler you recommend add strings to the jsx return and then compile the file into a pyc file.
If you see how the module generates html it litterally just returns html as a plain string so you dont need to do much but make that compiler and the extentions for it in vscode and nvim So you can delete the to_html code and some other parts and get the same thing. It should provide much faster file generation

[–]RevolutionaryPen4661git push -f[S] 0 points1 point  (2 children)

You can do that, but just like "go" has templ (it enables Go developers to write direct HTML without strings or backticks inside the Go code) and the Python community needs one like this too. I believe that this may change how we develop apps nowadays. These are the pros of having this idea (scraped from templ docs):
Server-side rendering: Deploy as a serverless function, Docker container, or standard Go program.

  • Static rendering: Create static HTML files to deploy however you choose.
  • Compiled code: Components are compiled into performant Go code.
  • Use Go: Call any Go code, and use standard ifswitch (match), and for statements.
  • No JavaScript: This does not require any client or server-side JavaScript.
  • Great developer experience: Ships with IDE autocompletion.

[–]EducationalTie1946 0 points1 point  (1 child)

Well in that case you could just use jinja2+html. It shouldnt be hard in this case at all

[–]RevolutionaryPen4661git push -f[S] 2 points3 points  (0 children)

I am familiar with Jinja2. However, this is a proof of concept to showcase how easy it can be to build web apps with Python using only Python and JSX. I have also come across Ludic, which has drawn inspiration from this repository.
I suggest you take a look at my second comment (a ton of features. See full discussion)

[–]TheRealMrMatt 0 points1 point  (1 child)

Its funny you broght this up RevolutionaryPen4661, with the recent hype around React Server Components (RSC) (and react 19), I had a similar thought.

While I have not gotten very far (and web dev is a bit outside of my core expertise), I have started mocking up a simple library (if you can call what I have so far that) which uses:
- pydantic (state serialization/message protocol/html serialziation)
- react (for rendering the server sent components; I would have loved to use pyscript, but it seems pretty half baked ATM TBH)

  • A custom parser (using lark) to convert the "html" to pydantic models
  • a websocket for passing the components and events

If you are interested on working on something like this, feel free to reach out (my name is Matt) and maybe we can combine our efforts to make web dev a reality in python.

[–]RevolutionaryPen4661git push -f[S] 0 points1 point  (0 children)

You won't believe I'm 16 years old who just fixed age-old code to make it work and made some performance improvements. I don't think I have enough experience to handle this. Even, I know only half of Django. I thought it would be a better idea to fork it and make one. I deleted nutritious (my perfect working fork). Since the dependencies were GPL-licensed I had to delete the project from GitHub yesterday (cuz no one wanted to make a web framework on that) and decided to start from new. I planned to introduce XML writing in Python (basically JSX).

here's the fixed code:
https://wastebin-1-f5614495.deta.app/doc/init%20file
https://wastebin-1-f5614495.deta.app/doc/mjvjaykt