GithubHelp home page GithubHelp logo

docs's Introduction

PyScript

What is PyScript

Summary

PyScript is a framework that allows users to create rich Python applications in the browser using HTML's interface and the power of Pyodide, MicroPython and WASM, and modern web technologies.

To get started see the Beginning PyScript tutorial.

For examples see here.

Other useful resources:

Every Tuesday at 15:30 UTC there is the PyScript Community Call on zoom, where we can talk about PyScript development in the open. Most of the maintainers regularly participate in the call, and everybody is welcome to join.

Every other Thursday at 16:00 UTC there is the PyScript FUN call: this is a call in which everybody is encouraged to show what they did with PyScript.

For more details on how to join the calls and up to date schedule, consult the official calendar:

Longer Version

PyScript is a meta project that aims to combine multiple 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 both to web and Python developers.

Try PyScript

To try PyScript, import the appropriate pyscript files into the <head> tag of your html page:

<head>
    <link
        rel="stylesheet"
        href="https://pyscript.net/releases/2024.6.2/core.css"
    />
    <script
        type="module"
        src="https://pyscript.net/releases/2024.6.2/core.js"
    ></script>
</head>
<body>
    <script type="py" terminal>
        from pyscript import display
        display("Hello World!") # this goes to the DOM
        print("Hello terminal") # this goes to the terminal
    </script>
</body>

You can then use PyScript components in your html page. PyScript currently offers various ways of running Python code:

  • <script type="py">: can be used to define python code that is executable within the web page.
  • <script type="py" src="hello.py">: same as above, but the python source is fetched from the given URL.
  • <script type="py" terminal>: same as above, but also creates a terminal where to display stdout and stderr (e.g., the output of print()); input() does not work.
  • <script type="py" terminal worker>: run Python inside a web worker: the terminal is fully functional and input() works.
  • <py-script>: same as <script type="py">, but it is not recommended because if the code contains HTML tags, they could be parsed wrongly.
  • <script type="mpy">: same as above but use MicroPython instead of Python.

Check out the official docs for more detailed documentation.

How to Contribute

Read the contributing guide to learn about our development process, reporting bugs and improvements, creating issues and asking questions.

Check out the developing process documentation for more information on how to setup your development environment.

Governance

The PyScript organization governance is documented in a separate repository.

Release

To cut a new release of PyScript simply add a new release while remembering to write a comprehensive changelog. A GitHub action will kick in and ensure the release is described and deployed to a URL with the pattern: https://pyscript.net/releases/YYYY.M.v/ (year/month/version - as per our CalVer versioning scheme).

Then, the following three separate repositories need updating:

  • Documentation - Change the version.json file in the root of the directory and then node version-update.js.
  • Homepage - Ensure the version referenced in index.html is the latest version.
  • PSDC - Use discord or Anaconda Slack (if you work at Anaconda) to let the PSDC team know there's a new version, so they can update their project templates.

docs's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docs's Issues

Feature Request: add a search button in the docs site

Hi

Would it be possible to add some sort of search functionality in the docs website? I can understand that it can be a lot of work but it would be a nice to have feature. Especially, when trying to understand the workings of pyscript classes.

mini-coi.js not happy.... at all

JS Console shows mini-coi.js complaining about scope within ServiceWorker registration.

docs.pyscript.net/:1 Uncaught (in promise) DOMException: Failed to register a ServiceWorker for scope ('https://docs.pyscript.net/2023.11.1.RC3/beginning-pyscript/') with script ('https://docs.pyscript.net/2023.11.1.RC3/javascripts/mini-coi.js'): The path of the provided scope ('/2023.11.1.RC3/beginning-pyscript/') is not under the max scope allowed ('/2023.11.1.RC3/javascripts/'). Adjust the scope, move the Service Worker script, or use the Service-Worker-Allowed HTTP header to allow the scope.

I also guess (total guess actually but I think @JeffersGlass looked into it) that it may be interfering with our ability to use pyscript-mkdocs to actually make the examples interactive

Missing list of downloadable versions

While some examples feature the location of download location for specific versions, it would be great to have a list for old versions. Build artefact attached to GH releases would be enough.

docs of older versions are not accessible

After the update the documentation for previous version is gone.

Following the recommendation to pin the pyscript version this makes a delayed migration hard.

Maybe this is out of scope for the current phase, still it would be convenient.

Embedded Demo Not Working?

image

This is on the RC2 docs release.

On Chromium version 117.0.5938.92 (Official Build) snap (64-bit)
Ubuntu 22.04.1 LTS

The Beginning PyScript has a hyperlink where 404 Not Found occurs

Checklist

  • I added a descriptive title
  • I searched for other issues and couldn't find a solution or duplication
  • I already searched in Google and didn't find any good information or help

What happened?

image

When I clicked the link on your guide on the Beginning PyScript webpage I see

image

The 'on your guide' hyperlink needs to be modified. I think on your guide route should be changed as below.

  • https://docs.pyscript.net/2023.11.1.RC3/beginning-pyscript/user-guide.md -> https://docs.pyscript.net/2023.11.1.RC3/user-guide/.

What browsers are you seeing the problem on? (if applicable)

Chrome

Console info

No response

Additional Context

No response

Documentation pages are returning 404s

If you go to https://pyscript.net and click on documentation it'll redirect you to https://docs.pyscript.net/latest/ which renders badly because of the inaccessibility of static resources, if you then proceed to click on any of the links e.g. https://docs.pyscript.net/latest/tutorials/getting-started.html it'll show a 404 Not Found page.

At the same time if you go directly to https://docs.pyscript.net/ it'll redirect you to https://docs.pyscript.net/2023.09.1/ which works but appears to be a revamp of the docs and probably not as complete.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.