Skip to content

launch

Main entry point for starting Drafter servers.

Provides the start_server() function which routes to either in-browser ClientServer or local development AppServer based on execution context.

MaybeBoolStr = bool | str | None module-attribute

Type alias for parameters that accept a bool, a string, or None.

start_server(initial_state=None, server=None, server_name=None, in_debug_mode=None, framed=None, theme=None, site_title=None, favicon=None, information=None, verbose=None, asset_directory=None, show_filename_as=None, engine=None, port=None, host=None, prerender_initial_page=None, open_browser=None, browser=None, inline_py=None, use_reloader=None, pyodide_url=None, pyodide_version=None, pyodide_branch=None, reloader=None, cdn_skulpt=None, cdn_skulpt_std=None, cdn_skulpt_drafter=None, skip=None, argv=None, **extra_configuration)

Start the Drafter server (web or local development mode).

Routes to either ClientServer (web mode) or AppServer (local dev mode) based on execution context. In web mode, initializes browser-side bridge; in local mode, starts Starlette dev server with file watching.

This function is the primary entry point for users and accepts parameters for both ClientServer and AppServer modes (the appropriate ones are used depending on context).

Parameters:

Name Type Description Default
initial_state

Optional initial application state.

None
server

Optional pre-created server instance (defaults to main server).

None
server_name str | None

Server identifier name.

None
in_debug_mode bool | None

Enable debug panel and logging.

None
framed bool | None

Whether to frame the content.

None
theme str | None

Theme name (e.g., "default").

None
site_title str | None

Title displayed in UI.

None
favicon str | None

Browser tab icon: a URL or the path to an adjacent image file (svg, png, ico, ...).

None
information dict | None

Dict of site information (author, description, etc.).

None
verbose bool | None

Enable verbose logging.

None
asset_directory MaybeBoolStr

Assets directory (uses Drafter defaults if False).

None
show_filename_as MaybeBoolStr

Display filename in UI (if different from actual).

None
engine EngineType | None

Python engine ("skulpt" or "pyodide").

None
port int | None

Server port for dev mode.

None
host str | None

Server host for dev mode.

None
prerender_initial_page bool | None

Prerender initial page on startup.

None
open_browser bool | None

Auto-open browser in dev mode.

None
browser str | None

Which browser to open in dev mode: "chrome", "firefox", "safari", "edge", or "default" for the system default. When not given, Chrome is used if installed, then Firefox, then the system default.

None
inline_py bool | None

Inline code in HTML vs. load via HTTP.

None
use_reloader bool | None

Enable file watcher and auto-reload.

None
pyodide_url str | None

Base URL to load Pyodide from (default: jsDelivr CDN).

None
pyodide_version str | None

Pyodide version segment, e.g. "v314.0.5" or "dev".

None
pyodide_branch str | None

Pyodide distribution branch, "full" or "debug".

None
reloader bool | None

Deprecated alias for use_reloader, kept for compatibility with older versions; used only when use_reloader is not given.

None
cdn_skulpt str | None

Deprecated and ignored; passing a value prints a warning.

None
cdn_skulpt_std str | None

Deprecated and ignored; passing a value prints a warning.

None
cdn_skulpt_drafter str | None

Deprecated and ignored; passing a value prints a warning.

None
skip bool | None

If True, do nothing at all — do not start the server or compile anything. Useful for running unit tests against a site file. Also settable via the DRAFTER_SKIP environment variable, the --skip flag, or a config file.

None
argv list[str] | None

Command-line argument override passed into the system configuration.

None
**extra_configuration

Additional configuration parameters.

{}

Raises:

Type Description
SystemExit

In local development mode, when the server cannot start for a reason that has a student-facing explanation (the main file is missing, the port is in use). The explanation is printed instead of a traceback; with the verbose setting on, the original StudentFacingError propagates instead.