Add three new tutorials and small tweaks to docs (#972)

This commit is contained in:
Fábio Rosado
2022-11-24 10:53:22 +00:00
committed by GitHub
parent cafebd68f2
commit 06df21e8e3
9 changed files with 562 additions and 33 deletions

View File

@@ -1,6 +1,6 @@
# <py-config>
Use the `<py-config>` tag to set and configure general metadata along with declaring dependencies for your PyScript application. The configuration has to be set in either [TOML](https://toml.io/) or [JSON](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/JSON) format.
Use the `<py-config>` tag to set and configure general metadata along with declaring dependencies for your PyScript application. The configuration has to be set in either [TOML](https://toml.io/)(default) or [JSON](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/JSON) format.
The `<py-config>` element should be placed within the `<body>` element.
@@ -14,6 +14,11 @@ The `<py-config>` element should be placed within the `<body>` element.
## Examples
- `<py-config>` using TOML (default)
```{note}
Reminder: when using TOML, any Arrays of Tables defined with double-brackets (like `[[runtimes]]` and `[[fetch]]` must come after individual keys (like `paths = ...` and `packages=...`)
```
```html
<py-config>
autoclose_loader = true
@@ -24,7 +29,6 @@ The `<py-config>` element should be placed within the `<body>` element.
lang = "python"
</py-config>
```
Note: `[[runtimes]]` is a TOML table. Make sure this is the last item within a py-config, as the properties created after it go into the runtimes object.
- JSON config using the `type` attribute.
```html
@@ -204,6 +208,8 @@ In the HTML tag `<py-config>`, paths to local modules are provided in the
</html>
```
## Supported configuration values
The following optional values are supported by `<py-config>`:
| Value | Type | Description |
| ------ | ---- | ----------- |
@@ -221,6 +227,8 @@ The following optional values are supported by `<py-config>`:
| `plugins` | List of Plugins | List of Plugins are to be specified here. The default value is an empty list. |
| `runtimes` | List of Runtimes | List of runtime configurations, described below. The default value contains a single Pyodide based runtime. |
### Fetch
A fetch configuration consists of the following:
| Value | Type | Description |
| ----- | ---- | ----------- |
@@ -231,6 +239,8 @@ A fetch configuration consists of the following:
The parameters `to_file` and `files` shouldn't be supplied together.
### Runtime
A runtime configuration consists of the following:
| Value | Type | Description |
| ----- | ---- | ----------- |