INNER CODE UNIT · Python
LocalServer
mostly-ai/mostlyai · mostlyai/sdk/_local/server.py:30
class LocalServer:
"""
Instantiate a local server for the Synthetic Data SDK.
Args:
home_dir: The directory where the SDK stores its data. Defaults to `~/mostlyai`.
port: The port to bind the server to. If `None`, a Unix Domain Socket (UDS) will be used. Defaults to `None` on Unix and `8080` on Windows.
"""
def __init__(
self,
home_dir: str | Path | None = None,
port: int | None = None,
):
self.home_dir = Path(home_dir or "~/mostlyai").expanduser()
self.home_dir.mkdir(parents=True, exist_ok=True)
# check read/write access to `home_dir`
if not os.access(self.home_dir, os.R_OK) or not os.access(self.home_dir, os.W_OK):