Contributing to dg-sqlmesh¶
Thank you for your interest in contributing to dg-sqlmesh! This guide will help you get started.
Development Setup¶
1. Clone the Repository¶
2. Install Dependencies¶
# Install development dependencies
uv sync --group dev
# Install in development mode
uv pip install -e .
3. Load Test Data¶
Development Workflow¶
1. Create a Feature Branch¶
# Delete previous branches (if any)
git branch -D feat/your-feature-name
# Create new feature branch
git checkout -b feat/your-feature-name
2. Make Your Changes¶
- Write your code
- Add tests for new functionality
- Update documentation if needed
- Follow the code standards
3. Run Quality Checks¶
Before committing, run these checks:
# Code quality (MANDATORY)
uv run ruff check --ignore=F401,F811,E402 src/dg_sqlmesh/ tests/
uv run ruff format --check src/dg_sqlmesh/ tests/
# Dead code detection
uv run vulture src/dg_sqlmesh/ --min-confidence 80
# Run tests
uv run coverage run -m pytest tests/ -v
uv run coverage report --show-missing
4. Commit and Push¶
git add .
git commit -m "feat: descriptive message about your changes"
git push origin feat/your-feature-name
Code Standards¶
Python Code¶
- Follow PEP 8 style guidelines
- Use type hints where appropriate
- Write docstrings for public functions
- Keep functions focused and small
Testing¶
- Write tests for new functionality
- Maintain test coverage above 60%
- Use descriptive test names
- Test both success and failure cases
Documentation¶
- Update README.md for user-facing changes
- Add docstrings for new functions
- Update examples if APIs change
- Keep documentation in sync with code
Testing¶
Run Tests¶
# Run all tests
uv run pytest tests/ -v
# Run specific test file
uv run pytest tests/unit/test_factory.py -v
# Run with coverage
uv run coverage run -m pytest tests/ -v
uv run coverage report --show-missing
Test Data¶
The project includes test data for development:
# Load test data
uv run --group dev python tests/load_jaffle_data.py
# Test SQLMesh integration
uv run --group dev sqlmesh -p tests/sqlmesh_project plan --no-prompts
Pre-PR Checklist¶
Before creating a pull request, ensure:
- All tests pass (100% success rate)
- Code is properly linted with Ruff
- Code is properly formatted
- No dead code detected
- Package builds successfully
- Documentation updated (if applicable)
- GitHub Release notes will be updated (for notable changes)
- ADR created/updated (for architectural decisions)
- Examples updated (if public API changed)
Creating a Pull Request¶
1. Run Local Validation¶
2. Create PR¶
gh pr create \
--title "feat: your descriptive title" \
--body "## Overview
Detailed description of changes...
## Testing
- ✅ All ruff checks pass
- ✅ All tests pass
- ✅ Package builds successfully
- ✅ No breaking changes
## Related
- Fixes #issue_number" \
--draft
3. Mark Ready for Review¶
Release Process¶
1. Merge PR¶
After PR review and approval:
2. Create Release¶
# Create patch release
make release-patch
# Or create tag manually
git tag -a v1.9.2 -m "Release v1.9.2"
git push origin v1.9.2
Architecture Decisions¶
The project follows documented architecture decisions in the adr/
folder:
- ADR-0001: Individual assets vs multi-asset
- ADR-0002: Shared SQLMesh execution
- ADR-0003: Asset check integration
- ADR-0004: Retry policy management
- ADR-0005: SQLMesh-Dagster tag convention
Getting Help¶
- GitHub Issues: Create an issue
- Discussions: GitHub Discussions
- Code Review: Request review from maintainers
Thank You¶
Thank you for contributing to dg-sqlmesh! Your contributions help make this project better for everyone. 🙏