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. Bump the version of the package poetry version patch (or minor/major)

  2. Push the changes to the repo and publish with

    poe release
    
  3. The release notes are automatically generated as a draft release after each PR.

  4. Create a GitHub release from the draft release against the newly pushed tag

  5. Publish the package with poetry publish

Known issues

Uncaptured output

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.0.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

xontrib_jupyter-0.3.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xontrib_jupyter-0.3.0.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.3 Darwin/22.4.0

File hashes

Hashes for xontrib_jupyter-0.3.0.tar.gz
Algorithm Hash digest
SHA256 17735c756e4e74a440b7e88b374176b7864247c13e1c33a843070207b6fc69f5
MD5 e3c026ee4b5054720de2f6b32245930c
BLAKE2b-256 5fb8325fab17fc737c94b9a720f256e9f9e15c1fe7891c7f7544772a6ad4b7bc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xontrib_jupyter-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.3 Darwin/22.4.0

File hashes

Hashes for xontrib_jupyter-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 04348aa2adcd598998a353803a008f9f76571e9d4e09fd6629281f937b92fec9
MD5 fbb556ffeecdd7c516083e431e518b5c
BLAKE2b-256 6899af26411f1a86ebc31a04316ca458cf048406ced95e645f9593a82edcc17c

See more details on using hashes here.

Supported by

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