Docs Website

How fastship renders a documentation website or blog for your project.

Concepts

Source Files

You can mix five source formats freely in ship/ (or another directory set explicitly via ship-path in ship.toml / [tool.fastship]):

  1. Jupyter Notebooks (.ipynb)
  2. Plain Python modules (.py) with module docstrings and optional # - title: / # - order: frontmatter
  3. Markdown (.md) — static Markdown whose {python} blocks test under ship-test without executing at build time
  4. Executable Markdown (.qmd) — executes {python} blocks at build time via execnb.minipy
  5. RenderScripts (*.md.py, *.qmd.py, *.svg.py)

For notebooks, fastship pre-processes directives and frontmatter in memory (via fastship.processors and fastship.process.NBProcessor), runs only the cells needed for live API docs (using execnb.minipy, with no Jupyter server required), and converts directly to Markdown and HTML through mdhtml.

Built-in Static Site Builder

fastship compiles every page directly into HTML and GitHub-flavored Markdown (.md), builds a Pagefind search index, resolves cross-page links and symbol doclinks, and emits sitemap.xml, robots.txt, RSS feeds, and llms.txt — all in pure Python with no Quarto installation required. Built output is written to _docs/ by default (configurable via output in ship.toml or [tool.fastship]).

Overview

Below is a diagram of how the pipeline fits together.

Customizing Your Site

Configure site options in ship.toml (at the repository or site root) or under [tool.fastship] in pyproject.toml:

title = "myproj"
site-url = "https://myproj.fast.ai"
theme = "system"
open-graph = true
twitter-card = true
toc = true
toc-depth = 4
css = "styles.css"
nav-links = [
  { text = "Get Started", href = "getting_started.html" },
  { text = "Tutorials", href = "tutorials/index.html" },
]
tools = [
  { icon = "github", href = "https://github.com/AnswerDotAI/myproj", label = "GitHub" },
]

Customizing Navigation and Sidebar

By default fastship derives one shared reading order from your source tree — using explicit order: / # - order: metadata first, numeric filename prefixes (00_, 00a_) second, and alphabetical order last. Subfolders nest recursively into sections, and a directory's index.md sets its section title, order, and inheritable frontmatter defaults (an empty body creates a metadata-only section with no landing page). Module-to-page ownership comes from # AUTOGENERATED! headers or explicit module: frontmatter.

To specify an explicit order, set sidebar-links once against your source paths; fastship derives the website sidebar, llms.txt, and the installed _modidx.docs catalog (used by doc(pkg) and doc(pkg.skill)) from that same order, with optional llms-exclude and llms-extra overrides.

Styling

Add custom stylesheets with css = "styles.css" and override the built-in --oct-* CSS custom properties for colours, fonts, and layout.

How show_doc works

When your documention website is built, all functions and classes you export to source code will be automatically documented with show_doc. This function outputs a summary of the symbol, showing its signature, docstring, and parameters. For instance, if you have this function:

def say_gday(
    greeting:str="G'day",  # Greeting to use
    strine:bool=True,      # Use incomprehensible Aussie accent?
    dropbears:bool=False): # Also warn about drop-bears?
    "Says g'day, the classic Aussie greeting"
    ...

This is how it's rendered in the documentation, by automatically generating a temporary cell containing:

show_doc(say_gday)

say_gday

def say_gday(
    greeting:str="G'day", # Greeting to use
    strine:bool=True, # Use incomprehensible Aussie accent?
    dropbears:bool=False, # Also warn about drop-bears?
):

Says g'day, the classic Aussie greeting

Because this is done automatically any time you build your docs (including automatically by continuous integration), your documentation will always contain current information about your code.

You can also document code that's not created in a notebook, by using show_doc with imported code. For instance, if we wanted to document ship_release, we can import it and call show_doc(release_conda):

from fastship.release import ship_release
show_doc(ship_release)

ship_release

