Skip to content

docs: Add doctest examples to micropip.install function - #244

Merged
ryanking13 merged 2 commits into
pyodide:mainfrom
grden:doc/install-doctest
Aug 17, 2025
Merged

docs: Add doctest examples to micropip.install function#244
ryanking13 merged 2 commits into
pyodide:mainfrom
grden:doc/install-doctest

Conversation

@grden

@grden grden commented Aug 14, 2025

Copy link
Copy Markdown
Contributor

Added docstring examples for micropip.install().

I haven’t included any flags (i.e. # doctest: +RUN_IN_PYODIDE or # doctest: +SKIP) as I assumed the tests for micropip will run within the already-established Pyodide environment. Happy to update if this assumption is incorrect.

This partially addresses issue pyodide/pyodide#1955

@ryanking13 ryanking13 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @grden!

I assumed the tests for micropip will run within the already-established Pyodide environment. Happy to update if this assumption is incorrect.

No, it does not. But I think it is better not to run doctest in this case, as we don't want to make network calls to PyPI in unittests.

Example-wise looks good to me. I added one minor comment.

Comment thread micropip/package_manager.py Outdated
>>> await micropip.install("numpy>=2.2.0")

For more details and advanced usage, see the user manual:
https://pyodide.org/en/stable/usage/loading-packages.html#micropip

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doctest itself is a document, and it will be shown in the micropip docs, so I think this comment is redundant.

@grden

grden commented Aug 15, 2025

Copy link
Copy Markdown
Contributor Author

Removed redundant docstring. Thank you!

@ryanking13 ryanking13 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @grden!

@ryanking13
ryanking13 merged commit bf15f51 into pyodide:main Aug 17, 2025
5 checks passed
@grden
grden deleted the doc/install-doctest branch August 17, 2025 03:51
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

Successfully merging this pull request may close these issues.

2 participants