Skip to content

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.

bash
# 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 --coverage

Options:

OptionShortDescription
--path-Path to test directory or file (default: tests)
--verbose-vShow verbose output
--coverage-cGenerate coverage report (HTML)

Examples:

bash
# 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.py

s0 sdk lint - Run Linting

Lint code using ruff.

bash
# 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 --fix

Options:

OptionShortDescription
--path-pPath to lint (default: src)
--fix-fAutomatically fix issues

Examples:

bash
# Lint and fix the CLI module
s0 sdk lint --path src/socket0/cli --fix

# Check entire codebase
s0 sdk lint --path src

s0 sdk format - Format Code

Format code using ruff formatter.

bash
# Format source directory
s0 sdk format

# Format specific path
s0 sdk format --path src/socket0/vault

Options:

OptionShortDescription
--path-pPath to format (default: src)

Examples:

bash
# Format the entire source
s0 sdk format

# Format specific module
s0 sdk format --path src/socket0/vault

s0 sdk check - Type Checking

Run type checking using mypy.

bash
# Check source directory
s0 sdk check

# Check specific path
s0 sdk check --path src/socket0/api

Options:

OptionShortDescription
--path-pPath to check (default: src)

Examples:

bash
# Check type safety of CLI module
s0 sdk check --path src/socket0/cli

# Check API module
s0 sdk check --path src/socket0/api

s0 sdk docs - Preview Documentation

Preview documentation locally using VitePress.

Requirements: Node.js 18+ and npm must be installed.

bash
# 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 3000

Options:

OptionShortDescription
--port-pPort to serve on (default: 5173)

Examples:

bash
# Preview docs on default port
s0 sdk docs

# Preview on custom port
s0 sdk docs --port 9000
s0 sdk docs -p 3000

Output:

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:

bash
npm run docs:dev            # Default port 5173
npm run docs:dev -- --port 9000  # Custom port

Development Workflow

Typical development workflow for SDK changes:

bash
# 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.html

One-Liner: Full Quality Check

Run all quality checks in sequence:

bash
s0 sdk format && s0 sdk lint --fix && s0 sdk check && s0 sdk test --coverage

Documentation Preview

Preview documentation changes locally while developing with VitePress:

bash
# 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 server

Server runs on port 5173 by default (Vite's default). Change the port if needed:

bash
s0 sdk docs --port 9000

For 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:

bash
# 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 fail

Troubleshooting

Command Not Found

If you get "command not found" errors:

bash
# Ensure you have the CLI installed
pip install socket0-sdk[cli]

# Try running through python module
python -m socket0.cli.sdk test

Test Discovery Issues

If tests are not being discovered:

bash
# Check test file naming (must match test_*.py pattern)
# Check pytest configuration in pyproject.toml

# Run with verbose output
s0 sdk test -v

Next Steps

Socket0 Python SDK License - Not open source. For usage terms see /license