Skip to content

Conversation

@smurfix
Copy link
Contributor

@smurfix smurfix commented Dec 13, 2025

Summary

The restriction of not allowing a split between file systems might save some import time, but the cost is that you can't selectively update a buggy file in ROM or .frozen with a fixed version without uploading the whole package.

Testing

Test tests/cpydiff/core_import_split_ns_pkgs.py has been modified accordingly.

Trade-offs and Alternatives

IMHO the additional load time incurred by scanning all of sys.path is negligible.

On the plus side, this patch (a) shaves a few bytes off the MPy binary, at least on Unix (I didn't yet check any others) and (b) allows for faster debug-fix cycles, esp. when RAM is too tight to load all of a large package ensemble that works perfectly well when it's in .frozen.

@codecov
Copy link

codecov bot commented Dec 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.38%. Comparing base (78ff170) to head (a79cfe4).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #18561   +/-   ##
=======================================
  Coverage   98.38%   98.38%           
=======================================
  Files         171      171           
  Lines       22300    22304    +4     
=======================================
+ Hits        21939    21943    +4     
  Misses        361      361           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link

github-actions bot commented Dec 13, 2025

Code size report:

Reference:  all: Bump version to 1.27.0. [78ff170]
Comparison: tests/cpydiff/core_import_split_ns_pkgs: Document split import. [merge of a79cfe4]
  mpy-cross:    +0 +0.000% 
   bare-arm:    +0 +0.000% 
minimal x86:  -106 -0.056% 
   unix x64:   -56 -0.007% standard
      stm32:   -24 -0.006% PYBV10
     mimxrt:   -16 -0.004% TEENSY40
        rp2:    -8 -0.001% RPI_PICO_W
       samd:   -16 -0.006% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    -1 -0.000% VIRT_RV32

Scan all elements of "sys.path" for (sub)modules.

Submodules are no longer loaded relative to the parent module's `__path__`.
This allows selectively overriding a frozen submodule from the file system.

Signed-off-by: Matthias Urlichs <matthias@urlichs.de>
Signed-off-by: Matthias Urlichs <matthias@urlichs.de>
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.

1 participant