Documentation sites
llms.txt refresh for fastship projects.
ship_docs and ship_preview build Quarto documentation websites (HTML, .html.md, and llms.txt) from README.md, optional docs/*.md guides, public package modules, and pkg/skill.py without running Jupyter. In [tool.nbdev] projects, both delegate to nbdev-docs and nbdev-preview.
ship-docs
ship-docs --out _site
ship-preview --port 4200
ship-llmsPublic .py modules (excluding skill.py, guidance.py, _*.py, and modules already covered by a hand-written page under docs/) become API pages under docs/api/ automatically in source definition order. Add # - order: 1 or # - title: My Title comment lines right after a module docstring to control page ordering and titles, and use top-level string literals for Markdown sections. Embed individual symbols or whole modules in hand-written docs/*.md files with {{< doc sym >}} shortcodes (set module: mypkg.core in YAML frontmatter to omit the module prefix). Run ship-pages (in fastship.release) once to add .github/workflows/docs.yml, set [project.urls].Documentation, and enable GitHub Pages workflow builds. Commands raise CliError when quarto or nbdev is missing or a render fails, and FileNotFoundError when no pyproject.toml is found.
ship_docs
def ship_docs(
path:str=None, # Project directory (defaults to nearest `pyproject.toml` or current directory)
out:str='_docs', # Output directory for rendered site (relative to project root unless absolute)
)->None:Build a Quarto documentation website with HTML, .html.md pages, and llms.txt.
Stages README.md as index.md, syncs and expands {{< doc ... >}} shortcodes in docs/, generates API pages under docs/api/ for uncovered public modules, renders llms.txt when pkg/skill.py exists, and runs quarto render into out (replacing any existing directory). Delegates [tool.nbdev] projects to nbdev-docs (out is ignored in favor of nbdev’s configured doc_path).
ship-docs
ship-docs --out _siteship_preview
def ship_preview(
path:str=None, # Project directory (defaults to nearest `pyproject.toml` or current directory)
port:int=None, # Port to serve preview on
host:str=None, # Host interface to bind preview server to
no_browser:bool=False, # Do not open a browser automatically
)->None:Serve a live Quarto preview and re-stage automatically when files change.
Stages the project into a temporary directory, starts quarto preview, and polls README.md, pyproject.toml, llms.txt, docs/, and package .py files every 0.5 seconds. When .py files change, cached package modules are cleared so edited docstrings and docments reload live. Delegates [tool.nbdev] projects to nbdev-preview.
ship-preview
ship-preview --port 4200 --no-browsership_llms
def ship_llms(
path:str=None, # Project directory (defaults to nearest `pyproject.toml`)
base_url:str=None, # Fallback base URL when `skill.py` omits `__base_url__`
)->None:Generate or refresh repo-root llms.txt from pkg/skill.py for non-nbdev projects.
CLI wrapper around refresh_llms. Skips [tool.nbdev] projects (where nbdev-export owns nbs/llms.txt) and never overwrites a hand-written llms.txt lacking a generator comment.
ship-llms
ship-llms --base-url https://example.com/docs/refresh_llms
def refresh_llms(
root:pathlib._local.Path, # Project root directory containing `pyproject.toml`
data:dict, # Parsed `pyproject.toml` mapping
base_url:str=None, # Override published docs base URL (defaults to `docs_base_url` when a docs workflow exists)
)->list[pathlib._local.Path]: # Paths written or removed (empty when unchanged or skipped)Generate or refresh repo-root llms.txt, llms-*.txt companions, and pkg/_modidx.py.
Returns [] for [tool.nbdev] projects. When .github/workflows/docs.yml (or docs.yaml) exists, links llms.txt to published docs/ and docs/api/ .html.md pages, syncs non-module doc links into pkg/_modidx.py (docs = ...), and writes the public symbol index d = ... in pkg/_modidx.py. Preserves hand-written llms.txt files lacking a generator comment.
docs_base_url
def docs_base_url(
root:pathlib._local.Path, # Project root directory (used for git remote fallback)
data:dict, # Parsed `pyproject.toml` mapping
)->str: # Published docs base URL ending with `/`, or `""` when unresolvedReturn the published docs base URL ending with /, or "" when unknown.
Reads [project.urls].Documentation first (case-insensitive). Otherwise extracts an owner/repo slug from [project.urls] (Repository, Source, Homepage) or the local git origin remote and returns https://{owner}.github.io/{repo}/.