|
| 1 | +# Pyodide Packages Generator |
| 2 | + |
| 3 | +Here are instructions for how to generate a Pyodide package index & bundle and configure workerd/Edgeworker to build against them. |
| 4 | + |
| 5 | +A package index is hosted on an HTTPS service, and is defined by a `pyodide-lock.json` file that points to a set of *wheels* (essentially zip files), one for each package. The wheels live in the same directory as the lock file. Workerd local dev is configured to use a package index. |
| 6 | + |
| 7 | +A package bundle is used during deployment, and contains all the packages unzipped in a special directory structure. This directory structure is transformed at run-time depending on the packages the user requests. |
| 8 | + |
| 9 | +## How do I add more packages to the index/bundle? |
| 10 | + |
| 11 | +First, make sure that the `cloudflare/pyodide` repo contains all the necessary recipes for the packages you need (and their dependencies). It doesn't necessarily need to be on the `main` branch. |
| 12 | + |
| 13 | +Now, add the packages you want to support in `required_packages.txt`. (No need to specify their dependencies). |
| 14 | + |
| 15 | +Finally, build a new index/bundle according to the instructions in the next section. |
| 16 | + |
| 17 | +## How do I build a new index/bundle? |
| 18 | + |
| 19 | +First, navigate to the "Actions" page on this GitHub repo. Click on "Build & Public Pyodide Package Bundle". There should be a banner that says "This workflow has a `workflow_dispatch` event trigger". On the right of the banner there should be a button that says "Run Workflow". Click that. |
| 20 | + |
| 21 | +There are a few options you may specify: |
| 22 | + |
| 23 | +- Version Tag: This is the version number of the package bundle you're about to build. Usually this is just the current date in YYYYMMDD format. |
| 24 | +- Branch or tag of cloudflare/pyodide to get recipes from: This is usually `main` but if you haven't merged the changes into `main` yet for some reason you can change that here. |
| 25 | + |
| 26 | +The other options are usually fine to leave as-is. |
| 27 | + |
| 28 | +Now, once the workflow has finished running, there should be a new Release bearing the name of the version number you picked. You should only need to download one file, `pyodide_bucket.bzl`. This file is located within the `build` directory of the workerd repo and is used by both workerd and Edgeworker at build-time. |
| 29 | + |
| 30 | +Replace this file in the workerd repo, then upstream your changes to Edgeworker, and you should be done! |
0 commit comments