Skip to content

Package search: find a package without knowing its exact name - #116

Merged
bdbarnett merged 1 commit into
mainfrom
package-search
Oct 11, 2026
Merged

bdbarnett merged 1 commit into
mainfrom
package-search

Conversation

@bdbarnett

Copy link
Copy Markdown
Collaborator

mpftp search WORDS finds a package without knowing its exact name: one search across micropython-lib (the index mip reads), the PyDevices index and the Adafruit and community CircuitPython bundles (the manifest each release attaches, which is what circup installs from).

$ mpftp search display text --text --limit 2
adafruit_display_text 5.0.6  [Adafruit CircuitPython Bundle] — Displays text using CircuitPython's displayio.
    mpftp circup adafruit_display_text
adafruit_display_emoji_text 1.0.5  [Adafruit CircuitPython Bundle] — Displayio class for displaying text that contains emoji
    mpftp circup adafruit_display_emoji_text
2 of 5 matches; --limit shows more.
  • Results are ranked: the exact name, then names that start with the words, then names that contain them, then descriptions. Case, _, - and spaces don't matter.
  • Each result carries its source, version, description and how to install it: the command line, and the RPC method and params behind it. A PyDevices package's line has --index https://PyDevices.github.io/mip, which mip needs to find it.
  • The PyDevices index mirrors micropython-lib; a package that is in both at the same version is listed once, from micropython-lib.
  • Without --text the answer is JSON. --source, --interpreter and --limit narrow it; the search needs no board.
  • Indexes are cached for six hours under ~/.mpftp/package-cache. --refresh fetches them again. Offline, the search runs on the cached copies and says so, or says which index it could not fetch and has no copy of yet.

Search Packages… in the ⋯ menu, in VS Code and in the browser interface, searches the indexes the connected board installs from (micropython-lib and PyDevices on MicroPython, the two bundles on CircuitPython) and installs the result you pick, through the same mip_install / circup_install calls as Install Package.

Tests run on recorded cuts of the four real indexes, so they need no network: parsing, the ranking tiers, mirror dedupe, cache freshness and --refresh, offline with a stale cache and with none, one index down while the others answer, the CLI's flags and the RPC's params. The browser dialog's notes have node tests too.

The roadmap bullet comes out with this; the CHANGELOG has the entry.

mpftp search WORDS looks through micropython-lib's mip index, the
PyDevices index and the Adafruit and community CircuitPython bundles'
release manifests, and ranks the hits: the exact name first, then names
that start with or contain the words, then descriptions. Each result has
its source, version, a one-line description and the install line to run
(mpftp mip NAME, with --index https://PyDevices.github.io/mip for a
PyDevices package, or mpftp circup NAME) plus the RPC method and params
behind it. --text prints lines for reading; --source, --interpreter and
--limit narrow it. Indexes are cached six hours under
~/.mpftp/package-cache; --refresh fetches again, and offline the search
runs on the cached copies and says so (or says which index it could not
reach and has no copy of).

The sidecar exposes it as package_search, with no board needed. Search
Packages… in the ⋯ menu (VS Code and the browser interface) searches the
indexes the connected board installs from and installs the pick the way
Install Package does.

Tests use recorded cuts of the four real indexes, so nothing needs the
network: parsing, ranking tiers, mirror dedupe, cache freshness, offline
with and without a cache, one index down, the CLI flags and the RPC
params. The roadmap bullet goes with this.
@bdbarnett
bdbarnett merged commit 07f573b into main Oct 11, 2026
4 checks passed
@bdbarnett
bdbarnett deleted the package-search branch October 11, 2026 22:59
bdbarnett added a commit that referenced this pull request Oct 11, 2026
…g section

The rc2 notes list both features merged since rc1: package search (#116)
and the extension's mpftp.buildSystemPath setting (#115), whose entry moves
up from the rc1 section where its PR had put it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant