Skip to content

Local Development and Environment Setup

Vicky Patel edited this page Nov 19, 2026 · 1 revision

Local Development & Environment Setup

Complete Installation Runbook for Windows, macOS, and Linux


πŸ’» System Prerequisites

Before setting up SafaiOS locally, ensure the following core tools are installed:

Tool Minimum Version Purpose
Git 2.38+ Source control management and branching
Python 3.11.x Core ML runtime, dataset pipelines, and regression tests
Docker Desktop 4.x+ (Linux engine) Local Supabase stack (Postgres 17, Storage, Auth, Studio)
Supabase CLI 2.x+ Local database migrations, pgTAP tests, and linter

🐧 1. Standard Setup (macOS / Linux)

Step 1: Clone the Repository

git clone https://github.com/TheVicky1/Safai_OS.git
cd Safai_OS

Step 2: Configure Python Virtual Environment

# Create dedicated virtual environment
python3.11 -m venv .venv
source .venv/bin/activate

# Upgrade pip and install package in editable development mode
pip install --upgrade pip
pip install -e ".[dev]"

Step 3: Verify the Python Test Suite

# Run all 151 unit and regression tests
pytest tests/ -v

Step 4: Configure Environment Variables

cp .env.example .env

πŸͺŸ 2. Windows 11 / 10 Setup Guide

Windows development requires special attention to execution policies and Docker Desktop WSL integration.

Step 1: PowerShell Execution Policy

If PowerShell blocks virtual environment activation scripts, run this one-time command in PowerShell:

Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned

Step 2: Virtual Environment & Python Dependencies

# In PowerShell:
git clone https://github.com/TheVicky1/Safai_OS.git
cd Safai_OS

python -m venv .venv
.\.venv\Scripts\Activate.ps1

pip install --upgrade pip
pip install -e ".[dev]"

# Run tests
pytest tests/ -v

Step 3: Docker Desktop & WSL 2 Setup

On Windows, Docker Desktop requires the WSL 2 backend (Virtual Machine Platform):

  1. Verify WSL status:
    wsl --status
  2. If WSL is not enabled, open an Elevated (Administrator) PowerShell and run:
    wsl --install --no-distribution
    dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
  3. Restart your computer.
  4. Launch Docker Desktop and verify that docker info returns server information.

πŸ—„οΈ 3. Starting the Local Supabase Stack

Once Docker is running, you can launch the complete local backend in seconds:

# 1. Start local Supabase containers (PostgreSQL 17, Storage, Auth, Studio)
supabase start

# 2. Apply all schema migrations and seeds to local Postgres
supabase db reset

# 3. Execute the 24-point pgTAP security and RLS test suite
supabase test db

# 4. Run database lint checks
supabase db lint --level error --fail-on error

Local Endpoint Dashboard


🧹 Quality Gate Verification

Before committing changes, execute the local quality gates:

# 1. Python ML & core unit test matrix
pytest tests/ -v

# 2. Database authorization tests (requires supabase start)
supabase test db

# 3. Database linting
supabase db lint --level error --fail-on error

Clone this wiki locally