2019-06-22 22:22:39 +00:00
|
|
|
Pyodide
|
|
|
|
=======
|
|
|
|
|
|
|
|
|
2021-12-13 17:36:35 +00:00
|
|
|
Pyodide is a Python distribution for the browser and Node.js based on WebAssembly.
|
2019-06-22 22:22:39 +00:00
|
|
|
|
2021-12-13 17:36:35 +00:00
|
|
|
What is Pyodide?
|
|
|
|
----------------
|
2019-06-22 22:22:39 +00:00
|
|
|
|
2022-01-04 15:46:00 +00:00
|
|
|
Pyodide is a port of CPython to WebAssembly/`Emscripten <https://emscripten.org/>`_.
|
2019-06-22 22:22:39 +00:00
|
|
|
|
2021-12-13 17:36:35 +00:00
|
|
|
Pyodide makes it possible to install and run Python packages in the browser with
|
2022-01-04 15:46:00 +00:00
|
|
|
`micropip <https://pyodide.org/en/stable/usage/api/micropip-api.html>`_. Any pure
|
|
|
|
Python package with a wheel available on PyPI is supported. Many packages with C
|
2021-12-13 17:36:35 +00:00
|
|
|
extensions have also been ported for use with Pyodide. These include many
|
|
|
|
general-purpose packages such as regex, pyyaml, lxml and scientific Python
|
|
|
|
packages including numpy, pandas, scipy, matplotlib, and scikit-learn.
|
|
|
|
|
|
|
|
Pyodide comes with a robust Javascript ⟺ Python foreign function interface so
|
|
|
|
that you can freely mix these two languages in your code with minimal
|
|
|
|
friction. This includes full support for error handling (throw an error in one
|
|
|
|
language, catch it in the other), async/await, and much more.
|
|
|
|
|
|
|
|
When used inside a browser, Python has full access to the Web APIs.
|
2021-11-15 09:30:59 +00:00
|
|
|
|
2022-01-04 15:46:00 +00:00
|
|
|
Try Pyodide
|
|
|
|
-----------
|
2021-11-15 09:30:59 +00:00
|
|
|
|
|
|
|
Try Pyodide in a
|
2022-11-10 14:53:37 +00:00
|
|
|
`REPL <./console.html>`_ directly in
|
2022-01-04 15:46:00 +00:00
|
|
|
your browser (no installation needed).
|
2021-11-15 09:30:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
Table of contents
|
|
|
|
-----------------
|
|
|
|
|
2019-06-22 22:22:39 +00:00
|
|
|
Using Pyodide
|
2021-11-15 09:30:59 +00:00
|
|
|
^^^^^^^^^^^^^
|
2019-06-22 22:22:39 +00:00
|
|
|
|
|
|
|
.. toctree::
|
2021-11-15 09:30:59 +00:00
|
|
|
:maxdepth: 1
|
2019-06-22 22:22:39 +00:00
|
|
|
|
2021-01-18 19:56:47 +00:00
|
|
|
usage/quickstart.md
|
2021-08-11 10:00:44 +00:00
|
|
|
usage/downloading-and-deploying.md
|
2021-08-12 09:39:13 +00:00
|
|
|
usage/index.md
|
2021-01-18 19:56:47 +00:00
|
|
|
usage/loading-packages.md
|
2024-02-27 15:20:26 +00:00
|
|
|
usage/loading-files.md
|
2021-05-02 13:42:28 +00:00
|
|
|
usage/wasm-constraints.md
|
2024-02-27 15:20:26 +00:00
|
|
|
usage/type-conversions.md
|
2021-09-26 18:53:46 +00:00
|
|
|
usage/keyboard-interrupts.md
|
Implement more detailed streams support (#3268)
Resolves https://github.com/pyodide/pyodide/issues/3112
This adds a carefully designed API for controlling stdin, stdout, and stderr. It changes
the default behavior to be a bit more useful, though in doing so introduces some mild
backwards incompatibility. In particular:
1. By default, stdin reads directly from `process.stdin` in node (as before) and raises an
error if in browser (not as before).
2. By default, stdout writes directly to `process.stdout` in node (before it called console.log)
and calls console.log in browser (as before).
3. By default, stderr writes directly to `process.stderr` in node (before it called console.warn)
and calls console.warn in browser (as before).
4. In all three cases, by default isatty(stdin/stdout/stderr) is true in node and false in browser
(in the browser it used to be true).
5. As before, if you pass `stdin`, `stdout`, or `stderr` as arguments to `loadPyodide`, `isatty` of
the corresponding stream is set to false.
The stdin function is now more flexible: we now correctly handle the case where it returns an
ArrayBuffer or ArrayBufferView.
I also added 3 new functions to set streams after Pyodide is loaded which offer additional
control:
* `setStdin({stdin?, error?, isatty = false})` -- Sets the stdin function. The stdin function takes no
arguments and should return null, undefined, a string, or a buffer. Sets and `isatty(stdin)` to
`isatty` (by default `false`). If error is true, set stdin to always raise an EIO error when it is read.
* `setStdout({raw?, batched?, isatty = false})` -- If neither raw nor batched is passed, restore
default stdout behavior. If rwa is passed, the raw stdout function receives a byte which it should
interpret as a utf8 character code. Sets `isatty(stdout)` to isatty (by default `false`). If batched is
passed but not raw, it sets a batched stdout function. The stdout function receives a string and
should do something with it. In this case it ignores isatty and sets isatty(stdout) to false.
* `setStderr({raw?, batched?, isatty = false})` -- same but with stderr.
2022-12-18 23:55:52 +00:00
|
|
|
usage/streams.md
|
2021-01-18 19:56:47 +00:00
|
|
|
usage/api-reference.md
|
|
|
|
usage/faq.md
|
2019-06-22 22:22:39 +00:00
|
|
|
|
2021-04-20 18:26:44 +00:00
|
|
|
Development
|
2021-11-15 09:30:59 +00:00
|
|
|
^^^^^^^^^^^
|
2019-06-22 22:22:39 +00:00
|
|
|
|
2022-05-11 13:59:19 +00:00
|
|
|
The Development section helps Pyodide contributors to find information about the
|
2021-11-15 09:30:59 +00:00
|
|
|
development process including making packages to support third party libraries.
|
2019-06-22 22:22:39 +00:00
|
|
|
|
|
|
|
.. toctree::
|
|
|
|
:maxdepth: 1
|
2021-04-20 21:28:33 +00:00
|
|
|
:caption: Development
|
2019-06-22 22:22:39 +00:00
|
|
|
|
2021-01-18 19:56:47 +00:00
|
|
|
development/building-from-sources.md
|
|
|
|
development/new-packages.md
|
2022-09-19 00:36:12 +00:00
|
|
|
development/building-and-testing-packages.md
|
2021-01-18 19:56:47 +00:00
|
|
|
development/contributing.md
|
|
|
|
development/testing.md
|
2021-04-13 19:51:32 +00:00
|
|
|
development/debugging.md
|
2019-06-22 22:22:39 +00:00
|
|
|
|
2021-04-20 18:26:44 +00:00
|
|
|
|
|
|
|
Project
|
2021-11-15 09:30:59 +00:00
|
|
|
^^^^^^^
|
2021-04-20 18:26:44 +00:00
|
|
|
|
2021-11-15 09:30:59 +00:00
|
|
|
The Project section gives additional information about the project's
|
|
|
|
organization and latest releases.
|
2021-04-20 18:26:44 +00:00
|
|
|
|
2019-06-22 22:22:39 +00:00
|
|
|
.. toctree::
|
2021-04-21 20:57:45 +00:00
|
|
|
:maxdepth: 1
|
2021-04-20 21:28:33 +00:00
|
|
|
:caption: Project
|
2019-06-22 22:22:39 +00:00
|
|
|
|
2021-01-18 19:56:47 +00:00
|
|
|
project/about.md
|
2021-04-20 18:26:44 +00:00
|
|
|
project/roadmap.md
|
2021-01-18 19:56:47 +00:00
|
|
|
project/code-of-conduct.md
|
2021-03-03 18:09:05 +00:00
|
|
|
project/governance.md
|
2021-01-18 19:56:47 +00:00
|
|
|
project/changelog.md
|
2021-03-02 12:47:31 +00:00
|
|
|
project/related-projects.md
|
2019-06-22 22:22:39 +00:00
|
|
|
|
|
|
|
|
2021-11-15 09:30:59 +00:00
|
|
|
Communication
|
|
|
|
-------------
|
|
|
|
|
|
|
|
- Blog: `blog.pyodide.org <https://blog.pyodide.org/>`_
|
|
|
|
- Mailing list: `mail.python.org/mailman3/lists/pyodide.python.org/ <https://mail.python.org/mailman3/lists/pyodide.python.org/>`_
|
|
|
|
- Gitter: `gitter.im/pyodide/community <https://gitter.im/pyodide/community>`_
|
|
|
|
- Twitter: `twitter.com/pyodide <https://twitter.com/pyodide>`_
|
|
|
|
- Stack Overflow: `stackoverflow.com/questions/tagged/pyodide <https://stackoverflow.com/questions/tagged/pyodide>`_
|