Package: ipylivebash
ipylivebashThe ipylivebash library is a shell script runner that enhances Jupyter's capabilities, transforming it into an valuable tool within the context of DevOps.Features:Live Magic: Added "%%livebash" live magic command to run shell script in Jupyter.Execution Confirmation UI: Avoid accidental executionNotification: Send a notification when the script finishesBackground Process Management: Show and kill background processLogging: Log output to a file with/without timestamp informationPython API: For running script easilyScreenshotsExecution ConfirmationExample%%livebash --save log.txt --save-timestamp

find .Runfind .and show the output in the Jupyter notebook, and also save it to log-${current_timestamp}.txt.%%livebash --ask-confirm --notify
set -e
deploy_scriptBefore running thedeploy_script, show a panel to ask for confirmation. Once it is finished, inform the user with a browser notification.Usageusage: livebash [-h] [-ps] [--save OUTPUT_FILE] [--save-timestamp]
                [--line-limit LINE_LIMIT] [--height HEIGHT] [--ask-confirm]
                [--notify]

options:
  -h, --help
  -ps, --print-sessions
  --save OUTPUT_FILE    Save output to a file
  --save-timestamp      Add timestamp to the output file name
  --line-limit LINE_LIMIT
                        Restrict the no. of lines to be shown
  --height HEIGHT       Set the height of the output cell (no. of line)
  --ask-confirm         Ask for confirmation before execution
  --notify              Send a notification when the script finishedOptions--save OUTPUT_FILESave the output to a file.If the file name already exists, it will add a suffix to avoid overriding the original file.--save-timestampAdd timestamp to the output file name.--line-limit LINE_LIMITIf the no. of line output exceed the limit, it may be truncated.
It will show the last 5 lines only.--height HEIGHTSet the height of the output cell--ask-confirmAsk for confirmation before execution--notifySend a notification when the script finishedInstallationYou can install usingpip:pipinstallipylivebashRemarks: If you are using Jupyter Notebook 5.2 or earlier, you may also need to enable
the nbextension:jupyternbextensionenable--py[--sys-prefix|--user|--system]ipylivebashDevelopment InstallationCreate a dev environment:condacreate-nipylivebash-dev-cconda-forgenodejsyarnpythonjupyterlab
condaactivateipylivebash-devInstall the python. This will also build the TS package.pipinstall-e".[test, examples]"When developing your extensions, you need to manually enable your extensions with the
notebook / lab frontend. For lab, this is done by the command:jupyter labextension develop --overwrite .
yarn run buildFor classic notebook, you need to run:jupyter nbextension install --sys-prefix --symlink --overwrite --py ipylivebash
jupyter nbextension enable --sys-prefix --py ipylivebashNote that the--symlinkflag doesn't work on Windows, so you will here have to run
theinstallcommand every time that you rebuild your extension. For certain installations
you might also need another flag instead of--sys-prefix, but we won't cover the meaning
of those flags here.How to see your changesTypescript:If you use JupyterLab to develop then you can watch the source directory and run JupyterLab at the same time in different
terminals to watch for changes in the extension's source and automatically rebuild the widget.# Watch the source directory in one terminal, automatically rebuilding when neededyarnrunwatch# Run JupyterLab in another terminaljupyterlabAfter a change wait for the build to finish and then refresh your browser and the changes should take effect.Python:If you make a change to the python code then you will need to restart the notebook kernel to have it take effect.