circuitpython_kernel package

Submodules

circuitpython_kernel.board module

Serial Connection to a Board

circuitpython_kernel.board.connect()[source]

Connect to a pySerial Serial object.

If you do not see the REPL hit enter a few times. Control-A or Home sends you to beginning of line. Control-E or End to the end of the line.

SAMD21 REPL prompt is >>>
  • Press any key will enter REPL
  • Ctrl-D does a soft reset.

ESP8266 REPL prompt is >>>

There are four other control commands:

Ctrl-A on a blank line will enter raw REPL mode. This is like a permanent paste mode, except that characters are not echoed back.

Ctrl-B on a blank like goes to normal REPL mode.

Ctrl-C cancels any input, or interrupts the currently running code.

Ctrl-D on a blank line will do a soft reset.

Note that Ctrl-A and Ctrl-D do not work with WebREPL.

Returns:Serial object connected to the microcontroller board
Return type:obj
circuitpython_kernel.board.find_adafruit_board()[source]

Find serial port where Adafruit board is connected

circuitpython_kernel.install module

Kernelspec installation.

circuitpython_kernel.install.install_my_kernel_spec(user=True, prefix=None)[source]

Install circuitpython kernel to list of kernels.

circuitpython_kernel.install.main(argv=None)[source]

circuitpython_kernel.kernel module

Basic functionality of CircuitPython kernel.

class circuitpython_kernel.kernel.CircuitPyKernel(**kwargs)[source]

Bases: ipykernel.kernelbase.Kernel

CircuitPython kernel implementation.

banner = 'Jupyter and CircuitPython create fablab-ulous things.'
do_complete(code, cursor_pos)[source]

Support code completion.

do_execute(code, silent, store_history=True, user_expressions=None, allow_stdin=False)[source]

Execute a user’s code cell.

Parameters:
  • code (str) – Code, one or more lines, to be executed.
  • silent (bool) – True, signals kernel to execute code quietly, and output is not displayed.
  • store_history (bool) – Whether to record code in history and increase execution count. If silent is True, this is implicitly false.
  • user_expressions (dict, optional) – Mapping of names to expressions to evaluate after code is run.
  • allow_stdin (bool) – Whether the frontend can provide input on request (e.g. for Python’s raw_input()).
Returns:

Execution results.

Return type:

dict

implementation = 'circuitpython_kernel'
implementation_version = '0.3.0.dev'
language_info = {'codemirror_mode': {'version': 3, 'name': 'python'}, 'file_extension': '.py', 'mimetype': 'text/x-python', 'name': 'python', 'pygments_lexer': 'python3', 'version': '3'}
protocol_version = '4.5.2'
run_code(code)[source]

Run a code snippet.

Parameters:code (str) – Code to be executed.
Returns:
  • out – Decoded bytearray output result from code run.
  • err – Decoded bytearray error from code run.

circuitpython_kernel.version module

CircuitPython Kernel version info

Module contents

A Jupyter kernel for CircuitPython