- … image:: https://mybinder.org/badge_logo.svg
A Jupyter kernel for bash
Installation
This requires IPython 3.
pip install bash_kernel python -m bash_kernel.install
To use it, run one of:
jupyter notebook
# In the notebook interface, select Bash from the 'New' menu
jupyter qtconsole --kernel bash
jupyter console --kernel bash
Displaying Rich Content
To use specialized content (images, html, etc) this file defines (in build_cmds()) bash functions that take the contents as standard input. Currently, display (images), displayHTML (html) and displayJS (javascript) are supported.
Example:
cat dog.png | display
echo "<b>Dog</b>, not a cat." | displayHTML
echo "alert('It is known khaleesi\!');" | displayJS
Updating Rich Content Cells
If one is doing something that requires dynamic updates, one can specify a unique display_id, should be a string name (downstream documentation is not clear on this), and the contents will be replaced by the new value. Example:
display_id="id_${RANDOM}"
((ii=0))
while ((ii < 10)) ; do
echo "<div>${ii}</div>" | displayHTML $display_id
((ii = ii+1))
sleep 1
done
The same works for images or even javascript content.
Remember to create always a new id (random ids works perfect) each time the cell is executed, otherwise it will try to display on an HTML element that no longer exists (they are erased each time a cell is re-run).
Programmatically Generating Rich Content
Alternatively one can simply generate the rich content to a file in /tmp (or $TMPDIR) and then output the corresponding (to the mimetype) context prefix “_TEXT_SAVED_*” constant. So one can write programs (C++, Go, Rust, etc.) that generates rich content appropriately, when within a notebook.
The environment variable “NOTEBOOK_BASH_KERNEL_CAPABILITIES” will be set with a comma separated list of the supported types (currently “image,html,javascript”) that a program can check for.
To output to a particular “display_id”, to allow update of content (e.g: dynamically updating/generating a plot from a command line program), prefix the filename with “(<display_id>)”. E.g: a line to display the contents of /tmp/myHTML.html to a display id “id_12345” would look like:
bash_kernel: saved html data to: (id_12345) /tmp/myHTML.html
More Information
For details of how this works, see the Jupyter docs on wrapper kernels, and Pexpect’s docs on the replwrap module.
Metadata
Release files for bash_kernel 0.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bash_kernel-0.9.0.tar.gz | 10.0 kB | Without provenance | Details for bash_kernel-0.9.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bash_kernel-0.9.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for bash_kernel-0.9.0-py2.py3-none-any.whl |
Total release size: 21.2 kB
Release files / bash_kernel-0.9.0.tar.gz
| Download URL | bash_kernel-0.9.0.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0423f0512ef6f83a654e1439a369718899a38f27948fe21b665b2df1dbf3a7c7
|
|
BLAKE2b-256 checksum How to use checksums |
330e942ac1f1717afcaca6430978a8ccb83037c2c72ece40d6f76b1db9310043
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.28.1
|
Release files / bash_kernel-0.9.0-py2.py3-none-any.whl
| Download URL | bash_kernel-0.9.0-py2.py3-none-any.whl |
|---|---|
| Size | 11.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
95b9a6fc7a9b1ba90192a9bf20109b2af1ca073010db514dbc828aacdec6f8c6
|
|
BLAKE2b-256 checksum How to use checksums |
6646abd13b067fa12bac298ac9a404a675d25dc374faaca0f632bc5097d85279
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.28.1
|
Security for bash_kernel 0.9.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.