Git Product home page Git Product logo

execthatcell's Introduction

ExecThatCell

(Re)Execute a Jupyter (colab) notebook cell programmatically by searching for its label.

Note 1: I added the "Re" because the cell needs to be executed at least once as this library is not using the ipynb notebook file, but the interpreter to find the cells and it will work even if the cell was not saved in the notebook file.
Note 2: From version 5.0, Jupyter notebooks can have a tag that could be used to execute specific cells reading the ipynb file or using Javascript inside a notebook. The tag embedded in the notebook file is very useful when using Voila as it is based on the nbconvert. However, ExecThatCell still works using pure IPython. Additionally, Voila will not have any problems with ExecThatCell either, as long as the user remembers the cells will be executed following the order according to how they appear in the notebook file.

Installation (Python3 because you should not use Python2 anymore):

Option #1: Clone the repo so you will get everything

$ git clone https://github.com/ricardodeazambuja/ExecThatCell.git
$ cd ExecThatCell
$ sudo pip3 install .

Option #2: Install directly from git

$ sudo pip3 install git+git://github.com/ricardodeazambuja/ExecThatCell

Usage:

See the Example.ipynb.
It also works with the IPython interpreter (you know, when you use it directly from a command line without Jupyter). However, to add a label to a cell you need to add a linefeed after it and that means pressing Ctrl+q followed by Ctrl+j.

In the case you just want to execute again a cell that you know the index (the number inside the square brackets after "In"), you could just do something like this (Jupyter notebook, Google Colab or IPython command line version):

i = 10 # the cell index you want to execute again
exec(In[i])

TODO:

  • Test it :D

Other projects you may like to check:

  • colab_utils: Some useful (or not so much) Python stuff for Google Colab notebooks
  • Maple-Syrup-Pi-Camera: Low power('ish) AIoT smart camera (3D printed) based on the Raspberry Pi Zero W and Google Coral EdgeTPU
  • The CogniFly Project: Open-source autonomous flying robots robust to collisions and smart enough to do something interesting!
  • Bee: The Bee simulator is an open source Spiking Neural Network (SNN) simulator, freely available, specialised in Liquid State Machine (LSM) systems with its core functions fully implemented in C.

execthatcell's People

Contributors

ricardodeazambuja avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.