Skip to content

Allow more negative subplot_wspace values in VisualizationParameters #71

Allow more negative subplot_wspace values in VisualizationParameters

Allow more negative subplot_wspace values in VisualizationParameters #71

name: Test MCP Installation
on:
pull_request:
branches: [ main ]
paths:
- 'pyproject.toml'
- 'chatspatial/**'
- '.github/workflows/test-installation.yml'
push:
branches: [ main ]
paths:
- 'pyproject.toml'
- 'chatspatial/**'
- '.github/workflows/test-installation.yml'
workflow_dispatch:
jobs:
test-full-installation:
name: Test Full Install (${{ matrix.os }}, Python ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.10', '3.11']
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip packages (Unix)
if: runner.os != 'Windows'
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
- name: Cache pip packages (Windows)
if: runner.os == 'Windows'
uses: actions/cache@v4
with:
path: ~\AppData\Local\pip\Cache
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libopenblas-dev liblapack-dev gfortran
- name: Install system dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install openblas lapack gcc
echo "LDFLAGS=-L/opt/homebrew/opt/openblas/lib" >> $GITHUB_ENV
echo "CPPFLAGS=-I/opt/homebrew/opt/openblas/include" >> $GITHUB_ENV
- name: Set up R (for rpy2 compilation)
uses: r-lib/actions/setup-r@v2
with:
r-version: '4.4.1'
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
pip --version
- name: Install ChatSpatial (full)
run: |
echo "[INSTALL] Installing ChatSpatial with full dependencies on ${{ matrix.os }}..."
pip install -e ".[full]"
echo "[OK] Full installation completed"
timeout-minutes: 40
- name: Verify core imports
run: |
python -c "import chatspatial; print(f'[OK] ChatSpatial version: {chatspatial.__version__}')"
python -c "from chatspatial.server import mcp; print('[OK] MCP server import successful')"
python -c "import scanpy; print(f'[OK] Scanpy available')"
python -c "import squidpy; print(f'[OK] Squidpy available')"
- name: Verify advanced imports
run: |
python -c "import torch; print(f'[OK] PyTorch version: {torch.__version__}')"
python -c "import scvi; print(f'[OK] scvi-tools available')"
python -c "import liana; print(f'[OK] LIANA available')"
continue-on-error: true
- name: Test MCP server CLI
shell: bash
run: |
echo "[TEST] Testing MCP server CLI on ${{ matrix.os }}..."
python -m chatspatial server --help || echo "[OK] Help command works"
echo "[OK] MCP server ready with full features"
- name: List key packages
run: |
echo "[INFO] Key installed packages:"
pip list | grep -E "(chatspatial|scanpy|squidpy|scvi|liana|torch)" || pip list | findstr /I "chatspatial scanpy squidpy scvi liana torch" || true
test-dev-installation:
name: Test Dev Install (Python 3.10)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Cache pip packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-dev-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-dev-
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
pip --version
- name: Install ChatSpatial (dev)
run: |
echo "[INSTALL] Installing ChatSpatial with dev dependencies..."
pip install -e ".[dev]"
echo "[OK] Dev installation completed"
- name: Verify dev tools
run: |
python -c "import chatspatial; print(f'[OK] ChatSpatial version: {chatspatial.__version__}')"
black --version
isort --version
pytest --version
mypy --version
ruff --version
echo "[OK] All dev tools available"
- name: Test code formatting check
run: |
echo "[TEST] Running black check..."
black --check chatspatial/ || echo "[WARN] Code formatting issues detected (non-blocking)"
continue-on-error: true
test-mcp-protocol:
name: Test MCP Protocol Communication
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Install ChatSpatial
run: |
pip install --upgrade pip
pip install -e .
- name: Test MCP server initialization
run: |
cat << 'EOF' > test_mcp_init.py
import sys
import json
from chatspatial.server import mcp
try:
# Test that MCP app is properly initialized
assert mcp is not None, "MCP app not initialized"
# Test that tools are registered
tools = mcp._tools if hasattr(mcp, '_tools') else {}
print(f"[OK] MCP server initialized with {len(tools)} tools")
# Verify key tools exist
expected_tools = [
'load_data',
'preprocess_data',
'visualize_data',
'analyze_cell_communication'
]
for tool_name in expected_tools:
if tool_name in str(tools):
print(f"[OK] Tool registered: {tool_name}")
print("[OK] MCP protocol test passed")
sys.exit(0)
except Exception as e:
print(f"[ERROR] MCP protocol test failed: {e}")
sys.exit(1)
EOF
python test_mcp_init.py
- name: Test command-line interface
run: |
# Test that the CLI is accessible
python -m chatspatial --help 2>&1 | grep -i "usage" || echo "CLI help available"
# Test server subcommand
python -m chatspatial server --help 2>&1 | grep -E "(usage|help)" || echo "Server help available"
echo "[OK] CLI interface functional"
installation-summary:
name: Installation Test Summary
runs-on: ubuntu-latest
needs: [test-full-installation, test-dev-installation, test-mcp-protocol]
if: always()
steps:
- name: Check test results
run: |
echo "[INFO] Installation Test Results:"
echo "=============================="
if [[ "${{ needs.test-full-installation.result }}" == "success" ]]; then
echo "[PASS] Full installation (Linux + macOS + Windows): PASSED"
else
echo "[FAIL] Full installation: FAILED"
fi
if [[ "${{ needs.test-dev-installation.result }}" == "success" ]]; then
echo "[PASS] Dev installation: PASSED"
else
echo "[FAIL] Dev installation: FAILED"
fi
if [[ "${{ needs.test-mcp-protocol.result }}" == "success" ]]; then
echo "[PASS] MCP protocol: PASSED"
else
echo "[FAIL] MCP protocol: FAILED"
fi
echo "=============================="
# Fail if any critical tests failed
if [[ "${{ needs.test-full-installation.result }}" != "success" ]] || \
[[ "${{ needs.test-mcp-protocol.result }}" != "success" ]]; then
echo "[FAIL] Critical installation tests failed!"
exit 1
fi
echo "[PASS] All critical installation tests passed!"