Push and Run — push a Python file and its changed dependencies to the Pico, then run it
Push a MicroPython program and its locally-changed dependencies to the Pico, then run it.
$ARGUMENTS is provided, use it as the filename..claude/par_last_file for the most recently used file.Save the resolved filename to .claude/par_last_file for next time.
Read the target file and recursively find all local dependencies:
import X and from X import Y statements.X, check if X.py exists in the working directory.machine, network, time, os, sys, json, , , , , , , , ).socketssl_threadrp2ntptimestructgcmicropython.py files (including the target).Compare files in the dependency tree against .claude/par_manifest.json, which stores the mtime of each file at the time it was last pushed to the Pico.
Build a single mpremote command that copies all files in the push list. Use PID tracking:
mpremote connect COM11 cp file1.py :file1.py + cp file2.py :file2.py & echo "MPREMOTE_PID:$!"; wait $!
Report which files were pushed.
After a successful push, update .claude/par_manifest.json with the current mtime of every pushed file. Use os.path.getmtime() to read mtimes.
Run the target file with mpremote in the background with PID tracking:
mpremote connect COM11 run <target_file> & echo "MPREMOTE_PID:$!"; wait $!
Run this as a background task so output streams. Report the PID to the user so they know what's running. Read and display output after a reasonable delay.
& echo "MPREMOTE_PID:$!"; wait $!main.py.