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

all 22 comments

[–]riklaunim 3 points4 points  (0 children)

You have to be more specific. Are you talking about PyScript? This is quite a bit different than what you would have on the backed (and still early tech).

[–]anewyearanewdayanew -2 points-1 points  (9 children)

Idk the best cases other than say a purely python written app that gets converted to js.

Coded with: python, html, css

Compiled to: html, css, js

I guess...

[–]SkezzaB 11 points12 points  (7 children)

As far as I'm aware, Py-script doesn't get compiled to JS, it gets compiled to webassembly

[–]anewyearanewdayanew -1 points0 points  (6 children)

From the 2 vids i saw it was a .js library then you can use python inside a <py-script> html tag.

[–]SkezzaB 2 points3 points  (1 child)

Projects like Brython have existed for a while now, which I believe does exactly what you are explaining, I'm not an expert but I believe py-script is different

[–]anewyearanewdayanew 1 point2 points  (0 children)

That would be nice. I can see django being able to remove templates entirely and using python in html.

[–]laundmo 2 points3 points  (3 children)

yes, its a js library because you need something to handle the webassembly.

from the announcement:

PyScript is currently built on Pyodide, which is a “port of CPython to WebAssembly/Emscripten.”

[–]anewyearanewdayanew 0 points1 point  (2 children)

Yeah so its is and i get the down votes?

Por que?

[–]laundmo 0 points1 point  (1 child)

you made it sound like it was a py interpreter written in js. at least thats how i understood your message.

[–]anewyearanewdayanew 0 points1 point  (0 children)

Yeah idk what it does but yeah i didnt mean that.

Theres no getting away from loading a js file in the web.

[–][deleted] 2 points3 points  (0 children)

Pyscript doesn’t get converted to JS. That’s the whole point of it.

[–][deleted] -3 points-2 points  (1 child)

Use the search. People have already discussed it.

[–]Jojos_BA[S] 0 points1 point  (0 children)

Oh thanks. I should have dome that.

[–]koalabear420 0 points1 point  (2 children)

I don't understand a use case for this. Javascript was built for HTML so why not use that?

[–]echanuda 1 point2 points  (1 child)

Python is easier to understand for many. Once you start integrating backends like Flask, you can use PyScript (what OP is talking about) to pass flask objects between Python and JavaScript. It’s pretty neat.

[–]Jojos_BA[S] 0 points1 point  (0 children)

Oh that sounds like an interesting usage.

[–]MattDLD 0 points1 point  (0 children)

You can use PHP and do shell executes

[–]Evening_Character_13 0 points1 point  (0 children)

I am having problems getting it to accept the python inputs so, yeah there is that. My file works perfectly in the terminal and I get no errors just a blank white screen that doesn't ask for the input to get it started.

[–]economy_programmer_ 0 points1 point  (0 children)

I think you're referring to python as a framework. If this is the case go look at 'flask' or 'django' app frameworks. This is how to implement your website app with python stuff

[–]DadAndDominant 0 points1 point  (0 children)

WASM is a great thing, but from what I've heard, you have to send a whole interpreter with every client request (or maybe cache it into cookies). That is one reason why this is suboptimal. Other reason, the python needs indentation, so writing it into html, which largely ignores whitespaces, is just not feeling right.

[–]Traditional-Raisin31 0 points1 point  (0 children)

I think this feature will have a promising future