Skip to main content

Generate API documentation with Quarto.

Project description

Overview

quartodoc lets you quickly generate Python package API reference documentation using Markdown and Quarto. quartodoc is designed as an alternative to Sphinx.

Check out the below screencast for a walkthrough of creating a documentation site, or read on for instructions.


Installation

python -m pip install quartodoc

or from GitHub

python -m pip install git+https://github.com/machow/quartodoc.git

Install Quarto

If you haven’t already, you’ll need to install Quarto before you can use quartodoc.

Basic use

Getting started with quartodoc takes two steps: configuring quartodoc, then generating documentation pages for your library.

You can configure quartodoc alongside the rest of your Quarto site in the _quarto.yml file you are already using for Quarto. To configure quartodoc, you need to add a quartodoc section to the top level your _quarto.yml file. Below is a minimal example of a configuration that documents the quartodoc package:

project:
  type: website

# tell quarto to read the generated sidebar
metadata-files:
  - _sidebar.yml


quartodoc:
  # the name used to import the package you want to create reference docs for
  package: quartodoc

  # write sidebar data to this file
  sidebar: _sidebar.yml

  sections:
    - title: Some functions
      desc: Functions to inspect docstrings.
      contents:
        # the functions being documented in the package.
        # you can refer to anything: class methods, modules, etc..
        - get_object
        - preview

Now that you have configured quartodoc, you can generate the reference API docs with the following command:

quartodoc build

This will create a reference/ directory with an index.qmd and documentation pages for listed functions, like get_object and preview.

Finally, preview your website with quarto:

quarto preview

Rebuilding site

You can preview your quartodoc site using the following commands:

First, watch for changes to the library you are documenting so that your docs will automatically re-generate:

quartodoc build --watch

Second, preview your site:

quarto preview

Looking up objects

Generating API reference docs for Python objects involves two pieces of configuration:

  1. the package name.
  2. a list of objects for content.

quartodoc can look up a wide variety of objects, including functions, modules, classes, attributes, and methods:

quartodoc:
  package: quartodoc
  sections:
    - title: Some section
      desc: ""
      contents:
        - get_object        # function: quartodoc.get_object
        - ast.preview       # submodule func: quartodoc.ast.preview
        - MdRenderer        # class: quartodoc.MdRenderer
        - MdRenderer.render # method: quartodoc.MDRenderer.render
        - renderers         # module: quartodoc.renderers

The functions listed in contents are assumed to be imported from the package.

Learning more

Go to the next page to learn how to configure quartodoc sites, or check out these handy pages:

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

quartodoc-0.6.2.tar.gz (756.1 kB view details)

Uploaded Source

Built Distribution

quartodoc-0.6.2-py3-none-any.whl (65.1 kB view details)

Uploaded Python 3

File details

Details for the file quartodoc-0.6.2.tar.gz.

File metadata

  • Download URL: quartodoc-0.6.2.tar.gz
  • Upload date:
  • Size: 756.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for quartodoc-0.6.2.tar.gz
Algorithm Hash digest
SHA256 f4c370c418d5f5eb9a3365f68f4030b5266e0144de363b8675579a107b3ce695
MD5 bf47ef619bd9b65f2f59777e1a943425
BLAKE2b-256 f29389ac7aa400f79b5ecbe47a579e8d78a4ba0b80ca0a5e31adcc60c1595a44

See more details on using hashes here.

File details

Details for the file quartodoc-0.6.2-py3-none-any.whl.

File metadata

  • Download URL: quartodoc-0.6.2-py3-none-any.whl
  • Upload date:
  • Size: 65.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for quartodoc-0.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 baa34dfc9f50c8673e7552ae84b4f7a46e4f0271a5834882d8716911f9377ce0
MD5 d895f26bbc2185a693f1c72e9887b52f
BLAKE2b-256 f1eb074c930eb7171a7129bb69533a4d814434f7cd29ebeb0a230bb0950d24e7

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