← index #18711PR #18712
Duplicate · high · value 4.611
QUERY · ISSUE

Allow mpremote mip to download libraries as local files

openby stek29opened 2026-01-22updated 2026-03-09
enhancementtools

Description

Background

Currently the easiest way to install micropython-lib packages is with mpremote mip install.

However, when using such packages, there's no syntax highlighting and pylance checking.

Adding such packages to import paths for pylance is not trivial, especially since micropython mip has a custom manifest format.

Suggestion

I suggest adding a new subcommand to mpremote mip -- "download", inspired by pip download command.

This command will work just like mip install, but:

  • would download files to local fs instead of connected MicroPython board
  • would not require a MicroPython board to be connected to work

Then this mpremote mip download command can be used to download packages into a subdirectory added to import paths for IDE/Pylance/linter, and proper tooling can be utilised while using upstream micropython-lib packages.

Code Size

No response

Implementation

I intend to implement this feature and would submit a Pull Request if desirable

Code of Conduct

Yes, I agree

CANDIDATE · PULL REQUEST

tools/mpremote: Add mip download and mpy version handling.

openby stek29opened 2026-01-22updated 2026-02-15
tools

<!-- Thanks for submitting a Pull Request! We appreciate you spending the
time to improve MicroPython. Please provide enough information so that
others can review your Pull Request.

 Before submitting, please read:
 https://github.com/micropython/micropython/blob/master/CODEOFCONDUCT.md
 https://github.com/micropython/micropython/wiki/ContributorGuidelines

 Please check any CI failures that appear after your Pull Request is opened.

-->

Summary

Adds a new sub-command for mpremote mip: mpremote mip download, inspired by pip download, which accept same packages and uses same logic as mip install, but downloads files to local filesystem instead of remote micropython board.
Fixes #18711.

A use case: run mip download for all the dependencies, and add ./lib to python.analysis.extraPaths or whatever your ide/setup uses -- and now you have a proper code completion and go to definition working with same code obtained by same command as the code running on the board.

An issue on Raspberry Pi forums by someone else on this with more details: https://forums.raspberrypi.com/viewtopic.php?t=377948

Testing

  • tested that mip install maintains old behaviour with no changes.
  • tested that mip download works without a connected device, but also works with connected devices when --mpy is set to download mpy files.

Trade-offs and Alternatives

An alternative approach is to only keep mip install command and support both local and remote paths in the --target argument.
I have considered this alternative to adding mip download command and keeping mip install, but I have decided against it due to following reasons:

Backwards incompatibility in path handling

Many mpremote commands already support working with both local and remote filesystems, and : is used to reference remote filesystem.

The mip install doesn't follow that convention: it can only work with remote paths, so mip install's --target argument treats all paths as remote, and doesn't support the : notation for remote paths.

Making mip install follow this convention would be a backwards incompatible change which I wanted to avoid.

Defaults for mpy argument

The mip install prefers mpy files instead of py files as those are a better default for files installed to the micropython environment.

However, preferring mpy files to py files for locally downloaded files is not a sane default: the mpy files won't help for most use-cases where local downloads of mip packages are needed.

Having multiple different commands makes the mpy defaulting easier: it makes more sense to have different defaults for different commands rather than to have the default value for a flag change depending what was provided in the other flag.

pip download command

There's a pip download command the mip download command matches, while the pip install arguably doesn't provide options to just download the packages to a given directory. This makes the mip download command be recognizable for people already familiar with pip commands.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied