cli

Build, preview, README generation, watch-export, prepare, and CLI help commands for fastship.

Run ship-docs [path] to build a site, ship-preview [path] to rebuild and serve it locally, ship-readme to generate README.md or CONTRIBUTING.md, ship-prepare to export/test/clean in one pass, ship-watch to re-export changed notebook modules on save, or ship-help to list all commands.

ship_docs

def ship_docs(
    path:str='.', # Source directory or project root
    output:str=None, # Output directory relative to cwd; defaults to `ship.toml`/`[tool.fastship]` or `_docs`
    n_workers:int=4, # Parallel notebook preprocessing workers (0 or 1: serial)
    strict:bool=False, # Exit non-zero if any document links are unresolved
):

Build a documentation website or standalone site and report unresolved links.

preview_change

def preview_change(
    event, root, out
):

Return whether a filesystem event affects preview sources.

serve_preview

def serve_preview(
    root, # Directory to watch and run the build command in
    out, # Directory served over HTTP
    cmd, # Build command as an argv list
    port:int=8000, # HTTP port; 0 asks the OS for an available port
    host:str='localhost', # Bind address
    no_browser:bool=False, # Do not open a browser
):

Serve build output and rerun cmd when source files change.

ship_preview

def ship_preview(
    path:str='.', # Source directory or project root
    output:str=None, # Output directory relative to cwd; defaults to `ship.toml`/`[tool.fastship]` or `_docs`
    port:int=8000, # HTTP port; 0 chooses an available port
    host:str='localhost', # Bind address
    no_browser:bool=False, # Do not open a browser
):

Build and preview a documentation website or standalone site.

def doc_link(
    target:str, # Link target to rewrite
    base:str, # Hosted documentation base URL
    nbdir:str='.', # Directory of the source notebook relative to `ship_path`
)->str:

Convert a relative documentation link to its hosted URL.

ship_readme

def ship_readme(
    path:str=None, # Path to the project, its content directory, or a notebook
    chk_time:bool=False, # Only build if the source notebook is newer
    contributing:bool=False, # Render `CONTRIBUTING.md` instead of `README.md`
    force:bool=True, # Overwrite even if an existing target lacks the autogenerated marker (set `False` for `ship-export`)
):

Render README.md or CONTRIBUTING.md as GitHub Markdown using the site's notebook execution policy.

prepare

def prepare():

Export tracked artifacts, run ship-test, and clean notebooks.

fs_watchdog

def fs_watchdog(
    func, path, recursive:bool=True
):

File system watchdog dispatching events to func.

watch_export

def watch_export(
    ship_dir:str=None, # Notebook directory to watch for changes
    lib:str=None, # Export directory to write `.py` files to
    force:bool=False, # Override configured `ship_path` / `lib_path`
):

Watch notebooks in ship_dir and re-export the changed module on save.

chelp

def chelp():

Show help for all fastship console scripts.