Skip to main content

Key Terms

  • Cell: An executing module or Markdown container in a Jupyter Notebook.
  • Directive: A pipe-delineated (|) comment block recognized by Quarto and nbquarto.
  • Processor: A class that tailors a cell based on its directives.

Introducing nbquarto: Your Python-Powered Notebook Enhancer

Harness the might of Python with nbquarto, a dynamic interface to externally transform Jupyter Notebook cells, designed ideally for Quarto projects. This framework streamlines your documentation process by enabling rapid creation and implementation of post-processors for Jupyter Notebooks. Although Quarto-focused, nbquarto serves as a valuable asset for any Python project leveraging Jupyter Notebooks.

Getting Started

Check out the installation directions here to get started!

Choose nbquarto for a Superior Experience

Drawing inspiration from nbdev, nbquarto steers towards a more comprehensible and less abstracted interface. It focuses on modifications to Jupyter Notebooks as to fully capitalize on Quarto's abundant features, minimizing dependencies, and enhancing code readability.

No More Learning Curve with nbquarto

Why learn a new language (Lua) to modify content already in Python? nbquarto emerges as the Pythonic alternative to Quarto Extensions. Offering flexibility and simplicity at the cost of a negligible increase in processing time, nbquarto empowers you to control the narrative.

How Does nbquarto Work?

At the heart of nbquarto is a Processor. This component modifies a cell to fine-tune code formatting or swiftly craft complex Quarto syntax combinations. Each cell object encompasses two crucial elements: directives_ (a list of cell directives) and source (modifiable cell text).

See how easy it is to add a comment to the top of a cell's text source:

>>> from nbquarto import Processor

>>> class BasicProcessor(Processor):
...    "A basic processor that adds a comment to the top of a cell's text source."
...
...    directives = "process"
...
...    def process(self, cell):
...        if any(directive in cell.directives_ for directive in self.directives):
...            cell.source = f"# This code has been processed!\n{cell.source}"

And in a notebook cell:

# Input
>>> #| process
... print("Hello, world!")

# Output
>>> # This code has been processed!
... print("Hello, world!")

Simplified Configuration

Say goodbye to confusion with nbquarto's configuration file. This handy feature organizes processor use, notebook paths, and processor constants for a seamless user experience.

documentation_source: tests
processors: [
    nbquarto.processors.example:BasicProcessor,
    nbquarto.processors.autodoc:AutoDocProcessor
]

processor_args:
  AutoDocProcessor: 
      repo_owner: muellerzr
      repo_name: nbquarto

Efficient Notebook Processing

Execute the nbquarto-process command to let the configured Processor(s) work their magic on your notebooks. All processed notebooks, saved as qmd files, land safely in your desired output folder:

nbquarto-process \
--config_file tests/test_artifacts/single_processor.yaml \
--notebook_file tests/test_artifacts/test_example.ipynb \
--output_folder docs/

nbdev Reinvented: Experience nbquarto

Transform your understanding of nbdev with nbquarto, a user-friendly reimagining of the original project. Bask in the simplicity of an unambiguous interface for modifying Jupyter Notebooks, enjoy the luxury of minimal abstraction, relish clear error messages, and appreciate the adherence to excellent Python coding practices.

Metadata

Release files for nbquarto 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nbquarto 0.0.1
File Size Uploaded
nbquarto-0.0.1.tar.gz 23.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nbquarto 0.0.1
File Interpreter ABI Platform
nbquarto-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 51.6 kB

Release files / nbquarto-0.0.1.tar.gz

Download URL nbquarto-0.0.1.tar.gz
Size 23.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a647b0fa4d19340bbeaa2fc2e94dea371632c3c27810b6dddae87a9be1c5618b
BLAKE2b-256 checksum
How to use checksums
741495931383e4eaf628c35d9e7f4315b7187c046afa94ad2ebda7426b7c7161
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / nbquarto-0.0.1-py3-none-any.whl

Download URL nbquarto-0.0.1-py3-none-any.whl
Size 28.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d66d0f444f9a4585dc9091cb5a5fc1bc60f7a417c96ae44f46a14d8cdfc5117e
BLAKE2b-256 checksum
How to use checksums
6a8eb06ac5aec19287a0d6e6a927207faddbd26365dc4925d84b0cf8e2544eb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page