• Stars
    star
    26
  • Rank 900,937 (Top 19 %)
  • Language
    Python
  • License
    MIT License
  • Created about 2 years ago
  • Updated 17 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Xonsh jupyter kernel allows to run Xonsh shell code in Jupyter, JupyterLab, Euporia, etc.

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

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

More Repositories

1

xonsh

🐚 Python-powered, cross-platform, Unix-gazing shell.
Python
7,938
star
2

awesome-xontribs

Awesome list of Xonsh contributions/extensions
CSS
55
star
3

lazyasd

Lazy & self-destructive tools for speeding up module imports
Python
44
star
4

xontrib-template

Full-featured template for building extension (xontrib) for the xonsh shell.
Python
40
star
5

amalgamate

Collapses Python packages into a single module.
Python
28
star
6

xontrib-jedi

Xonsh Python mode completions using jedi
Python
18
star
7

py-bash-completion

A framework for accessing bash completions from Python
Python
17
star
8

xontrib-abbrevs

Command abbreviations. This expands input words as you type.
Python
17
star
9

minixonsh

Subset of Xonsh, that can be statically compiled, implemented in C++
C++
15
star
10

slug

A snail without its shell
Python
14
star
11

xontrib-fish-completer

Populate rich completions using fish and remove the default bash based completer
Python
13
star
12

xontrib-vox

Python virtual environment manager for xonsh.
Python
13
star
13

coral

The animating and life-affirming code formatter for Xonsh & Python
Python
10
star
14

pygments-cache

A fast drop-in replacement for pygments `get_*()` and `guess_*()` funtions
Python
8
star
15

xontrib-whole-word-jumping

Jump/delete across whole (non-whitespace) words with Ctrl+Left/Right/Delete/Backspace.
Python
8
star
16

scipy2019_tutorial

7
star
17

xonsh-docs

Documentation for xonsh
HTML
7
star
18

container

xonsh on docker
Python
6
star
19

xonshbot

Lou Carcolh: destroyer of worlds, bridger of IRC and Gitter.im
4
star
20

xontrib-mpl

Matplotlib hooks for xonsh, including 'mpl' alias that displays the current figure on the screen
Python
4
star
21

xolors

xonsh color helper
Python
3
star
22

py-source-highlight

Python Bindings & Pygments-like Interface to source-highlight
Python
3
star
23

xontrib-ptk-shell

feature rich prompt-toolkit based shell backend for Xonsh
Python
3
star
24

xontrib-bashisms

Bash-like interactive mode extensions for the xonsh shell.
Python
3
star
25

prlint

xonsh pull request linting
Python
3
star
26

pycon2016

Xonsh Talk for PyCon 2016
Python
2
star
27

xontrib-free-cwd

To release the lock on the current directory whenever the prompt is shown in xonsh shell. Windows only xontrib.
Python
2
star
28

xontrib-debug-tools

Debug tools for xonsh shell.
Python
2
star
29

xontrib-distributed

Dask Distributed integration for Xonsh
Python
1
star
30

inabox

Distribution of shellinabox for Xonsh
Shell
1
star
31

replit

Code for Repl.it Live Demo
Python
1
star
32

scipy-2019-tutorial

xonsh - bringing Python data science to your shell
CSS
1
star
33

xonsh.github.io

The xonsh website available at http://xon.sh
JavaScript
1
star
34

xontrib-coreutils

Additional cross-platform core utilities that are implemented in xonsh.
1
star
35

import-profiling

Some xonsh-related importe profiling.
HTML
1
star