a simple z shell jupyter kernel powered by python 3, pexpect and enthusiasm.
i love experimentation and tinkering, but usual shell terminals do not allow developing multiple different code snippets at once conveniently. with shell kernels you can turn your scripts into notebooks!
if you find this product useful, please consider supporting me with a one-time tip.
feedback and suggestions are welcome in github issues.
install the python package from pypi using available package manager like pip
or pipenv
(optional) by default the installation script will install the package and the kernel. the kernel location will be the same as the python environment from which the installation is done. check python -m zsh_jupyter_kernel.install -h
for possible installation options if you want to install the kernel in a different environment or to change display name.
sh
pipenv --python 3.10 install notebook zsh_jupyter_kernel
sh
python -m pip install notebook zsh_jupyter_kernel
expect the kernel to work as usual including your zsh configs except without stdin (user input) support and prompt line and in the boundaries of the current jupyter limitations like not all ansi codes will work in certain cases ('\r') and in general things that expect terminal will have unexpected behavior. see below why user input is not supported.
the kernel launches zsh as if it was a regular process launched from your terminal with a few minor settings to make sure it works with jupyter. there is slight chance it wont work with super complicated zshrc setups, but it works with majority of configs including oh-my-zsh.
the kernel configures zsh prompt string to its own custom value. when a user requests a cell execution, the code is sent to the kernel. then the kernel puts the frontend on hold, sends the code to zsh process, and waits for the prompt string to release the frontend and let the user request more code execution.
code completion is powered by quite a non-trivial script that involves multiple steps, including spawning another temporary zsh process and capturing completion options into a data structure that jupyter frontend understands.
code inspection is done by man --pager ul
which sends the whole man page to the frontend.
code completeness is checked with the temporary zsh process and help of EXEC
zsh option, which allows switching off code execution and simply check if the code is complete using the exit code of the zsh process itself.
stderr content is just sent to the front-end as regular stdout the same way it is in a terminal.
stdin is not supported because of the execution system when a process spawned by a user waits for stdin, there is no way to detect it.
jupyter is a request-reply system, and zsh as a shell that constantly receives input and prints whatever current processes want to output. there is no clear start and end of a code execution in a shell unlike in jupyter system: a front-end sends a code from a cell to a kernel and waits until the kernel sends the full output back.
because of these two different ways of interacting with user zsh jupyter kernel cannot process stdin in a way python kernel does on input()
, meaning you will not be able to enter a sudo password or answer y/n to prompts or use a pager like less. when a spawned program waits for a user input, you will need to interrupt the kernel and use any options which do not require input.
please let me know if you encounter an error or unexpected behavior using github issues. i will respond as soon as possible.
Bumps ipython from 8.4.0 to 8.10.0.
15ea1ed
release 8.10.0560ad10
DOC: Update what's new for 8.10 (#13939)7557ade
DOC: Update what's new for 8.10385d693
Merge pull request from GHSA-29gw-9793-fvw7e548ee2
Swallow potential exceptions from showtraceback() (#13934)0694b08
MAINT: mock slowest test. (#13885)8655912
MAINT: mock slowest test.a011765
Isolate the attack tests with setUp and tearDown methodsc7a9470
Add some regression tests for this changefd34cf5
Swallow potential exceptions from showtraceback()Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase
.
Bumps setuptools from 63.3.0 to 65.5.1.
Sourced from setuptools's changelog.
v65.5.1
Misc ^^^^
- #3638: Drop a test dependency on the
mock
package, always use :external+python:py:mod:unittest.mock
-- by :user:hroncok
- #3659: Fixed REDoS vector in package_index.
v65.5.0
Changes ^^^^^^^
- #3624: Fixed editable install for multi-module/no-package
src
-layout projects.- #3626: Minor refactorings to support distutils using stdlib logging module.
Documentation changes ^^^^^^^^^^^^^^^^^^^^^
- #3419: Updated the example version numbers to be compliant with PEP-440 on the "Specifying Your Projectβs Version" page of the user guide.
Misc ^^^^
- #3569: Improved information about conflicting entries in the current working directory and editable install (in documentation and as an informational warning).
- #3576: Updated version of
validate_pyproject
.v65.4.1
Misc ^^^^
- #3613: Fixed encoding errors in
expand.StaticModule
when system default encoding doesn't match expectations for source files.- #3617: Merge with pypa/[email protected] including fix for pypa/distutils#181.
v65.4.0
Changes ^^^^^^^
- #3609: Merge with pypa/[email protected] including support for DIST_EXTRA_CONFIG in pypa/distutils#177.
v65.3.0
... (truncated)
a462cb5
Bump version: 65.5.0 β 65.5.1de35d8b
Merge pull request #3656 from bmorris3/typos58e23de
Update changelog. Ref #3659.43a9c9b
Limit the amount of whitespace to search/backtrack. Fixes #3659.5791343
Add test capturing failed expectation. Ref #3659.1f97905
β« Fade to black.6254567
Remove workaround for emacs.729b180
β« Fade to black.c068081
Typo correctionsf777a40
Suppress deprecation warning in --rsyncdir. Workaround for #3655.Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase
.
Bumps certifi from 2022.6.15 to 2022.12.7.
9e9e840
2022.12.07b81bdb2
2022.09.24939a28f
2022.09.14aca828a
2022.06.15.2de0eae1
Only use importlib.resources's new files() / Traversable API on Python β₯3.11 ...b8eb5e9
2022.06.15.147fb7ab
Fix deprecation warning on Python 3.11 (#199)b0b48e0
fixes #198 -- update link in licenseDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase
.
Bumps nbconvert from 6.5.0 to 6.5.1.
7471b75
Release 6.5.1c1943e0
Fix pre-commit8685e93
Fix tests0abf290
Run black and prettier418d545
Run test on 6.x branchbef65d7
Convert input to string prior to escape HTML0818628
Check input type before escapingb206470
GHSL-2021-1017, GHSL-2021-1020, GHSL-2021-1021a03cbb8
GHSL-2021-1026, GHSL-2021-102548fe71e
GHSL-2021-1024Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase
.
ipython-kernel jupyter-kernel jupyter ipython zsh