Xonsh kernel for Jupyter Notebook and Jupyter Lab allows to execute xonsh shell commands in a notebook cell
Project description
Xonsh kernel for Jupyter Notebook and Jupyter Lab allows to execute xonsh shell commands in a notebook cell.
If you like the idea click ⭐ on the repo and tweet.
Installation
To install use xpip:
xpip install xontrib-jupyter
# or: xpip install -U git+https://github.com/xonsh/xontrib-jupyter
xontrib load jupyter
xonfig jupyter-kernel --help # Options for installing.
xonfig jupyter-kernel --user # Install kernel spec in user config directory.
Check the installation:
jupyter kernelspec list
# Available kernels:
# python3 /opt/homebrew/lib/python3.11/site-packages/ipykernel/resources
# xonsh /PATH_TO_ENV_PREFIX/share/jupyter/kernels/xonsh
xontrib load jupyter
xonfig jupyter-kernel
# Installing Jupyter kernel spec:
# root: None
# prefix: /PATH_TO_ENV_PREFIX/
# as user: False
xonfig info
#| jupyter | True
#| jupyter kernel | /PATH_TO_ENV_PREFIX/share/jupyter/kernels/xonsh
Usage
Jupyter
Just run Jupyter Notebook or JupyterLab and choose xonsh:
jupyter notebook
# or
jupyter lab
Euporie
Euporie is a terminal based interactive computing environment.
euporie-notebook --kernel-name xonsh # or change the kernel in UI
# or
euporie-console --kernel-name xonsh # or change the kernel in UI
Testing
- install the project with its dependencies
poetry install
poetry install --only-root
- now start the xonsh shell
xonsh --no-rc
- inside the xonsh shell, you can load the jupyter xontrib and install the kernel
xontrib load jupyter
# this will install the kernel
xonfig jupyter-kernel --user
# now start a notebook and choose xonsh kernel
jupyter notebook
Releasing your package
-
Bump the version of the package
poetry version patch
(or minor/major) -
Push the changes to the repo and publish with
poe release
-
The release notes are automatically generated as a draft release after each PR.
-
Create a GitHub release from the draft release against the newly pushed tag
Known issues
Uncaptured output
In some cases you need to enable capturing first:
$XONSH_CAPTURE_ALWAYS = True
$XONSH_SUBPROC_CAPTURED_PRINT_STDERR = True
Uncaptured output because of pager
Some tools like AWS CLI using the uncapturable less
pager to show the output by default. In these cases you need to find the way to disable the pager e.g. set $AWS_PAGER = 'cat'
for AWS CLI.
Credits
- This package was created with xontrib cookiecutter template.
- awesome-jupyter - A curated list of awesome Jupyter projects, libraries and resources.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file xontrib_jupyter-0.3.1.tar.gz
.
File metadata
- Download URL: xontrib_jupyter-0.3.1.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3516e0f2d3b03906f5f548601ceac253e0ef57fc1d4f4b20e55ba5b482071803 |
|
MD5 | c0d6081a97f12e0c37bb1218f3184aa5 |
|
BLAKE2b-256 | b171c183546b9dfa650ca217e0f5e8a025af0c57b074f216f08a18a848508a9e |
File details
Details for the file xontrib_jupyter-0.3.1-py3-none-any.whl
.
File metadata
- Download URL: xontrib_jupyter-0.3.1-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a677460407987a5dd4d687f9042d4a4ad91e335d42f96196884eade9ea589b16 |
|
MD5 | 60d5813ffa4709f351de0e7e153dabc6 |
|
BLAKE2b-256 | 8c9fd8aa369ab853912fffa7f006edf707a2d510e4592622e936038f567381fe |