pyodide/docs/index.rst

100 lines
2.8 KiB
ReStructuredText
Raw Normal View History

Pyodide
=======
2021-12-13 17:36:35 +00:00
Pyodide is a Python distribution for the browser and Node.js based on WebAssembly.
2021-12-13 17:36:35 +00:00
What is Pyodide?
----------------
Pyodide is a port of CPython to WebAssembly/`Emscripten <https://emscripten.org/>`_.
2021-12-13 17:36:35 +00:00
Pyodide makes it possible to install and run Python packages in the browser with
`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.
Try Pyodide
-----------
Try Pyodide in a
`REPL <./console.html>`_ directly in
your browser (no installation needed).
Table of contents
-----------------
Using Pyodide
^^^^^^^^^^^^^
.. toctree::
:maxdepth: 1
usage/quickstart.md
usage/downloading-and-deploying.md
usage/index.md
usage/loading-packages.md
usage/accessing-files.md
usage/wasm-constraints.md
usage/type-conversions.md
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
usage/api-reference.md
usage/faq.md
usage/examples.md
Development
^^^^^^^^^^^
The Development section helps Pyodide contributors to find information about the
development process including making packages to support third party libraries.
.. toctree::
:maxdepth: 1
:caption: Development
development/building-from-sources.md
development/new-packages.md
development/building-and-testing-packages.md
development/contributing.md
development/testing.md
development/debugging.md
Project
^^^^^^^
The Project section gives additional information about the project's
organization and latest releases.
.. toctree::
:maxdepth: 1
:caption: Project
project/about.md
project/roadmap.md
project/code-of-conduct.md
project/governance.md
project/changelog.md
project/related-projects.md
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>`_