Skip to content

Sage server

Run the veriphy daemon: sage -python -m veriphy.sage_server or the veriphy-sage-server script.

main()

Answer one JSON request per stdin line with one JSON response per stdout line, until stdin closes.

Source code in src/veriphy/sage_server/_main.py
14
15
16
17
18
19
20
21
22
23
24
25
26
27
def main() -> None:
    """Answer one JSON request per stdin line with one JSON response per stdout line, until stdin closes."""
    try:
        oracle = importlib.import_module('veriphy.oracle')
    except ModuleNotFoundError as exc:
        if not (exc.name or '').startswith('sage'):
            raise
        sys.stderr.write(NOT_UNDER_SAGE)
        raise SystemExit(SAGE_UNAVAILABLE) from exc
    for line in sys.stdin:
        stripped = line.strip()
        if stripped:
            sys.stdout.write(json.dumps(oracle.answer_request(stripped)) + '\n')
            sys.stdout.flush()