What would you like changed or added to the documentation and why?
It would be nice if we could create a short tutorial to show how one could run PyNWB in the browser with Pyodide. The example below shows that we can at least install PyNWB with Pyodide.
Basic example for installing PyNWB with Pyodide
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<script type="text/javascript" src="https://cdn.jsdelivr.net/pyodide/dev/full/pyodide.js"></script>
<script type="text/javascript">
async function main() {
let pyodide = await loadPyodide();
await pyodide.loadPackage("micropip");
const micropip = pyodide.pyimport("micropip");
await pyodide.loadPackage("h5py");
await pyodide.loadPackage("pandas");
await pyodide.loadPackage("numpy");
await pyodide.loadPackage("scipy");
await pyodide.loadPackage("jsonschema");
await pyodide.loadPackage("setuptools");
await pyodide.loadPackage("ruamel.yaml");
await micropip.install("hdmf");
await micropip.install("pynwb==2.2.0");
await pyodide.runPython(`
import hdmf
print("HDMF Version: %s" % hdmf.__version__)
import pynwb
print("PyNWB Version: %s" % pynwb.__version__)
import h5py
print("h5py Version: %s" % h5py.__version__)
print("h5py Drivers: %s" % str(h5py.registered_drivers()))
`);
}
main();
</script>
</body>
</html>
Example of the above HTML running in Firefox

Comments
- Installing pynwb with micropip fails when not specifying the version due to version conflicts for h5py version ranges. This is probably due to micropip getting confused by the bad/yanked 2.5.1 PyNWB release https://pypi.org/project/pynwb/2.5.1/
- The
ros3 driver does not appear to be installed for h5py which would be nice to have for reading files from DANDI
- I had to use the
dev version of Pyodide for this to work. With the current 0.21.3 release micropip for h5py did not work
- The install process can probably be simplified (i.e., not all
loadPackage calls listed in the example are necessary). I mainly went through the requirements.txt for HDMF and try to load the packages one-by-one to see if all the dependencies work.
- The above example does not actually load any NWB data file. It would be nice to show how to actually read from an NWB file either using streaming or from the file system (file system access in the browser is limited
Do you have any interest in helping write or edit the documentation?
Yes, but I would need guidance.
Code of Conduct
What would you like changed or added to the documentation and why?
It would be nice if we could create a short tutorial to show how one could run PyNWB in the browser with Pyodide. The example below shows that we can at least install PyNWB with Pyodide.
Basic example for installing PyNWB with Pyodide
Example of the above HTML running in Firefox

Comments
ros3driver does not appear to be installed forh5pywhich would be nice to have for reading files from DANDIdevversion of Pyodide for this to work. With the current0.21.3release micropip for h5py did not workloadPackagecalls listed in the example are necessary). I mainly went through the requirements.txt for HDMF and try to load the packages one-by-one to see if all the dependencies work.Do you have any interest in helping write or edit the documentation?
Yes, but I would need guidance.
Code of Conduct