Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the metadata format #457

Merged
merged 3 commits into from
Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions docs/tutorials/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,26 +217,26 @@ Use the `<py-config>` tag to set and configure general metadata about your PyScr

The `<py-config>` tag can be used as follows:

```
```html
<py-config>
- autoclose_loader: false
- runtimes:
-
src: "https://cdn.jsdelivr.net/pyodide/v0.20.0/full/pyodide.js"
autoclose_loader: false
runtimes:
- src: "https://cdn.jsdelivr.net/pyodide/v0.20.0/full/pyodide.js"
name: pyodide-0.20
lang: python
</py-config>
```

The following optional values are supported by `<py-config>`:

* autoclose_loader (boolean): If false, PyScript will not close the loading splash screen when the startup operations finish.
* name (string): Name of the user application. This field can be any string and is to be used by the application author for their own customization purposes.
* version (string): Version of the user application. This field can be any string and is to be used by the application author for their own customization purposes. It is not related to the PyScript version.
* runtimes (List of Runtimes): List of runtime configurations. Each Runtime expects the following fields:
* src (string, Required): URL to the runtime source.
* name (string): Name of the runtime. This field can be any string and is to be used by the application author for their own customization purposes.
* lang (string): Programming language supported by the runtime. This field can be used by the application author to provide clarification. It currently has no implications on how PyScript behaves.
* `autoclose_loader` (boolean): If false, PyScript will not close the loading splash screen when the startup operations finish.
* `name` (string): Name of the user application. This field can be any string and is to be used by the application author for their own customization purposes.
* `version` (string): Version of the user application. This field can be any string and is to be used by the application author for their own customization purposes. It is not related to the PyScript version.
* `runtimes` (List of Runtimes): List of runtime configurations. Each Runtime expects the following fields:
* `src` (string, Required): URL to the runtime source.
* `name` (string): Name of the runtime. This field can be any string and is to be used by the application author for their own customization purposes.
* `lang` (string): Programming language supported by the runtime. This field can be used by the application author to provide clarification. It currently has no implications on how PyScript behaves.


## Visual component tags

Expand Down
11 changes: 5 additions & 6 deletions examples/simple_clock.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@
<title>Simple Clock Demo</title>

<link rel="icon" type="image/png" href="favicon.png" />
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
<link rel="stylesheet" href="./build/pyscript.css" />

<script defer src="https://pyscript.net/alpha/pyscript.js"></script>
<script defer src="./build/pyscript.js"></script>
<py-env>
- paths:
- ./utils.py
</py-env>
<py-config>
- autoclose_loader: false
- runtimes:
-
src: "https://cdn.jsdelivr.net/pyodide/v0.20.0/full/pyodide.js"
autoclose_loader: false
runtimes:
- src: "https://cdn.jsdelivr.net/pyodide/v0.20.0/full/pyodide.js"
name: pyodide-0.20
lang: python
</py-config>
Expand Down
4 changes: 3 additions & 1 deletion pyscriptjs/src/components/pyconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ export class PyConfig extends BaseEvalElement {
autoclose_loader: true,
};
} else {
this.values = Object.assign({}, ...loadedValues);
// eslint-disable-next-line
// @ts-ignore
this.values = loadedValues;
}
if (this.values.runtimes === undefined) {
this.values.runtimes = [DEFAULT_RUNTIME];
Expand Down