Local Setup
This guide covers setting up DeepFix for local development and testing.
Overview
Local setup is recommended for development, testing, and experimentation. This guide provides step-by-step instructions for setting up DeepFix on your local machine.
Prerequisites
- Python 3.11 or higher
uvpackage manager (recommended) orpip- Git
- (Optional) MLflow tracking server
- (Optional) Docker for MLflow server
Quick Start
Step 1: Clone Repository
Step 2: Create Virtual Environment
Using uv (recommended):
uv venv --python 3.11
source .venv/bin/activate # On macOS/Linux
# or
.venv\Scripts\activate # On Windows
Using venv:
python3.11 -m venv venv
source venv/bin/activate # On macOS/Linux
# or
venv\Scripts\activate # On Windows
Step 3: Install DeepFix
This installs:
- deepfix-core: Core models and types
- deepfix-sdk: Client SDK
- deepfix-server: Analysis server
Step 4: Install Development Dependencies (Optional)
# Install with dev dependencies
uv pip install -e ".[dev]"
# Or install manually
uv pip install pytest ruff mypy
Step 5: Verify Installation
# Check SDK version
uv run python -c "import deepfix_sdk; print(deepfix_sdk.__version__)"
# Check server version
uv run deepfix-server version
# Check imports
uv run python -c "from deepfix_sdk import DeepFixClient; print('SDK OK')"
Configuration
Step 1: Configure Server
Create .env file in deepfix-server/ directory:
Edit .env with your configuration:
# LLM Configuration
DEEPFIX_LLM_API_KEY=sk-...
DEEPFIX_LLM_BASE_URL=https://api.your-llm.com/v1
DEEPFIX_LLM_MODEL_NAME=gpt-4o
DEEPFIX_LLM_TEMPERATURE=0.4
DEEPFIX_LLM_MAX_TOKENS=6000
DEEPFIX_LLM_CACHE=true
DEEPFIX_LLM_TRACK_USAGE=true
# Server Configuration
LIT_SERVER_API_KEY=ACCESS-TOKEN-TO-BE-DEFINED
Step 2: Start MLflow Server (Optional)
Option 1: Using Python:
# Start MLflow server
mlflow server \
--backend-store-uri sqlite:///mlflow.db \
--default-artifact-root ./mlruns \
--host 0.0.0.0 \
--port 5000
Option 2: Using Docker:
docker run -d \
-p 5000:5000 \
-v $(pwd)/mlruns:/mlruns \
-v $(pwd)/mlflow.db:/mlflow.db \
ghcr.io/mlflow/mlflow:latest \
mlflow server \
--backend-store-uri sqlite:///mlflow.db \
--default-artifact-root /mlruns \
--host 0.0.0.0 \
--port 5000
Option 3: Local file storage (no server):
# Use local file storage in code
mlflow_config = MLflowConfig(
tracking_uri="file:./mlruns",
experiment_name="local-experiment"
)
Step 3: Start DeepFix Server
# Navigate to server directory
cd deepfix-server
# Launch server
uv run deepfix-server launch -e .env -port 8844 -host 127.0.0.1
Server should display: Starting DeepFix server on 127.0.0.1:8844
Development Setup
Project Structure
deepfix/
├── deepfix-core/ # Core models and types
├── deepfix-sdk/ # Client SDK
├── deepfix-server/ # Analysis server
├── deepfix-kb/ # Knowledge base
├── docs/ # Documentation
├── tests/ # Tests
└── pyproject.toml # Root project config
Install Individual Packages
If working on specific packages:
# Install only SDK
cd deepfix-sdk
uv pip install -e .
# Install only server
cd deepfix-server
uv pip install -e .
# Install only core
cd deepfix-core
uv pip install -e .
Development Dependencies
Install development tools:
# Code formatting
uv pip install ruff black
# Type checking
uv pip install mypy
# Testing
uv pip install pytest pytest-cov
# Documentation
uv pip install mkdocs mkdocs-material
IDE Setup
VS Code
- Install Python extension
- Select Python 3.11 interpreter
- Configure settings:
{
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
"python.formatting.provider": "black",
"python.linting.enabled": true,
"python.linting.pylintEnabled": false,
"python.linting.ruffEnabled": true
}
PyCharm
- Open project
- Configure Python interpreter to use virtual environment
- Mark source directories as source roots:
deepfix-core/srcdeepfix-sdk/srcdeepfix-server/src
Running Tests
Run All Tests
Run Specific Tests
# Run specific test file
uv run pytest tests/test_deepchecks_runners.py
# Run specific test
uv run pytest tests/test_deepchecks_runners.py::test_specific_function
# Run with coverage
uv run pytest --cov=deepfix_sdk --cov=deepfix_server
Test Configuration
Create pytest.ini:
[pytest]
testpaths = tests
python_files = test_*.py
python_classes = Test*
python_functions = test_*
addopts =
-v
--strict-markers
--tb=short
Code Quality
Formatting
Linting
Type Checking
Building Documentation
Build Docs
# Build documentation
uv run mkdocs build
# Serve documentation locally
uv run mkdocs serve
# Build and serve
uv run mkdocs serve --dev-addr=127.0.0.1:8000
View Documentation
Open http://localhost:8000 in browser
Common Workflows
Development Workflow
-
Create Feature Branch:
-
Make Changes: Edit code in packages
-
Test Changes:
-
Format and Lint:
-
Commit Changes:
Testing Server Changes
-
Make Changes: Edit server code
-
Restart Server:
-
Test with Client:
Testing SDK Changes
-
Make Changes: Edit SDK code
-
Reinstall SDK:
-
Test Changes:
Troubleshooting
Common Issues
Problem: Import errors after installation
# Solution: Reinstall in editable mode
uv pip install -e .
# Or reinstall specific package
cd deepfix-sdk
uv pip install -e .
Problem: Virtual environment not activated
# Solution: Activate virtual environment
source .venv/bin/activate # macOS/Linux
.venv\Scripts\activate # Windows
Problem: Server fails to start
# Solution: Check .env file exists and is configured
cd deepfix-server
cat .env
# Check required environment variables
echo $DEEPFIX_LLM_API_KEY
# Check port is available
lsof -i :8844 # macOS/Linux
netstat -ano | findstr :8844 # Windows
Problem: MLflow connection errors
# Solution: Verify MLflow server is running
curl http://localhost:5000
# Check MLflow configuration
mlflow.set_tracking_uri("http://localhost:5000")
mlflow.list_experiments()
Environment Issues
Problem: Python version mismatch
Problem: Permission errors
Next Steps
- Quickstart Guide - Get started with DeepFix
- Configuration Guide - Configure DeepFix
- Development Guide - Development practices
- Docker Deployment - Deploy with Docker