Overview
The login functions provide the primary interface for authenticating users and creatingSyftboxManager instances in different environments. All functions support both Data Owner (DO) and Data Scientist (DS) modes.
login()
Wrapper function that delegates tologin_ds() for backwards compatibility.
User email address. For Colab environments, automatically retrieved if not provided.
Whether to sync with Google Drive after login.
Whether to load peer list after login.
Path to Google Drive token file. Required for Jupyter environments.
Configured SyftboxManager instance for interacting with the Syftbox ecosystem.
login_ds()
Login as a Data Scientist to access shared datasets and submit jobs.Parameters
User email address. Required for Jupyter, auto-detected in Colab.
Whether to perform initial sync with Google Drive after login.
Whether to load the peer list after login.
Path to Google Drive OAuth token file. Required for Jupyter environments. Can also be set via
settings.token_path configuration.Returns
Configured SyftboxManager instance in Data Scientist mode with:
- Access to shared datasets via
client.datasets - Ability to submit jobs via
client.submit_bash_job()andclient.submit_python_job() - Peer management via
client.peers
Behavior
Environment Detection:- Automatically detects Colab or Jupyter environment
- In Colab: Uses
/content/SyftBox_{email}as default folder - In Jupyter: Uses
~/SyftBox_{email}as default folder
- Creates
SyftboxManagerwithonly_ds=Trueflag - Optionally syncs to download latest files
- Optionally loads peer connections
- Prints connection status
Raises
ValueError: If email is required but not providedNotImplementedError: If Jupyter login attempted without token_pathValueError: If environment is not supported (not Colab or Jupyter)
Example
login_do()
Login as a Data Owner to manage datasets, approve jobs, and control access.Parameters
User email address. Required for Jupyter, auto-detected in Colab.
Whether to perform initial sync with Google Drive after login.
Whether to load peer list and requests after login.
Path to Google Drive OAuth token file. Required for Jupyter environments.
Returns
Configured SyftboxManager instance in Data Owner mode with:
- Dataset creation and management via
client.create_dataset(),client.delete_dataset() - Job approval and execution via
client.process_approved_jobs() - Peer request management via
client.approve_peer_request(),client.reject_peer_request() - Checkpoint creation for efficient syncing via
client.create_checkpoint()
Behavior
Environment Detection:- Automatically detects Colab or Jupyter environment
- In Colab: Uses
/content/SyftBox_{email}as default folder - In Jupyter: Uses
~/SyftBox_{email}as default folder
- Creates
SyftboxManagerwithonly_datasite_owner=Trueflag - Optionally syncs to process pending requests and events
- Optionally loads peer list including pending requests
- Prints connection status
Raises
ValueError: If email is required but not providedNotImplementedError: If Jupyter login attempted without token_pathValueError: If environment is not supported (not Colab or Jupyter)
Example
Environment Configuration
Colab
- Email auto-detected from Google account
- SyftBox folder:
/content/SyftBox_{email} - OAuth tokens managed automatically
- No token_path required
Jupyter
- Email must be provided
- SyftBox folder:
~/SyftBox_{email} - Requires token_path to OAuth credentials
- Token can be set via:
- Function parameter:
token_path="/path/to/token.json" - Config setting:
settings.token_path = "/path/to/token.json"
- Function parameter:
See Also
- SyftboxManager - Core client class returned by login functions
- Sync Operations - Understanding sync behavior and connection management