async def ship_release(
    token:str=None, # GitHub token (else `$FASTSHIP_TOKEN`, `./token`, or `$GITHUB_TOKEN`)
    repo:str=None, # Override repo (`"OWNER/REPO"`)
    no_changelog:bool=False, # Skip changelog generation (local release flow only)
    no_editor:bool=False, # Skip opening `CHANGELOG.md` in `$EDITOR` (local release flow only)
    yes:bool=False, # Skip confirmation prompt (local release flow; tag flows never prompt)
    wheel_only:bool=False, # Build only a wheel without an sdist (local release flow)
    verbose:bool=False, # Pass `--verbose` to `uv publish`
):

Run the release workflow for the current project, then bump and push the version.

  • Local Python packages (including notebook-authored packages): updates CHANGELOG.md, refreshes tracked exports, builds with uv build --clear, commits and pushes, creates the GitHub release, publishes via uv publish, and commits a [skip ci] version bump.
  • Package-less projects (gh_only): creates a GitHub release with auto-generated notes and bumps the static version.
  • Tag-published projects (Rust/maturin, Zig, npm, pure-Rust crates, or release = "tag"): verifies a clean git tree and version-files, refreshes tracked exports when applicable, pushes an annotated v<version> tag for CI, and commits a [skip ci] version bump.

Automatic Cell Execution

When your documentation is built, all your manually added show_doc cells are run automatically. fastship also executes all cells containing an import statement, and all exported cells – that way we can be sure that the symbol used in your show_doc cell is available.

We don't, however, execute any other cells. That's because you wouldn't want to wait for your entire notebook to run just to build your docs; for instance, your docs might demonstrate training a model which takes hours to complete!

This leads to an important rule when authoring fastship notebooks:

Warning

Do not mix import statements (or calls to show_doc) with other code in a single cell. If you do, all the code in that cell will be executed every time you build your docs, which might lead to errors (since not all previous cells will have been executed.

Instead, put your imports in separate cells, and calls to show_doc should contain only that one line of code – the show_doc call.

Note that fastship automatically hides the actual show_doc(...) line of code. So your users only see the output.

Executing Every Cell

To execute all cells in a notebook when rendering docs (such as live demos), add exec_all: true to the notebook frontmatter:

---
exec_all: true
---

To enable this for every notebook in a project, set exec-all = true in ship.toml or [tool.fastship] in pyproject.toml. Cells that ship-test skips via eval: false or a tst-flags flag are skipped here as well.

Skipping Execution

Likewise, you can instruct fastship to not execute any cells when rendering your docs with the following front matter:

---
skip_showdoc: true
---

Or ignore execution for a specific cell with this directive:

#| eval: false

Why use show_doc?

Many Python developers use sphinx autodoc to automatically document a whole module all at once. Whilst this can work reasonably well, we think there are huge benefits for both developers and users in using nbdev's approach instead

The premise of nbdev's approach is that your documentation is important enough to be worth you taking the time to think carefully though each thing you want to show your users, what examples you're going to provide, maybe adding some images to explain more complex ideas, and so forth. Jupyter provides a terrific environment for creating just these kinds of documents. For instance, with Jupyter you can:

With show_doc, you can insert automatically-updated API details for your library anywhere in a page. That means that you get to decide exactly how your page should look, and what information is provided where. You don't have to limit yourself to the limits of ASCII art for diagrams, and can include full end-to-end code walk-through of the processes your users will be following.

Previewing Your Site Locally

You can preview your docs anytime by running ship-preview. While in preview mode, you can make updates to notebooks and it will be reflected (after a small delay) in your browser.

Deploying Docs With GitHub Actions

If your fastship project lives on GitHub, ship-new and ship-pages write .github/workflows/docs.yml to build and deploy your documentation site to GitHub Pages automatically whenever you push to main.

That workflow runs AnswerDotAI/workflows/ship-docs, which installs fastship, builds the static site via ship-docs, uploads the artifact, and deploys it with GitHub's native Pages actions.

Should anything go wrong in your page build, you can inspect the logs under the Actions tab of your repository.

To read more about GitHub Actions, see their docs.

Deploying Your Docs On Other Platforms

You can generate all of the static assets for your site (HTML, Markdown .md copies, CSS, JS, Pagefind search index, sitemap, and RSS feeds) by running ship-docs. The built site is written to _docs/ by default (configurable via output in ship.toml or [tool.fastship]) and can be hosted on any static host (GitHub Pages, Cloudflare Pages, Netlify, Vercel, or S3).