SDK Development Tools
The s0 sdk command group provides tools to help develop and maintain the Socket0 SDK.
Available Commands
s0 sdk test - Run Test Suite
Run the project's test suite using pytest.
# Run all tests
s0 sdk test
# Run tests for a specific directory
s0 sdk test tests/vault/
# Run a specific test file
s0 sdk test tests/test_specific.py
# Verbose output
s0 sdk test --verbose
# With coverage report
s0 sdk test --coverageOptions:
| Option | Short | Description |
|---|---|---|
--path | - | Path to test directory or file (default: tests) |
--verbose | -v | Show verbose output |
--coverage | -c | Generate coverage report (HTML) |
Examples:
# Run vault tests with coverage
s0 sdk test tests/vault --coverage
# Run API tests with verbose output
s0 sdk test tests/api -v
# Run a single test file
s0 sdk test tests/test_aesctr_bucket.pys0 sdk lint - Run Linting
Lint code using ruff.
# Lint source directory
s0 sdk lint
# Lint specific path
s0 sdk lint --path src/socket0/vault
# Auto-fix issues
s0 sdk lint --fix
# Fix linting issues in a specific directory
s0 sdk lint --path src --fixOptions:
| Option | Short | Description |
|---|---|---|
--path | -p | Path to lint (default: src) |
--fix | -f | Automatically fix issues |
Examples:
# Lint and fix the CLI module
s0 sdk lint --path src/socket0/cli --fix
# Check entire codebase
s0 sdk lint --path srcs0 sdk format - Format Code
Format code using ruff formatter.
# Format source directory
s0 sdk format
# Format specific path
s0 sdk format --path src/socket0/vaultOptions:
| Option | Short | Description |
|---|---|---|
--path | -p | Path to format (default: src) |
Examples:
# Format the entire source
s0 sdk format
# Format specific module
s0 sdk format --path src/socket0/vaults0 sdk check - Type Checking
Run type checking using mypy.
# Check source directory
s0 sdk check
# Check specific path
s0 sdk check --path src/socket0/apiOptions:
| Option | Short | Description |
|---|---|---|
--path | -p | Path to check (default: src) |
Examples:
# Check type safety of CLI module
s0 sdk check --path src/socket0/cli
# Check API module
s0 sdk check --path src/socket0/apis0 sdk docs - Preview Documentation
Preview documentation locally using VitePress.
Requirements: Node.js 18+ and npm must be installed.
# First time setup (one-time)
npm install
# Start documentation server on default port (5173)
s0 sdk docs
# Serve on custom port
s0 sdk docs --port 3000Options:
| Option | Short | Description |
|---|---|---|
--port | -p | Port to serve on (default: 5173) |
Examples:
# Preview docs on default port
s0 sdk docs
# Preview on custom port
s0 sdk docs --port 9000
s0 sdk docs -p 3000Output:
Starting VitePress documentation server...
Port: 5173
Open http://localhost:5173 in your browser
✓ ready in 245ms
➜ Local: http://localhost:5173/Visit the URL in your browser to see live documentation. Changes to markdown files are automatically reloaded.
Alternative: Run directly with npm:
npm run docs:dev # Default port 5173
npm run docs:dev -- --port 9000 # Custom portDevelopment Workflow
Typical development workflow for SDK changes:
# 1. Make code changes
# ...
# 2. Format code
s0 sdk format
# 3. Lint and fix issues
s0 sdk lint --fix
# 4. Run type checking
s0 sdk check
# 5. Run tests with coverage
s0 sdk test --coverage
# 6. Review coverage report
open htmlcov/index.htmlOne-Liner: Full Quality Check
Run all quality checks in sequence:
s0 sdk format && s0 sdk lint --fix && s0 sdk check && s0 sdk test --coverageDocumentation Preview
Preview documentation changes locally while developing with VitePress:
# 1. First-time setup (install Node dependencies)
npm install
# 2. Start documentation server
s0 sdk docs
# 3. Open http://localhost:5173 in your browser
# 4. Edit markdown files in docs/
# Documentation automatically reloads in browser with HMR
# 5. Press Ctrl+C to stop the serverServer runs on port 5173 by default (Vite's default). Change the port if needed:
s0 sdk docs --port 9000For more details on VitePress configuration and usage, see VitePress Setup Guide.
Pre-commit Hooks
The SDK uses pre-commit hooks to automatically run quality checks. These are the same tools used in the s0 sdk commands.
See .pre-commit-config.yaml for the configuration.
Integration with CI/CD
The s0 sdk commands are designed to integrate with CI/CD pipelines:
# In your CI script
s0 sdk lint # Will fail if linting issues found
s0 sdk check # Will fail if type errors found
s0 sdk test # Will fail if tests failTroubleshooting
Command Not Found
If you get "command not found" errors:
# Ensure you have the CLI installed
pip install socket0-sdk[cli]
# Try running through python module
python -m socket0.cli.sdk testTest Discovery Issues
If tests are not being discovered:
# Check test file naming (must match test_*.py pattern)
# Check pytest configuration in pyproject.toml
# Run with verbose output
s0 sdk test -vNext Steps
- CLI Overview - Back to CLI overview
- Vault Management - Vault command guide