ipython-icat
Installation
You can install ipython-icat using pip:
pip install ipython-icat
Requirements
- Python 3.11+
- IPython
- matplotlib
- Pillow (PIL)
- terminal emulator with support for kitty graphics protocol (KGP) e.g., kitty, ghostty
Usage
Loading the Extension
In your IPython session, load the extension:
%load_ext icat
For startup files, Neovim terminals, or other launchers that should enable the backend immediately after loading the extension, set:
IPYTHON_ICAT_AUTO=1
Displaying Matplotlib Plots
To enable icat integration for both matplotlib plots and automatic PIL image rendering:
%icat
After running this command:
- Matplotlib plots will be displayed directly in your kitty-compatible terminal.
- Evaluating a
PIL.Image.Imagevalue (e.g. typingimgat the prompt) will automatically render it.
You can also run:
%icat statusto see whether integration is enabled%icat offto disable auto-rendering and restore the previous matplotlib backend (best-effort)
Use as a Default Backend
To set the kitty backend for matplotlib as the default, add the following lines to your IPython configuration file:
c.InteractiveShellApp.extensions = ['icat']c.InteractiveShellApp.exec_lines = ['%icat on']
Automatic Setup
You can quickly set up IPython to use the icat extension using the setup command:
python -m icat setup
This command will:
- Create an IPython profile if it doesn't exist (or use an existing one)
- Configure the profile to load the icat extension automatically
- Set matplotlib to use the icat backend by default
Additional options:
--profile NAME- Use a specific profile instead of the default--ipython-path PATH- Specify a custom path to the .ipython directory
Example with custom profile:
python -m icat setup --profile myprofile
Displaying Images
To display an image file, a PIL Image object, or a Python expression that evaluates to a PIL Image:
%icat path/to/your/image.jpg
or
from PIL import Image
img = Image.open('path/to/your/image.jpg')
%icat img
Expressions work too:
%icat ds[0].image
You can also resize the image when displaying:
%icat path/to/your/image.jpg -W 300 -H 200
Using Ghostty
If you'd like to use this plugin with Ghostty, make sure to install the static kitten binary which will allow you to run kitten icat.
Using Full-Screen Terminal Apps
ipython-icat can render through full-screen terminal programs, such as Neovim
terminal buffers, by asking kitten icat to emit Kitty unicode placeholders.
Enable that mode with:
IPYTHON_ICAT_PLACEHOLDER=1
The placeholder path is configured with environment variables:
IPYTHON_ICAT_CELL_PIXELS=WIDTHxHEIGHTsupplies the terminal cell size in pixels. This letskitten icatcompute the window size when IPython is running inside an embedded terminal.IPYTHON_ICAT_WINDOW_SIZE=COLS,ROWS,WIDTH_PX,HEIGHT_PXoverrides the computed window size completely.IPYTHON_ICAT_TRANSFER_MODE=stream|file|memory|detectselects the Kitty graphics transfer mode. The default isstream, which works reliably through Neovim and Ghostty.IPYTHON_ICAT_PASSTHROUGH=none|tmux|detectcontrols whetherkitten icatwraps graphics commands for tmux. The default isnone; use this when a host program relays the graphics request itself.
pyrepl.nvim sets these variables
automatically when starting IPython and relays Kitty graphics requests from the
embedded terminal to the host terminal.
Features
- Display matplotlib plots directly in kitty terminal
- Show PIL Image objects or image files
- Resize images on display
- Seamless integration with IPython workflow
- Kitty unicode-placeholder support for embedded terminal workflows
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Acknowledgments
- matplotlib-backend-kitty for the original implementation
- matplotlib and Pillow for their excellent libraries
- kitty terminal for developing the graphics protocol
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for ipython-icat 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ipython_icat-0.5.1.tar.gz | 8.4 kB | Without provenance | Details for ipython_icat-0.5.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ipython_icat-0.5.1-py3-none-any.whl | Python 3 | none | any | Details for ipython_icat-0.5.1-py3-none-any.whl |
Total release size: 17.2 kB
Release files / ipython_icat-0.5.1.tar.gz
| Download URL | ipython_icat-0.5.1.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f5c0a60e71bcdb804bd606865965cff4c83571916c416949c2784a4cde23050a
|
|
BLAKE2b-256 checksum How to use checksums |
1b6a2bcce3f6489a0ddea0a3e99be2dd2540ec58cc77f62c21c68b86be85060b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Release files / ipython_icat-0.5.1-py3-none-any.whl
| Download URL | ipython_icat-0.5.1-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e576fc102553f0956466ebd24e796253e4266738771a58cfcbe7ac386e4a43ae
|
|
BLAKE2b-256 checksum How to use checksums |
cb747c1302e2e16c914656ebafccb3bff53b6b57bde55dbce539c077a14ca30c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.4
|
Security for ipython-icat 0.5.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.