• Stars
    star
    35
  • Rank 750,836 (Top 15 %)
  • Language
    Python
  • License
    MIT License
  • Created over 2 years ago
  • Updated about 2 months 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 shell. Full-featured and cross-platform.
Python
8,337
star
2

awesome-xontribs

Awesome list of Xonsh contributions/extensions
CSS
68
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
42
star
5

amalgamate

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

py-bash-completion

A framework for accessing bash completions from Python
Python
19
star
7

xontrib-jedi

Xonsh Python mode completions using jedi
Python
19
star
8

xontrib-abbrevs

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

xontrib-vox

Python virtual environment manager for xonsh.
Python
18
star
10

minixonsh

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

xontrib-fish-completer

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

slug

A snail without its shell
Python
14
star
13

coral

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

xontrib-whole-word-jumping

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

pygments-cache

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

scipy2019_tutorial

7
star
17

xonsh-docs

Documentation for xonsh
HTML
7
star
18

container

xonsh on docker
Python
7
star
19

xontrib-bashisms

Bash-like interactive mode extensions for the xonsh shell. It's made mostly for education reasons.
Python
5
star
20

xontrib-mpl

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

xonshbot

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

prlint

xonsh pull request linting
Python
4
star
23

xolors

xonsh color helper
Python
3
star
24

py-source-highlight

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

xontrib-ptk-shell

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

pycon2016

Xonsh Talk for PyCon 2016
Python
3
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
3
star
28

xontrib-debug-tools

Debug tools for xonsh shell.
Python
3
star
29

peg-parser

xonsh-parser
Python
2
star
30

xontrib-coreutils

Additional cross-platform core utilities that are implemented in xonsh.
2
star
31

xontrib-distributed

Dask Distributed integration for Xonsh
Python
1
star
32

replit

Code for Repl.it Live Demo
Python
1
star
33

scipy-2019-tutorial

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

xonsh.github.io

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

actions

Github CI workflows for the xonsh shell internal projects.
1
star
36

import-profiling

Some xonsh-related importe profiling.
HTML
1
star
37

.github

1
star
38

inabox

Distribution of shellinabox for Xonsh
Shell
1
star