{ "info": { "author": "Andrew Leech, Julian Todd, Tony DiCola", "author_email": "andrew@alelec.net", "bugtrack_url": null, "classifiers": [], "description": "Jupyter MicroPython Remote Kernel\n=================================\n\nJupyter kernel to interact with a MicroPython board over its REPL\ninterface.\n\nTypically used with micropython boards over the USB / Serial interface,\nhowever it should also work through the WEBREPL (available on ESP8266\nonly). Also includes a few advanced features for micorpython project\nmanagement; running mpy-cross, uploading files, syncing local libs to micropython etc.\n\nMicropython\n-----------\nThis kernel requires support in micropython from https://github.com/micropython/micropython/pull/3836\nAt the time of publishing, this is not in the current release, 1.9.4, so will require a master / daily snapshot until 1.9.5\n\nInstallation\n------------\n\nEnsure you have a new enough micropython installed on your board (see above).\n\nYou also need python 3.6 or above, ensuring it\u2019s available from your current\ncommand line. Optionally (recommended) use your favourite pipenv / virtualenv to set\nup a clean environment to run jupyter from.\n\nThen install this module:\n\n::\n\n pip install jupyter_micropython_remote\n\nInstall the kernel into jupyter itself using the shell command:\n\n::\n\n python -m mpy_kernel.install\n\nThis registers the kernel with Jupyter so it can be selected for use in\nnotebooks\n\nRunning\n-------\n\nNow run Jupyter notebooks:\n\n::\n\n jupyter notebook\n\nIn the notebook click the New notebook button in the upper right, you\nshould see your MicroPython kernel display name listed.\n\nThe first cell will need to be something like:\n\n::\n\n %connect --baudrate=115200 --user='micro' --password='python' --wait=0\n\neg:\n\n::\n\n %connect \"USB-SERIAL CH340\"\"\n\nor something that matches the serial port that you connect to your\nMicroPython/ESP8266 with.\n\nThe ```` and args matches the command used to run the standard\n``pyboard.py``:\n\n::\n\n device can be serial port device or name\n\n device can start with \"exec:\"\n \"Execute a process and emulate serial connection using its stdin/stdout.\"\n\n device can start with \"execpty:\"\n Execute a process which creates a PTY and prints slave PTY as\n first line of its output, and emulate serial connection using\n this PTY\n\n device can be an ip address for webrepl communication\n\nYou should now be able to execute MicroPython commands by running the\ncells.\n\nThere is a micropythondemo.ipynb file in the directory you could look at\nwith some of the features shown.\n\nIf a cell is taking too long to interrupt, it may respond to a \u201cKernel\u201d\n-> \u201cInterrupt\u201d command.\n\nAlternatively hit Escape and then \u2018i\u2019 twice.\n\nTo do a soft reboot (when you need to clear out the modules and recover\nsome memory) type:\n\n::\n\n %reboot\n\n| Note: Restarting the kernel does not actually reboot the device.\n| Also, pressing the reset button will probably mess things up, because\n this interface relies on the ctrl-A non-echoing paste mode to do its\n stuff.\n\nYou can list all the functions with:\n\n::\n\n %lsmagic\n\nmprepl\n-------\n\nThe communications interface to the micropython module is based on mprepl and pyboard.\nmprepl was originally sourced from https://github.com/micropython/micropython/pull/3034\n\nThis module utilises the virtual filesystem within micropython ( > 1.9.4 required )\nto mount the local pc's working directory jupyter was run from in the actual micropython\nenvironment at the directory ``/remote/``\n\nThis allows you to view, open, read, write and copy files to and from micropython to your pc with\nease.\n\n::\n\n import os\n print(os.listdir(\"/remote/\")\n\nThere is also an injected ``Util`` class with some extra file handling tools,\nculminating with a ``sync(source, target, delete=True, include=None, exclude=None)``\nwhich will copy all files/folders from source to target, optionally with include or exclude\nregex filters.\n\n::\n\n Util.sync(\"/remote/src\", \"/lib/\", delete=True, include=\".*\\.mpy\")\n\nSee the file ``mpy_kernel/mprepl_utils.py`` for more details\n\n%local\n------\nIndividual cells can also be run on the local pc instead of the remote\nkernel by starting a cell with ``%local``\n\nThis can be useful to work directly with local files, use ipywidgets, etc.\nCommands here will be run by the standard ipython kernel.\n\nIn `%local` cells, a special global function ``remote()`` is also available which\nwill pass a single string argument to the micropython board to be run, returning\nany stdout from the command. Eg:\n\nmicropython cell\n\n::\n\n from machine import Pin\n import neopixel\n pixels = neopixel.NeoPixel(Pin(4, Pin.OUT), 1)\n\n def set_colour(r, g, b):\n pixels[0] = (r, g, b)\n pixels.write()\n\n set_colour(0xff, 0xff, 0xff)\n\nlocal cell\n\n::\n\n %local\n import colorsys\n from ipywidgets import interact, Layout, FloatSlider\n\n def set_hue(hue):\n r, g, b = (int(p*255) for p in colorsys.hsv_to_rgb(hue, 1.0, 1.0))\n remote(f\"set_colour({r}, {g}, {b})\")\n\n slider = FloatSlider(min=0,max=1.0,step=0.01, layout=Layout(width='80%', height='80px'))\n interact(set_hue, hue=slider)\n\nContributing\n------------\n\nPlease use and improve this kernel any way you see fit!\n\nI'd prefer pull requests against the main repo: https://gitlab.com/alelec/jupyter_micropython_remote\nI'll happily review and accept anything on the legacy github if you are aren't already on gitlab: https://github.com/andrewleech/jupyter_micropython_remote\n\n\nBackground\n----------\n\nThis Jupyter MicroPython Kernel was originally based on the amazing work\ndone on\nhttps://github.com/goatchurchprime/jupyter_micropython_remote.git\n\n| Their original custom device connection library has been replaced by\n pyboard and mprepl to take advantage of proven functionality\n implemented there. mprepl has since been extended substantially.\n| The kernel has also been reworked to extend form the full ipython\n kernel, so local cells are fully-functional and we can use the ipython\n display mechanisms for output formatting.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://gitlab.com/alelec/jupyter_micropython_remote", "keywords": "jupyter micropython", "license": "GPL3", "maintainer": "", "maintainer_email": "", "name": "jupyter-micropython-remote", "package_url": "https://pypi.org/project/jupyter-micropython-remote/", "platform": "", "project_url": "https://pypi.org/project/jupyter-micropython-remote/", "project_urls": { "Homepage": "https://gitlab.com/alelec/jupyter_micropython_remote" }, "release_url": "https://pypi.org/project/jupyter-micropython-remote/1.5/", "requires_dist": [ "jupyter", "pyserial", "mpy-cross ; extra == 'mpy'" ], "requires_python": "", "summary": "Jupyter notebook kernel for remote execution on a Micropython system.", "version": "1.5" }, "last_serial": 5612084, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "79b80fc1e5be5d0f09b0d96827e0e77f", "sha256": "c59b3520418d2ad47e7a9b26b21e45e20d6e64f99ea89c2b65e31e6a7aa5fb99" }, "downloads": -1, "filename": "jupyter_micropython_remote-1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "79b80fc1e5be5d0f09b0d96827e0e77f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 24712, "upload_time": "2018-08-24T13:52:08", "url": "https://files.pythonhosted.org/packages/1d/84/5b6050706c58273ec82af6a38b8424dcb94561fcc254707650a73e48fb77/jupyter_micropython_remote-1.0-py3-none-any.whl" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "1b1d597b8d4e513fc6857b7e56bd56f2", "sha256": "cbb4a35b21a5ba21e9a5ec9106ecf4bbdb023c1b8e5748a901cb5a08ad4fd297" }, "downloads": -1, "filename": "jupyter_micropython_remote-1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "1b1d597b8d4e513fc6857b7e56bd56f2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 24723, "upload_time": "2018-08-26T02:16:51", "url": "https://files.pythonhosted.org/packages/45/ae/4567299f9d86beb2743a449756968dc527e6b0ecd34e5a6d996e87bacd43/jupyter_micropython_remote-1.1-py3-none-any.whl" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "4898c7d869f108bcfb8bbceed02bd940", "sha256": "baa441cd5b801b0ac3642ff027b27ca498cbfe9f4112b825e5a0aedd4c44c42d" }, "downloads": -1, "filename": "jupyter_micropython_remote-1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "4898c7d869f108bcfb8bbceed02bd940", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 24855, "upload_time": "2018-08-26T08:36:03", "url": "https://files.pythonhosted.org/packages/e1/25/4eb2b6f9aed7416160dd0b5f3781e35505de2e64491be65d320e731af449/jupyter_micropython_remote-1.2-py3-none-any.whl" } ], "1.3": [ { "comment_text": "", "digests": { "md5": "c7652c57bc280a8fea72b9dec5860bd4", "sha256": "a3440088700d057989c1c6bdf08165dcd45abd75afe4f4097fe7acd66996e637" }, "downloads": -1, "filename": "jupyter_micropython_remote-1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "c7652c57bc280a8fea72b9dec5860bd4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 26982, "upload_time": "2019-04-08T04:00:16", "url": "https://files.pythonhosted.org/packages/40/b3/78b5a2623bc75f1f97c26b4c4516a687ac5e766c880334df1176759d6e8f/jupyter_micropython_remote-1.3-py3-none-any.whl" } ], "1.4": [ { "comment_text": "", "digests": { "md5": "6c4f5683b0fabf8994c3eb1e2238ff3f", "sha256": "beae61f09af90c24fe4f3bc8cce08205b7d09f37128f2e018c3c11caf12374e0" }, "downloads": -1, "filename": "jupyter_micropython_remote-1.4-py3-none-any.whl", "has_sig": false, "md5_digest": "6c4f5683b0fabf8994c3eb1e2238ff3f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 27029, "upload_time": "2019-06-07T05:31:51", "url": "https://files.pythonhosted.org/packages/c4/8a/e5fddbd376851ece772ce8d5de04be391954a8dbca84d7922c3f452ada59/jupyter_micropython_remote-1.4-py3-none-any.whl" } ], "1.5": [ { "comment_text": "", "digests": { "md5": "e6995cb5ef9ddaf4cd2dafc88f585a98", "sha256": "61967b65b6b652fef99ac5749ccf784d1ade6faa79b2eb9ecc9acd83c3f215a2" }, "downloads": -1, "filename": "jupyter_micropython_remote-1.5-py3-none-any.whl", "has_sig": false, "md5_digest": "e6995cb5ef9ddaf4cd2dafc88f585a98", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 27045, "upload_time": "2019-07-31T07:42:19", "url": "https://files.pythonhosted.org/packages/0d/6a/130f600de9b41c89f72a6db3c6fe9ca52cbf0a4039b1d187617b8571ce0b/jupyter_micropython_remote-1.5-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e6995cb5ef9ddaf4cd2dafc88f585a98", "sha256": "61967b65b6b652fef99ac5749ccf784d1ade6faa79b2eb9ecc9acd83c3f215a2" }, "downloads": -1, "filename": "jupyter_micropython_remote-1.5-py3-none-any.whl", "has_sig": false, "md5_digest": "e6995cb5ef9ddaf4cd2dafc88f585a98", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 27045, "upload_time": "2019-07-31T07:42:19", "url": "https://files.pythonhosted.org/packages/0d/6a/130f600de9b41c89f72a6db3c6fe9ca52cbf0a4039b1d187617b8571ce0b/jupyter_micropython_remote-1.5-py3-none-any.whl" } ] }