Skip to content

Commit 9d395fe

Browse files
authored
Merge pull request #194 from pyscript/experimental_remote_packages
Experimental remote packages
2 parents 8106690 + 46afe6d commit 9d395fe

File tree

1 file changed

+36
-4
lines changed

1 file changed

+36
-4
lines changed

docs/user-guide/configuration.md

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,12 @@ _single_ `<py-config>` or `<mpy-config>` tag in your HTML document:
8585

8686
There are five core options ([`interpreter`](#interpreter), [`files`](#files),
8787
[`packages`](#packages), [`js_modules`](#javascript-modules) and
88-
[`sync_main_only`](#sync_main_only)) and an experimental flag
88+
[`sync_main_only`](#sync_main_only)) and two experimental flags:
8989
([`experimental_create_proxy`](#experimental_create_proxy)) that can be used in
90-
the configuration of PyScript. The user is also free to define
91-
arbitrary additional configuration options that plugins or an app may require
92-
for their own reasons.
90+
the configuration of PyScript and
91+
([`experimental_remote_packages`](#experimental_remote_packages)) which allows
92+
remotely hosted packages. The user is also free to define arbitrary additional
93+
configuration options that plugins or an app may require for their own reasons.
9394

9495
### Interpreter
9596

@@ -554,6 +555,37 @@ In this experimental phase, we suggest trying `0`, `30` or a value that won't
554555
likely bypass the browser rendering of 60fps. Of course, `1000` (i.e. a second)
555556
would be a fun, if greedy, experiment.
556557

558+
### experimental_remote_packages
559+
560+
Specially designed to allow custom pure Python packages, it is possible to
561+
specify a remote `.toml` or `.json` configuration file within the list of
562+
packages:
563+
564+
```TOML title="Using the experimental_remote_packages flag in TOML."
565+
experimental_remote_packages = true
566+
packages = ['numpy', 'https://remote.host.com/my_package/v1/config.toml']
567+
```
568+
569+
The remote config is basically a subset of any other PyScript config with the
570+
only exception that its `name` field must specify the package name, which will
571+
then be used to import such package via regular imports:
572+
573+
```TOML title="A remote config example"
574+
name = "my_package"
575+
576+
# a remote config can include packages, even remote ones
577+
packages = ['matplotlib']
578+
579+
# files are resolved relatively to this config URL
580+
[files]
581+
"./__init__.py" = ""
582+
"./sub/module.py" = ""
583+
"./main.py" = ""
584+
```
585+
586+
The bootstrap will take care of fetching and preparing the remote package so
587+
that all the code will need to do is: `from my_package import util`.
588+
557589
### debug
558590

559591
When using Pyodide, if the `debug` setting is set to `true`, then Pyodide will

0 commit comments

Comments
 (0)