GitXplorerGitXplorer
p

nbpreview

public
174 stars
7 forks
40 issues

Commits

List of commits on branch main.
Verified
d1ea663b84de07fe780cd698960001d80b74d09b

Merge pull request #733 from paw-lu/dependabot/pip/pyzmq-24.0.1

ppaw-lu committed 2 years ago
Verified
6f4376e26a889cc927116364c0b6a7335cdf6d57

:arrow_up: Bump pyzmq from 23.2.1 to 24.0.1

ddependabot[bot] committed 2 years ago
Verified
f902f0d662bd297b394ba4a7b077f0f6bb27e2ad

Merge pull request #731 from paw-lu/dependabot/pip/numpy-1.23.3

ppaw-lu committed 2 years ago
Verified
9894cf766735c04671a799323dce62fcd3a80832

:arrow_up: Bump numpy from 1.23.1 to 1.23.3

ddependabot[bot] committed 2 years ago
Verified
ffb714bdd3119a3cd925ba076119d00f4d33a357

Merge pull request #727 from paw-lu/dependabot/pip/asttokens-2.0.8

ppaw-lu committed 2 years ago
Verified
ec46f2fe3ee03d127fb608f2515fb73659a5b58e

:arrow_up: Bump asttokens from 2.0.5 to 2.0.8

ddependabot[bot] committed 2 years ago

README

The README file for this repository.

nbpreview light logo nbpreview dark logo

nbpreview

Checked with mypy PyPI Status Python Version License Read the documentation at https://nbpreview.readthedocs.io/ Tests Codecov pre-commit Black Imports: isort security: bandit

A terminal viewer for Jupyter notebooks. It's like cat for ipynb files.

Hero image

Documentation

nbpreview's documentation contains a detailed breakdown of its features, command-line usage, and instructions on how to configure the tool.

Requirements

  • Python 3.8+

Installation

nbpreview can be installed through pipx or pip from PyPI.

pipx provides an easy way to install Python applications in isolated environments. See the documentation for how to install pipx.

% pipx install nbpreview

If pipx is not installed, nbpreview may also be installed via pip:

% python -m pip install nbpreview

Features

Material theme syntax highlighting

Markdown render

Block drawing of image

DataFrame render

DataFrame render

LaTeX render

HTML render

Hyperlink renders

Stderr render

Traceback render

Try it out

Assuming curl and pipx are installed, nbpreview may be tried out on the terminal by running:

% curl https://raw.githubusercontent.com/paw-lu/nbpreview/main/docs/example_notebook_cells/hero_notebook.ipynb | pipx run nbpreview

Usage

To use nbpreview, type nbpreview into your terminal followed by the path of the notebook you wish to view.

% nbpreview notebook.ipynb

See the command-line reference for details on options.

Contributing

Contributions are very welcome. To learn more, see the contributor guide.

License

Distributed under the terms of the MIT license, nbpreview is free and open source software.

Issues

If you encounter any problems, please file an issue along with a detailed description.

Prior art

Similar tools

Thanks to @joouha for maintaining a list of these tools. Many of the projects here were found directly on their page.

Complimentary tools

If you're interested in complimentary tools that help improve the terminal experience for notebooks, there are many amazing projects out there.

  • bat is not a tool for notebooks specifically. But similar to nbpreview, it provides a rich output for many types of files on the terminal, and is the primary inspiration for nbpreview.
  • euporie is a really exciting project that allows you to edit and run Jupyter notebooks on the terminal.
  • nbclient is a library for executing notebooks from the command line.
  • nbpreview is another project that coincidentally shares a name with this one. It allows for Jupyter notebooks to be rendered without running a notebook server.
  • nbqa allows the use of linters and formatters on notebooks. It's also used by this project.
  • jpterm is and up-and-coming successor to nbterm which will be accompanied by a web client. Looking forward to seeing this develop.
  • nbtermix is an actively-developed fork of nbterm.
  • nbterm lets you edit and execute Jupyter Notebooks on the terminal.
  • papermill allows the parameterization and execution of Jupyter Notebooks.

Credits

nbpreview relies on a lot of fantastic projects. Check out the dependencies for a complete list of libraries that are leveraged.

Besides the direct dependencies, there are some other projects that directly enabled the development of nbpreview.

  • bat is not explicitly used in this project, but served as the primary inspiration. This projects strives to be bat—but for notebooks. Many of nbpreview's features and command-line options are directly adopted from bat.
  • Hypermodern Python Cookiecutter is the template this project was generated on. It is a fantastic project that integrates Poetry, Nox, and pre-commit. It's responsible for most of this project's CI.
  • justcharts is directly used by this project to generate the Vega and Vega-Lite charts.