build_tools.syllable_walk_web.server
HTTP server for the Pipe-Works Build Tools web application.
Serves static frontend assets and provides a JSON API for pipeline and walker operations. Uses Python stdlib only (no frameworks).
Attributes
Classes
HTTP request handler for the Corpus Builder web app. |
Functions
|
Find an available port starting from start. |
|
Return |
|
Select an auto port by preferring the 8000-range first. |
|
Start the HTTP server. |
Module Contents
- build_tools.syllable_walk_web.server.STATIC_DIR
- build_tools.syllable_walk_web.server.AUTO_PORT_PRIMARY_START = 8000
- build_tools.syllable_walk_web.server.AUTO_PORT_PRIMARY_TRIES = 100
- build_tools.syllable_walk_web.server.AUTO_PORT_FALLBACK_START = 8100
- build_tools.syllable_walk_web.server.AUTO_PORT_FALLBACK_TRIES = 900
- class build_tools.syllable_walk_web.server.CorpusBuilderHandler(request, client_address, server)[source]
Bases:
http.server.BaseHTTPRequestHandlerHTTP request handler for the Corpus Builder web app.
Serves static files from the
static/directory and routes/api/*requests to the appropriate handlers.- server_version = 'PipeWorksCorpusBuilder/0.1'
- build_tools.syllable_walk_web.server.find_available_port(start=8000, max_tries=100)[source]
Find an available port starting from start.
Tries ports
startthroughstart + max_tries - 1. Returns the first available port, orNoneif none found.
- build_tools.syllable_walk_web.server.is_port_available(port)[source]
Return
Truewhen a specific TCP port can be bound.
- build_tools.syllable_walk_web.server.select_auto_port(*, find_port=find_available_port)[source]
Select an auto port by preferring the 8000-range first.
Checks 8000-8099 first, then falls back to 8100-8999.
- build_tools.syllable_walk_web.server.run_server(port=None, verbose=True, output_base=None, sessions_dir=None, corpus_dir_a=None, corpus_dir_b=None)[source]
Start the HTTP server.
- Parameters:
port (int | None) – Port to listen on. If
None, checks 8000-8099 first, then 8100-8999.verbose (bool) – If
True, log HTTP requests to stderr.output_base (pathlib.Path | None) – Base path for pipeline run discovery. Defaults to
_working/output.sessions_dir (pathlib.Path | None) – Optional explicit directory for saved walker sessions. Defaults to
None(callers deriveoutput_base/sessions).corpus_dir_a (str | None) – Run discovery directory for Patch A.
corpus_dir_b (str | None) – Run discovery directory for Patch B.
- Returns:
0 for clean shutdown, 1 for error.
- Return type:
Exit code