I recently found an interesting project on github, it looks like this will be a new programming language in the future. How come? Now technology has advanced and developed over time.
What is PyScript
PyScript is a meta project that aims to incorporate several open technologies into a framework that allows users to create sophisticated browser applications with Python. It integrates seamlessly with the way the DOM works in the browser and allows users to add Python logic in a way that feels natural to both web and Python developers.
Please note that PyScript is very alpha and under heavy development. There are a lot of known issues, from usability to loading times, and you should expect things to change frequently. We encourage people to play and explore with PyScript, but we discourage using it for production at this time.
Try PyScript
To try out PyScript, import the appropriate pyscript file into your html page with:
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
<script defer src="https://pyscript.net/alpha/pyscript.js"></script>
You can then use the PyScript component in your html page. PyScript currently implements the following elements:
<py-script>
: can be used to define executable python code inside a web page. The element itself is not rendered to the page and is only used to add logic.<py-repl>
: creates a REPL component that renders to the page as a code editor and allows the user to write executable code.
Check out the example directory folder for more examples of how to use it, all you need to do is open it in Chrome.
Get started with PyScript
Using your favorite editor, create a new file called hello.html and fill it with the HTML code below.
<html>
<head>
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
<script defer src="https://pyscript.net/alpha/pyscript.js"></script>
</head>
<body> <py-script> print('Hello, World!') </py-script> </body>
</html>
Then open the file in your favorite browser, and see how cool this one project is. Even though it's not perfect right now because it takes quite a long time to load. To learn more, please visit some of the reference links below.