# Pyodide: A browser port of CPython 3.9
## Pitch
Does your Python project need a fancy GUI? Do you want to provide the
simplest installation experience for users possible? Perhaps you have lots of
nonprogrammer users that get confused installing Python? Or users that only need
your package a couple of times and are not willing to do an install.
Everyone has a web browser on their computer, and their browser will run any
code sent to it over the internet. Using Pyodide, your Python application can
join in the fun.
## What is Pyodide?
Pyodide is a port of the Python 3.9 interpreter and 80+ common Python packages
to the browser, including packages for scientific computing, for parsing html, xml, yaml, etc.
## How do I use do it?
We will give some simple example projects. Basically:
1. Write a Python package in the normal way
2. tar or zip the Python package
3. serve the package
4. Make a Javascript file that starts the Pyodide runtime, your package and any
dependencies you need. Once done loading, use
`my_py_pkg = pyodide.pyimport("my_pkg")`
to get a Javascript reference to your package. At this point, you can start
calling your entrypoints from Javascript e.g., `my_py_pkg.main("hi")`,
`await my_py_pkg.get_info.callKwargs("a string", { timeout : 2 })`.
Some possible example projects. (Maybe ask community for suggestions.)
### Simple examples
Would work through some of these in detail.
1. Hello world
2. A project with more involved pure computation
3. Using asyncio from Python to fetch resources
4. Text based input, image output, write to canvas?
### More complicated demos
These we can display maybe display and sumarize in words but not get into much detail.
1. Full webworker + main thread with syncio and a GUI
2. Webworker + main thread + service worker (like)
## How do I know if my project is suitable for porting?
Purely computational projects are simple to port. We are missing threading and
multiprocessing, so you will need to be able to run single threaded.
File system code mostly works unchanged. If you use the file system for input or
output, it takes extra steps to get users' work into the file system or your
results out.
Pretty much all UI is radically different inside the browser. If your
application is a CLI, it's possible for it to operate completely unchanged if
you set up synchronous I/O, but we don't have out of the box support for
synchronous I/O yet.
Packages with a clean divide between doing computation and doing UI will be
simpler to port, the UI parts may need to be rewritten or shimmed but the pure
computation need not be. Making Python UIs work is not impossible, note that we
have a working copy of matplotlib. Writing an image from Python memory into a
canvas is fine. etc etc.