micropython / micropython/micropython

Look for modules in every directory of `usys.path`

Open
#10,813 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement py-core
Dominant language
C
Stars
22.1k
Forks
9k
Avg merge
6d 4h
Merged PRs (30d)
16

Description

Current behavior: if usys.path==["/lib",".flash"] and there's a /lib/foo/ directory, import foo.bar will fail even though help("modules") does list it and .flashstill is inusys.path`.

This is a problem because when I write and debug large programs which don't fit into RAM, I often want to deploy new versions of single modules without disrupting everything else. Right now I have to re-flash the whole board just to add one print() line somewhere. This also raises concerns about the number of write cycles.

Proposed fix: teach MicroPython to check all elements of usys.path for the relevant file-or-directory, instead of stopping at the first one it finds.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the import foo.bar lookup behavior and how usys.path is searched when it contains ["/lib",".flash"]. Reproduce the case with /lib/foo/ and a module in .flash; done means relevant files or directories are found across every usys.path element without requiring a full re-flash.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, python
Domain
embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.