This guide covers setting up TableSleuth for development, testing, and contributing.
- Python 3.13+
uvpackage manager- Git
- Node.js 20+ and npm (required to rebuild the web UI frontend)
- AWS CLI (for AWS-related development)
# Clone repository
git clone https://github.com/jamesbconner/TableSleuth.git
cd TableSleuth
# Install dependencies with dev tools (includes web extras)
make install-dev
# Install pre-commit hooks
uv run pre-commit install
# Run all quality checks
make checkmake install # Install production dependencies
make install-dev # Install with dev dependencies
make sync # Sync dependencies with uvmake test # Run tests
make test-cov # Run tests with coverage reportmake lint # Run ruff linter
make format # Format code with ruff
make type-check # Run mypy type checking
make security # Run bandit security scan
make pre-commit # Run all pre-commit hooks
make check # Run all quality checksmake build # Build wheel + sdist (for releases)
make run # Run tablesleuth CLImake dev-web-install-npm # Install Node.js dependencies (run once after checkout)
make dev-api # Start FastAPI server at localhost:8000 (hot-reload)
make dev-web # Start Next.js dev server at localhost:3000 (hot-reload)
make build-web # Build Next.js static export only
make build-release # Build frontend and copy into src/tablesleuth/web/
make start-web # build-release then launch tablesleuth webmake clean # Remove build artifacts and cacheThe project uses pre-commit hooks to ensure code quality. Hooks run automatically on git commit.
Installed hooks:
- Ruff (linting + formatting)
- mypy (type checking)
- bandit (security scanning)
- Standard checks (trailing whitespace, YAML/TOML validation, etc.)
Manual execution:
# Run on all files
make pre-commit
# Or directly
uv run pre-commit run --all-files# Create test data directory
mkdir -p tests/data
# Create test catalog
mkdir -p tests/catalogs
sqlite3 tests/catalogs/test.db "CREATE TABLE IF NOT EXISTS test (id INTEGER);"
# Create test warehouse
mkdir -p tests/warehouseCreate ~/.pyiceberg.yaml for development:
catalog:
# Local development catalog
local:
type: sql
uri: sqlite:///tests/catalogs/test.db
warehouse: file:///$(pwd)/tests/warehouse
# Test catalog for unit tests
test:
type: sql
uri: sqlite:///:memory:
warehouse: file:///tmp/test_warehouse# Install GizmoSQL for development
pip install gizmosql
# Generate test certificates
mkdir -p ~/.certs
openssl req -x509 -newkey rsa:2048 -keyout ~/.certs/test.key -out ~/.certs/test.pem -days 365 -nodes -subj "/CN=localhost"
# Start test server
gizmosql_server -U test_user -P test_password -Q \
-I "install aws; install httpfs; install iceberg; load aws; load httpfs; load iceberg; CREATE SECRET (TYPE s3, PROVIDER credential_chain);" \
-T ~/.certs/test.pem ~/.certs/test.key- Make your changes
- Run
make formatto auto-format code - Run
make lintto check for issues - Run
make type-checkfor type validation - Run
make testto verify functionality - Run
make checkto run all quality checks - Commit (pre-commit hooks run automatically)
- Push
# Run TUI from source
uv run tablesleuth parquet data/sample.parquet
uv run tablesleuth iceberg --catalog local --table db.table
uv run tablesleuth delta path/to/table
# Run with verbose logging for debugging
uv run tablesleuth parquet data/sample.parquet -vThe web UI consists of a FastAPI backend and a Next.js frontend. During development you run them separately for hot-reload.
# Install Node.js dependencies (once after checkout)
make dev-web-install-npm
# Install Python web extras
uv sync --extra webTerminal 1 — FastAPI backend:
make dev-api # http://localhost:8000/api/...Terminal 2 — Next.js frontend:
make dev-web # http://localhost:3000The Next.js dev server proxies API calls to localhost:8000. Edit files in web-ui/src/ and Python source normally; both servers reload automatically.
make build-release # npm run build → copies web-ui/out/ to src/tablesleuth/web/This is required before uv build so the compiled static export is bundled in the wheel. The GitHub Actions publish workflow runs this step automatically; you only need it locally when verifying the built package or committing an updated src/tablesleuth/web/index.html.
| Variable | Default | Description |
|---|---|---|
TABLESLEUTH_WEB_UI_DIR |
package web/ dir |
Override path to static Next.js export |
TABLESLEUTH_CORS_ORIGINS |
http://localhost:3000 |
Comma-separated allowed CORS origins |
# Run unit tests only
pytest tests/unit/ -v
# Test specific module
pytest tests/test_parquet_service.py::test_inspect_file -v
# Run with coverage
pytest --cov=src/tablesleuth --cov-report=html --cov-report=term-missing# Requires web extras installed
uv sync --extra web --extra dev
# Run API smoke tests
pytest tests/api/ -v# Set up test environment
export TEST_GIZMOSQL_URI="grpc+tls://localhost:31337"
export TEST_GIZMOSQL_USERNAME="test_user"
export TEST_GIZMOSQL_PASSWORD="test_password"
# Run integration tests
pytest -m integration -v
# Run end-to-end tests
pytest tests/test_end_to_end.py -v# Run unit tests only
pytest -m unit
# Run integration tests only
pytest -m integration
# Skip slow tests
pytest -m "not slow"# Run with debug logging
tablesleuth inspect file.parquet -v
# Enable Python debugging
PYTHONPATH=src python -m pdb -m tablesleuth.cli inspect file.parquet
# Use debugger in tests
pytest --pdb tests/test_specific.py# Add to your test files for detailed logging
import logging
logging.basicConfig(level=logging.DEBUG)# Run TUI with console logging
tablesleuth inspect file.parquet -v 2> debug.log
# Use textual development console
textual console
# Then run tablesleuth in another terminal- Fork and clone the repository
- Create feature branch:
git checkout -b feature/your-feature - Make changes with tests
- Run quality checks:
make check - Commit changes: Follow conventional commit format
- Push and create PR
- Use ruff for formatting and linting
- Follow PEP 8 style guidelines
- Add type hints for all functions (Python 3.13+ syntax)
- Write Google-style docstrings for public APIs
- Keep line length under 100 characters
- Use explicit over implicit code
- Write unit tests for all new functions
- Add integration tests for new features
- Mock external dependencies in unit tests
- Use pytest fixtures for common test data
- Aim for >90% code coverage
- Test both happy paths and edge cases
- Update docstrings for API changes
- Add usage examples to docstrings
- Update README.md for new features
- Add CHANGELOG.md entries
- Update user guides as needed
# Ensure virtual environment is activated
source .venv/bin/activate
# Reinstall in development mode
uv pip install -e .# Sync all dependencies
uv sync --all-extras# Clean test cache
pytest --cache-clear
# Regenerate test data
python scripts/generate_test_data.py# Install type stubs
uv add --dev types-requests types-PyYAML# Check server is running
ps aux | grep gizmosql_server
# Test connection
gizmosql_client --command Execute --use-tls --tls-skip-verify "SELECT 1"All tool configurations are in pyproject.toml:
- Ruff: Linting and formatting
- mypy: Type checking
- pytest: Testing framework
- bandit: Security scanning
- coverage: Code coverage reporting
After development setup:
- Review TABLESLEUTH_SETUP.md for user setup
- Check ARCHITECTURE.md for system design
- Read CONTRIBUTING.md for contribution guidelines
- See QUICKSTART.md for usage examples
- See DEVELOPER_GUIDE.md for API reference and component interfaces