API Reference

A Python API for installing and managing the SyftBox daemon — perfect for notebooks and automation

Installation Methods

si.run()

Install SyftBox (if needed) and start it. This is the primary method for most users. It will install SyftBox if not already installed, then start the daemon.

Parameters
No parameters - uses interactive prompts
Returns
None Starts SyftBox daemon in the background
Example
import syft_installer as si

# Install and run SyftBox
si.run()
si.install()

Install SyftBox without starting it. Useful for deployment scenarios where you want to install first and start later.

Parameters
No parameters - uses interactive prompts
Returns
None Completes installation without starting the daemon
Example
# Just install, don't start
si.install()

# Start later when ready
si.run_if_stopped()
si.install_and_run_if_needed()

Explicit method to install (if needed) and run (if needed) SyftBox. Only installs if not already installed and only starts if not already running about the two-step process.

Parameters
No parameters - uses interactive prompts
Returns
None Completes installation and starts the daemon
si.uninstall()

Completely remove SyftBox from the system. This will stop the daemon, remove the binary, configuration files, and optionally the data directory.

Parameters
No parameters - prompts for confirmation
Returns
None Removes all SyftBox components
Example
# Completely uninstall SyftBox
si.uninstall()
# Will prompt: "Are you sure? [y/N]"

Control Methods

si.run_if_stopped()

Start SyftBox only if it's not already running. Useful for scripts that need to ensure SyftBox is running without accidentally starting multiple instances.

Parameters
No parameters
Returns
None Starts daemon if not running, otherwise no-op
Example
# Ensure SyftBox is running
si.run_if_stopped()

# Safe to call multiple times
for i in range(3):
    si.run_if_stopped()  # Only starts once
si.stop()

Stop the SyftBox daemon if it's running. This gracefully shuts down the background process.

Parameters
No parameters
Returns
None Stops the daemon process
Example
# Stop SyftBox
si.stop()

# Check if it stopped
if not si.is_running():
    print("SyftBox stopped successfully")

Status Methods

si.status()

Display the current status of SyftBox including installation state, running status, configuration details, and data directory information.

Parameters
No parameters
Returns
None Prints status information to console
Example
# Check SyftBox status
si.status()
# Output:
# ✅ SyftBox Status:
# Installation: ✅ Installed
# Status: ✅ Running (PID: 12345)
# Email: user@example.com
# Data Dir: /Users/user/SyftBox
# Server: https://syftbox.openmined.org
si.is_installed()

Check if SyftBox is installed on the system. Returns True if all necessary components (binary, configuration) are present.

Parameters
No parameters
Returns
bool True if SyftBox is installed, False otherwise
Example
if si.is_installed():
    print("SyftBox is ready to use")
else:
    print("Need to install SyftBox first")
    si.install()
si.is_running()

Check if the SyftBox daemon is currently running in the background.

Parameters
No parameters
Returns
bool True if SyftBox daemon is running, False otherwise
Example
if si.is_running():
    print("SyftBox is active")
else:
    print("SyftBox is stopped")
    si.run_if_stopped()