System side python code using %python and %%python magics#30
System side python code using %python and %%python magics#30brentru merged 3 commits intoadafruit:masterfrom
Conversation
|
@qwertimer Thank you for incorporating nbdev into this project! I have a few questions:
|
There is not a requirement to install nbdev. The development of these magics is to allow python code to be run on the host. I am utilising this magic to implement nbdev based development.
The python magics arent part of jupyter as the circuitpython kernel catches all commands and so i built my own magics similar to %python and %%python in the jupyter kernel. However the jupyter kernel magics run a suubprocess and i ultimately want this code to allow both system side and circuit python code to be run together. for example - starting a microcontroller collect of a series of sensors then sending these to the notebook through the serial link in the jupyter notebook through the %%python magic the user can then plot in real time sensor data being collected. Further the user can then on the fly modify the uplink data and run a new set of plots. This is my goal. However at the moment the magics dont output the result to the notebook display and i need to work out how to store the information in the global scope. |
|
Thank you for the clarification. The goal of linking this kernel with CPython is something I've been curious about. |
CircuitPython REPLs are an excellent way to do testing of code during development. But once it is tested you need to save it to a code.py file. These magics allow you to run python code on the system rather than on the microcontroller. The main focus of this development was to incorporate the nbdev (https://github.com/fastai/nbdev) pipeline. nbdev automatically saves your code cells to a .py file when the notebook2script file is run. This script creation can be tailored to create code.py files for the microcontroller with cells being added to the file based on #export command. Further to this i envision this added functionality to allow the user to interact with the microcontroller by collecting and parsing data in real time and creating plots and figures from the data during development.