Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xonsh/xontrib-jupyter
Xonsh jupyter kernel allows to run Xonsh shell code in Jupyter, JupyterLab, Euporia, etc.
https://github.com/xonsh/xontrib-jupyter
euporie jupyter jupyter-extension jupyter-kernels jupyter-lab jupyter-notebook jupyter-notebook-extension jupyter-notebooks jupyterlab jupyterlab-extension jupyterlab-notebooks jupyterlab-shell notebook xonsh xontrib
Last synced: 30 days ago
JSON representation
Xonsh jupyter kernel allows to run Xonsh shell code in Jupyter, JupyterLab, Euporia, etc.
- Host: GitHub
- URL: https://github.com/xonsh/xontrib-jupyter
- Owner: xonsh
- License: mit
- Created: 2022-03-20T12:12:24.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-23T17:50:21.000Z (about 2 months ago)
- Last Synced: 2024-09-29T00:01:44.453Z (about 1 month ago)
- Topics: euporie, jupyter, jupyter-extension, jupyter-kernels, jupyter-lab, jupyter-notebook, jupyter-notebook-extension, jupyter-notebooks, jupyterlab, jupyterlab-extension, jupyterlab-notebooks, jupyterlab-shell, notebook, xonsh, xontrib
- Language: Python
- Homepage:
- Size: 175 KB
- Stars: 34
- Watchers: 5
- Forks: 4
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-xontribs - jupyter - Jupyter Notebook kernel for Xonsh. (Integrations / Prompt tweaks)
README
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](https://xon.sh/aliases.html#xpip):
```xsh
xpip install xontrib-jupyter
# or: xpip install -U git+https://github.com/xonsh/xontrib-jupyterxontrib load jupyter
xonfig jupyter-kernel --help # Options for installing.
xonfig jupyter-kernel --user # Install kernel spec in user config directory.
```Check the installation:
```xsh
jupyter kernelspec list
# Available kernels:
# python3 /opt/homebrew/lib/python3.11/site-packages/ipykernel/resources
# xonsh /PATH_TO_ENV_PREFIX/share/jupyter/kernels/xonshxontrib load jupyter
xonfig jupyter-kernel
# Installing Jupyter kernel spec:
# root: None
# prefix: /PATH_TO_ENV_PREFIX/
# as user: Falsexonfig info
#| jupyter | True
#| jupyter kernel | /PATH_TO_ENV_PREFIX/share/jupyter/kernels/xonsh```
## Usage
### Jupyter
Just run [Jupyter Notebook or JupyterLab](https://jupyter.org/) and choose xonsh:
```xsh
jupyter notebook
# or
jupyter lab
```### Euporie
[Euporie](https://github.com/joouha/euporie) is a terminal based interactive computing environment.
```xsh
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
```bash
poetry install
poetry install --only-root
```
- now start the xonsh shell```sh
xonsh --no-rc
```- inside the xonsh shell, you can load the jupyter xontrib and install the kernel
```sh
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```bash
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:
```xsh
$XONSH_CAPTURE_ALWAYS = True
$XONSH_SUBPROC_CAPTURED_PRINT_STDERR = True
```### Uncaptured output because of pager
Some tools like [AWS CLI](https://aws.amazon.com/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'`](https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-pagination.html#cli-usage-pagination-awspager) for AWS CLI.
## Credits
* This package was created with [xontrib cookiecutter template](https://github.com/xonsh/xontrib-cookiecutter).
* [awesome-jupyter](https://github.com/markusschanta/awesome-jupyter) - A curated list of awesome Jupyter projects, libraries and resources.