Skip to content

Commit c7eb23b

Browse files
committed
Merge remote-tracking branch 'origin/remote-packages' into 2026-6-1
2 parents f47881d + 4ddeb30 commit c7eb23b

1 file changed

Lines changed: 40 additions & 35 deletions

File tree

‎docs/user-guide/configuration.md‎

Lines changed: 40 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,8 @@ There are only a few core options ([`interpreter`](#interpreter), [`files`](#fil
9999
[`packages`](#packages), [`js_modules`](#javascript-modules), [`debug`](#debug),
100100
[`sync_main_only`](#sync_main_only)) and some experimental flags:
101101
([`experimental_create_proxy`](#experimental_create_proxy)) that can be used in
102-
the configuration of PyScript, ([`experimental_ffi_timeout`](#experimental_ffi_timeout)) to
103-
help with worker related performance, and
104-
([`experimental_remote_packages`](#experimental_remote_packages)) which allows
105-
remotely hosted packages. The user is also free to define arbitrary additional
102+
the configuration of PyScript, and ([`experimental_ffi_timeout`](#experimental_ffi_timeout)) to
103+
help with worker related performance. The user is also free to define arbitrary additional
106104
configuration options that plugins or an app may require for their own reasons.
107105

108106
!!! info
@@ -334,6 +332,44 @@ following valid forms:
334332
`"snowballstemmer>=2.2.0"`
335333
* An arbitrary URL to a Python package: `"https://.../package.whl"`
336334
* A file copied onto the browser based file system: `"emfs://.../package.whl"`
335+
* A remote `.toml` or `.json` configuration file that defines a custom pure
336+
Python package: `"https://.../config.toml"`
337+
338+
#### Remote packages
339+
340+
PyScript can also load custom pure Python packages hosted remotely. Add a URL
341+
to a remote `.toml` or `.json` configuration file directly in the `packages`
342+
list alongside PyPI package names:
343+
344+
```TOML title="A packages list with a remote package in TOML."
345+
packages = ["numpy", "https://remote.host.com/my_package/v1/config.toml"]
346+
```
347+
348+
```JSON title="A packages list with a remote package in JSON."
349+
{
350+
"packages": ["numpy", "https://remote.host.com/my_package/v1/config.toml"]
351+
}
352+
```
353+
354+
The remote config is basically a subset of any other PyScript config with the
355+
only exception that its `name` field must specify the package name, which will
356+
then be used to import such package via regular imports:
357+
358+
```TOML title="A remote config example"
359+
name = "my_package"
360+
361+
# a remote config can include packages, even remote ones
362+
packages = ["matplotlib"]
363+
364+
# files are resolved relatively to this config URL
365+
[files]
366+
"./__init__.py" = ""
367+
"./sub/module.py" = ""
368+
"./main.py" = ""
369+
```
370+
371+
The bootstrap will take care of fetching and preparing the remote package so
372+
that all the code will need to do is: `from my_package import util`.
337373

338374
#### Package Support
339375

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

581-
### experimental_remote_packages
582-
583-
Specially designed to allow custom pure Python packages, it is possible to
584-
specify a remote `.toml` or `.json` configuration file within the list of
585-
packages:
586-
587-
```TOML title="Using the experimental_remote_packages flag in TOML."
588-
experimental_remote_packages = true
589-
packages = ['numpy', 'https://remote.host.com/my_package/v1/config.toml']
590-
```
591-
592-
The remote config is basically a subset of any other PyScript config with the
593-
only exception that its `name` field must specify the package name, which will
594-
then be used to import such package via regular imports:
595-
596-
```TOML title="A remote config example"
597-
name = "my_package"
598-
599-
# a remote config can include packages, even remote ones
600-
packages = ['matplotlib']
601-
602-
# files are resolved relatively to this config URL
603-
[files]
604-
"./__init__.py" = ""
605-
"./sub/module.py" = ""
606-
"./main.py" = ""
607-
```
608-
609-
The bootstrap will take care of fetching and preparing the remote package so
610-
that all the code will need to do is: `from my_package import util`.
611-
612617
### debug
613618

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

0 commit comments

Comments
 (0)