@@ -708,7 +708,7 @@ automatically install packages for you](user-guide/configuration/#packages).
708708Yet [ packaging can be a complicated beast] ( #python-packages ) , so here are some
709709hints for a painless packaging experience with PyScript.
710710
711- There are essentially four ways in which a third party package can become
711+ There are essentially five ways in which a third party package can become
712712available in PyScript.
713713
7147141 . The module is already part of either the Pyodide or MicroPython
@@ -724,9 +724,11 @@ available in PyScript.
7247243 . Reference hosted Python source files, to be included on the file
725725 system, via the [ ` files ` setting] ( ../user-guide/configuration/#files ) .
7267264 . Create a folder containing the package's files and sub folders, and create
727- a hosted ` .zip ` or ` .tgz ` /` .tar.gz ` archive to be decompressed into the file
728- system (again, via the
727+ a hosted ` .zip ` or ` .tgz ` /` .tar.gz ` / ` .whl ` archive to be decompressed into
728+ the file system (again, via the
729729 [ ` files ` setting] ( ../user-guide/configuration/#files ) ).
730+ 5 . Provide your own ` .whl ` package and reference it via a URL in the
731+ ` packages = [...] ` list.
730732
731733#### Host a package
732734
@@ -768,7 +770,7 @@ packages onto the Python path:
768770 </script >
769771```
770772
771- #### Code archive (` zip ` /` tgz ` )
773+ #### Code archive (` zip ` /` tgz ` / ` whl ` )
772774
773775Compress all the code you want into an archive (using either either ` zip ` or
774776` tgz ` /` tar.gz ` ). Host the resulting archive and use the
@@ -1206,14 +1208,25 @@ js.callback(
12061208 )
12071209)
12081210```
1211+ !!! info
1212+
1213+ Thanks to a
1214+ [recent change in Pyodide](https://github.com/pyodide/pyodide/pull/4576),
1215+ such `Map` instances are
1216+ [duck-typed](https://en.wikipedia.org/wiki/Duck_typing) to behave like
1217+ object literals. Conversion may not be needed anymore, and `to_js` may just
1218+ work without the need of the `dict_converter`. Please check.
12091219
1210- In addition, MicroPython's version of ` to_js ` takes the opposite approach (for
1220+ MicroPython's version of ` to_js ` takes the opposite approach (for
12111221many of the reasons stated above) and converts Python dictionaries to object
12121222literals instead of ` Map ` objects.
12131223
12141224As a result, ** the PyScript ` pyscript.ffi.to_js ` ALWAYS returns a JavaScript
12151225object literal by default when converting a Python dictionary** no matter if
1216- you're using Pyodide or MicroPython as your interpreter.
1226+ you're using Pyodide or MicroPython as your interpreter. Furthermore, when
1227+ using MicroPython, because things are closer to idiomatic JavaScript behaviour,
1228+ you may not even need to use ` to_js ` unless you want to ensure
1229+ cross-interpreter compatibility.
12171230
12181231#### Caveat
12191232
0 commit comments