Metadata-Version: 2.4
Name: nbcat
Version: 1.0.0
Summary: cat for jupyter notebooks
Project-URL: Homepage, https://github.com/akopdev/nbcat
Project-URL: Repository, https://github.com/akopdev/nbcat
Author-email: Akop Kesheshyan <devnull@akop.dev>
Maintainer-email: Akop Kesheshyan <devnull@akop.dev>
License: MIT License
        
        Copyright (c) 2025 Akop Kesheshyan
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Requires-Python: >=3.10
Requires-Dist: argcomplete
Requires-Dist: markdownify
Requires-Dist: pydantic
Requires-Dist: requests
Requires-Dist: rich
Requires-Dist: textual
Requires-Dist: textual-image[textual]
Provides-Extra: dev
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: pytest-mock; extra == 'dev'
Requires-Dist: pytest-responses; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Description-Content-Type: text/markdown

<h1 align="center">nbcat: Jupyter notebooks viewer</h1>

[nbcat](https://github.com/akopdev/nbcat) let you preview Jupyter notebooks directly in your terminal. Think of it as `cat`, but for `.ipynb` files.

<p align="center">
  <a href="docs/screenshot.png" target="blank"><img src="docs/screenshot.png" width="400" /></a>
  <a href="docs/screenshot2.png" target="blank"><img src="docs/screenshot2.png" width="400" /></a>
</p>

## Features

- Very fast and lightweight with minimal dependencies.
- Preview remote notebooks without downloading them.
- Enable paginated view mode with keyboard navigation (similar to `less`).
- Supports image rendering in high resolution
- Supports for all Jupyter notebook versions, including old legacy formats.

## Motivation

The idea of previewing notebooks in a terminal is not new - there have been many previous attempts to achieve it.  
However, most are either slow and overengineered with a ton of half-working features, or they're outdated and incompatible with modern Python.

I was looking for a simple tool that let me quickly render Jupyter notebooks without switching context from my terminal window or installing a ton of dependencies.  

Please note, that `nbcat` doesn't aim to replace JupyterLab. If you need a full-featured terminal experience, I recommend checking out [euporie](https://euporie.readthedocs.io/) instead.


## Installation

```bash
# Install from PyPI (recommended)
$ pip install nbcat

# Install via Homebrew
$ brew tab akopdev/formulas/nbcat
$ brew install nbcat
```

## Quickstart

```bash
$ nbcat notebook.ipynb
```

You can pass URLs as well.

```bash
$ nbcat https://raw.githubusercontent.com/akopdev/nbcat/refs/heads/main/tests/assets/test4.ipynb
```
In most cases system `less` will render images in low resolution. Consider using an internal pager instead:

```bash
$ nbcat notebook.ipynb --page
```
## Integrations

`nbcat` is designed to integrate seamlessly with other tools. Here are a few examples of how easily it can be done.

### FZF (Fuzzy finder)

List all `.ipynb` files and use `nbcat` to preview them:

```bash
find . -type f -name "*.ipynb" | fzf --preview 'nbcat {}'
```

### Ranger
To enable previews in Ranger, add the `ipynb` extension to the `handle_extension` function in `~/.config/ranger/scope.sh`:

```bash 
...

handle_extension() {
    case "${FILE_EXTENSION_LOWER}" in
        ipynb)
            nbcat "${FILE_PATH}" && exit 5
            exit 1;;
        ...
```

## Testing & Development

Run the tests:

```bash
make test
```

Check code quality:

```bash
make format lint
```

## Contributing

Contributions are welcome! Please open an issue or [pull request](https://github.com/akopdev/nbcat/pulls).

## License

Distributed under the MIT License. See [`LICENSE`](./LICENSE) for more information.

## Useful Links

- 📘 Documentation: _coming soon_
- 🐛 Issues: [GitHub Issues](https://github.com/akopdev/nbcat/issues)
- 🚀 Releases: [GitHub Releases](https://github.com/akopdev/nbcat/releases)

---

Made with ❤️ by [Akop Kesheshyan](https://github.com/akopdev)
