Imagine a tool that makes front-end development more accessible to Python practitioners, and puts the power of Python into the hands of people that have historically focused on front-end development…
Introducing, PyScript!
Simply put, PyScript is a tool that brings Python to the browser. PyScript is programming for the 99%.
Here are some helpful resources to get you started on your PyScript adventures:
pyscript does not use backend processing in nodejs or any other backend tech. once you build from source you can host in aws s3 or netlify or any other static content hosting system
The latest LTS version didn’t work. google suggested using 16.13.2 as it used older version of npm. That managed to get past ‘npm install’, however the next command ‘npm run dev’ introduced a new error:
Hi, I love this project but I’m having an hard time trying to share data between Python and JavaScript.
I wrote a simple example but I’m not able to make it work.
I’d really appreciate some help, thank you!
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
<script defer src="https://pyscript.net/alpha/pyscript.js"></script>
</head>
<body>
<div id="div1"></div>
<div id="div2"></div>
<py-script>
py_string = "This is a Python string!"
</py-script>
<script>
var div1 = document.getElementById("div1");
var div2 = document.getElementById("div2");
var js_string = "This is a JavaScript string!";
div1.innerHTML = js_string
div2.innerHTML = py_string
</script>
<py-script>
from js import console
console.log(js_string)
</py-script>
</body>
</html>
Reading through this forum a lot of people seem to be misunderstanding the limitations of PyScript. Trying to use libraries that require access to system sockets, calls, or start processes.
While education is going to always be challenging with a library like this I wonder if it would make sense to highlight some common limitations on the front of the site itself? Like instead of using requests use pyfetch (or whatever library ends up being standardized, and a link to some documentation), and examples of things which can’t be done such as scanning user processes, or launching a new process, or connecting directly to sockets, etc…