-
-
Notifications
You must be signed in to change notification settings - Fork 39
Description
Context
micropip internally calls pyodide.loadPackage when installing packages in the Pyodide lockfile. pyodide.loadPackage has its own logging mechanisms that print to the stdout and stderr (or we can override the stdout or stderr by setting messageCallback and errorCallback parameter).
On the other hand. micropip is silent by default. It does not print any logs to stdout unless verbose parameter is given. When the verbose parameter is given, it prints pip-like logs as much as possible.
Because of this, installing packages with micropip sometimes shows non-straightforward logs. For example, suppose we have a pure-python package that doesn't exist in the Pyodide lockfile, and it depends on some package that does exist in the lockfile.
Let's say we install this package with micropip from the Pyodide console.
-
If we run
micropip.installwithout theverboseparameter, we will see nothing on the screen and the browser console will show the packages loaded from the lockfile. -
If we run
micropip.installwith theverboseparameter, we will see names of the pure python package in the screen, and the browser console will show the packages loaded from the lockfile.
Pitch
It would be nice if we could integrate the output of the pyodide.loadPackage into the micropip logging system.
Goals
- Let micropip log all the packages installed from the package index + pyodide lockfile into a single stream.
Non-Goals
- Modifying logging system of the pyodide.loadPackage. Any internal implementation of pyodide.loadPackage should be untouched.
Pseudo-code
packaged_loaded = await pyodide.loadPackage(
packages
{ 'messageCallback': logDevNull },
)
print_micropip_logs(packages_loaded)- make micropip log the pip-like messages using the return values of pyodide.loadPackage (Make pyodide.loadPackage return list of packages that are loaded pyodide#3843)
- pass dummy handler to messageCallback so no duplicate logs are printed by loadPackage
Discussion Topics
- What should be print if
loadPackagefails?