Skip to main content

A minimal nbdev version, focused on writing quarto extensions

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nbquarto-0.0.1.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

nbquarto-0.0.1-py3-none-any.whl (28.3 kB view details)

Uploaded Python 3

File details

Details for the file nbquarto-0.0.1.tar.gz.

File metadata

  • Download URL: nbquarto-0.0.1.tar.gz
  • Upload date:
  • Size: 23.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for nbquarto-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a647b0fa4d19340bbeaa2fc2e94dea371632c3c27810b6dddae87a9be1c5618b
MD5 285198df79fa28ee3070ca0c375f7e6c
BLAKE2b-256 741495931383e4eaf628c35d9e7f4315b7187c046afa94ad2ebda7426b7c7161

See more details on using hashes here.

File details

Details for the file nbquarto-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: nbquarto-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 28.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for nbquarto-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d66d0f444f9a4585dc9091cb5a5fc1bc60f7a417c96ae44f46a14d8cdfc5117e
MD5 096c5620501a2d20feec720522d13011
BLAKE2b-256 6a8eb06ac5aec19287a0d6e6a927207faddbd26365dc4925d84b0cf8e2544eb7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page