micropython-lib/python-ecosys
Andrew Leech c98b355ef4 python-ecosys/debugpy: Add VS Code debugging support for MicroPython.
This implementation provides a Debug Adapter Protocol (DAP) server that enables
VS Code to debug MicroPython code with full breakpoint, stepping, and variable
inspection capabilities.

Features:
- Manual breakpoints via debugpy.breakpoint()
- Line breakpoints set from VS Code
- Stack trace inspection
- Variable scopes (locals/globals)
- Source code viewing
- Stepping (into/over/out)
- Non-blocking architecture for MicroPython's single-threaded environment
- Conditional debug logging based on VS Code's logToFile setting

Implementation highlights:
- Uses MicroPython's sys.settrace() for execution monitoring
- Handles path mapping between VS Code and MicroPython
- Efficient O(n) fibonacci demo (was O(2^n) recursive)
- Compatible with MicroPython's limited frame object attributes
- Comprehensive DAP protocol support

Files:
- debugpy/: Core debugging implementation
- test_vscode.py: VS Code integration test
- VSCODE_TESTING_GUIDE.md: Setup and usage instructions
- dap_monitor.py: Protocol debugging utility

Usage:
```python
import debugpy
debugpy.listen()          # Start debug server
debugpy.debug_this_thread()  # Enable tracing
debugpy.breakpoint()      # Manual breakpoint
```

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-11 15:09:40 +10:00
..
aiohttp aiohttp: Allow headers to be passed to a WebSocketClient. 2025-04-13 00:20:58 +10:00
cbor2 all: Apply Ruff 0.11.6 reformatting changes. 2025-04-24 16:54:10 +10:00
debugpy python-ecosys/debugpy: Add VS Code debugging support for MicroPython. 2025-06-11 15:09:40 +10:00
iperf3 all: Enable ruff E401 and E402 import lints. 2024-05-17 17:06:33 +10:00
pyjwt all: Standardise x.y.z versioning for all packages. 2023-07-23 11:48:57 +10:00
requests requests: Use the host in the redirect url, not the one in headers. 2025-04-12 10:47:56 +10:00
README.md

README.md

Python-ecosystem packages

These MicroPython versions of common Python packages, typically found on PyPI.

If a package has the same name as a PyPI package, then it should match at least some subset of the functionality.

Future plans

  • More organised directory structure based on library purpose (e.g. drivers, network, etc).