Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate logs from loadPackage into micropip.install #219

Open
ryanking13 opened this issue Mar 2, 2025 · 0 comments
Open

Integrate logs from loadPackage into micropip.install #219

ryanking13 opened this issue Mar 2, 2025 · 0 comments

Comments

@ryanking13
Copy link
Member

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.

  1. If we run micropip.install without the verbose parameter, we will see nothing on the screen and the browser console will show the packages loaded from the lockfile.

  2. If we run micropip.install with the verbose parameter, 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)

Discussion Topics

  • What should be print if loadPackage fails?

Related issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant