Skip to main content

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

  1. Create a GitHub release with the desired version number as the tag (e.g. v0.3.3).
  2. It will automatically build the package and upload it to the PyPI.

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xontrib_jupyter-0.3.4.tar.gz (51.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xontrib_jupyter-0.3.4-py3-none-any.whl (50.9 kB view details)

Uploaded Python 3

File details

Details for the file xontrib_jupyter-0.3.4.tar.gz.

File metadata

  • Download URL: xontrib_jupyter-0.3.4.tar.gz
  • Upload date:
  • Size: 51.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for xontrib_jupyter-0.3.4.tar.gz
Algorithm Hash digest
SHA256 a42a11c3d6a7d7f7de7ae18ef1cb40ed584a8cdca5627d1b94de88c5daecb9b7
MD5 1e368bd59bff32e7da0f5c490add3923
BLAKE2b-256 0af8f14d328c296696e471df4041e99d8734f8a1d0369f55f20fa1b9ff1498a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for xontrib_jupyter-0.3.4.tar.gz:

Publisher: release.yml on xonsh/xontrib-jupyter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file xontrib_jupyter-0.3.4-py3-none-any.whl.

File metadata

File hashes

Hashes for xontrib_jupyter-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5b7bc22bae09ced213d9f86236b3a1be2c7c342f8c68e5b45d920fd6d8193d96
MD5 6381bb2acd25ea22d50f9e0f18b45e8e
BLAKE2b-256 416b6a6961129b75063dba6f108271bfe6a72c9f953158c86d978b6ffa73d262

See more details on using hashes here.

Provenance

The following attestation bundles were made for xontrib_jupyter-0.3.4-py3-none-any.whl:

Publisher: release.yml on xonsh/xontrib-jupyter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page