Skip to content

Commit e5391ef

Browse files
authored
DOC Improve documentation on downloading and deploying [skip ci] (pyodide#1778)
1 parent 4457c10 commit e5391ef

File tree

4 files changed

+60
-55
lines changed

4 files changed

+60
-55
lines changed

docs/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Using Pyodide
2222

2323
usage/quickstart.md
2424
usage/webworker.md
25-
usage/serving-pyodide-packages.md
25+
usage/downloading-and-deploying.md
2626
usage/loading-packages.md
2727
usage/type-conversions.md
2828
usage/wasm-constraints.md
+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
(downloading_deploying)=
2+
3+
# Downloading and deploying Pyodide
4+
5+
## Downloading Pyodide
6+
7+
### CDN
8+
9+
Pyodide packages, including the `pyodide.js` file, are available from the JsDelivr CDN,
10+
11+
| channel | indexURL | Comments | REPL |
12+
| ------------------- | ------------------------------------------------ | ---------------------------------------------------------------------------------------- | -------------------------------------------------- |
13+
| Latest release | `https://cdn.jsdelivr.net/pyodide/v0.18.0/full/` | Recommended, cached by the browser | [link](https://pyodide.org/en/stable/console.html) |
14+
| Dev (`main` branch) | `https://cdn.jsdelivr.net/pyodide/dev/full/` | Re-deployed for each commit on main, no browser caching, should only be used for testing | [link](https://pyodide.org/en/latest/console.html) |
15+
16+
To access a particular file, append the file name to `indexURL`. For instance,
17+
`"${indexURL}pyodide.js"` in the case of `pyodide.js`.
18+
19+
```{warning}
20+
The previous CDN `pyodide-cdn2.iodide.io` is deprecated and should not be used.
21+
```
22+
23+
### Github releases
24+
25+
You can also download Pyodide packages from [Github
26+
releases](https://github.com/pyodide/pyodide/releases)
27+
(`pyodide-build-*.tar.bz2` file) serve them yourself, as explained in the
28+
following section.
29+
30+
## Serving Pyodide packages
31+
32+
If you built your Pyodide distribution or downloaded the release tarball
33+
you need to serve Pyodide files with appropriate headers.
34+
35+
### Serving locally
36+
37+
With Python 3.7.5+ you can serve Pyodide files locally by starting
38+
39+
```
40+
python -m http.server
41+
```
42+
43+
from the Pyodide distribution folder.
44+
45+
Point your WebAssembly aware browser to
46+
[http://localhost:8000/console.html](http://localhost:8000/console.html) and open
47+
your browser console to see the output from Python via Pyodide!
48+
49+
### Remote deployments
50+
51+
Any solution that is able to host static files and correctly sets WASM
52+
MIME type, and CORS headers would work. For instance, you can use Github Pages
53+
or similar services.
54+
55+
For additional suggestions for optimizing size and load times, see the [Emscripten
56+
documentation about deployments](https://emscripten.org/docs/compiling/Deploying-Pages.html).

docs/usage/quickstart.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ Try Pyodide in a [REPL](https://pyodide.org/en/latest/console.html) directly in
1010

1111
To include Pyodide in your project you can use the following CDN URL:
1212

13-
```{eval-rst}
14-
https://cdn.jsdelivr.net/pyodide/v0.18.0/full/pyodide.js
13+
```text
14+
https://cdn.jsdelivr.net/pyodide/v0.18.0/full/pyodide.js
1515
```
1616

1717
You can also download a release from [Github
1818
releases](https://github.com/pyodide/pyodide/releases) or build Pyodide
19-
yourself. See {ref}`serving_pyodide_packages` for more details.
19+
yourself. See {ref}`downloading_deploying` for more details.
2020

2121
The `pyodide.js` file defines a single async function called
2222
{any}`loadPyodide <globalThis.loadPyodide>` which sets up the Python environment

docs/usage/serving-pyodide-packages.md

-51
This file was deleted.

0 commit comments

Comments
 (0)