This document explains the development setup, tools, and CI/CD pipeline for the SQLAlchemy Cloudflare D1 dialect.
- Python 3.9+
- uv package manager
# Clone the repository
git clone https://github.com/collierking/sqlalchemy-cloudflare-d1.git
cd sqlalchemy-cloudflare-d1
# Install dependencies
make install
# Setup pre-commit hooks
make setup_hooksWe use the following tools for code quality and consistency:
- Ruff: Fast Python linter and formatter (replaces black, isort, flake8)
- mypy: Static type checker
- codespell: Spell checker for code and documentation
- pre-commit: Automated checks before commits
- pytest: Testing framework
# Install dependencies
make install
# Format code (auto-fix)
make format
# Run linting checks
make lint
# Run tests
make test
# Run all checks (lint + test)
make check
# Build package
make build
# Install pre-commit hooks
make setup_hooks
# Run spell check
make spell_check# Run unit tests (no network access)
make test
# Run tests with file watcher (auto-reload)
make test_watch
# Run integration tests (with network access)
make integration_test# Auto-format code and fix linting issues
make format
# Check formatting and run linters (no auto-fix)
make lint
# Check only changed files
make lint_diff
# Spell check
make spell_check
# Fix spelling issues
make spell_fixThe project uses GitHub Actions for continuous integration and deployment:
-
CI (
.github/workflows/ci.yml):- Runs on every push and pull request
- Pre-commit checks
- Linting across Python 3.9 and 3.12
- Testing across Python 3.9-3.12
- Package building
-
Release (
.github/workflows/release.yml):- Manual trigger for releases
- Runs full test suite
- Builds package
- Publishes to PyPI using trusted publishing
- Creates GitHub release
The following checks run automatically before each commit:
- YAML syntax validation
- Trailing whitespace removal
- Large file detection
- Merge conflict detection
- Ruff formatting and linting
- mypy type checking
- Spell checking
pyproject.toml: Project metadata, dependencies, and tool configuration.pre-commit-config.yaml: Pre-commit hook configurationMakefile: Development commands.github/workflows/: CI/CD pipeline definitions
Configured in pyproject.toml under [tool.ruff]:
- Line length: 88 characters
- Includes rules for: pycodestyle, pyflakes, isort, print statements, pyupgrade, bugbear, comprehensions
- Auto-fixes common issues
Configured in pyproject.toml under [tool.mypy]:
- Strict type checking enabled
- Requires type annotations for all functions
- Ignores missing imports in test files
Configured in pyproject.toml under [tool.pytest.ini_options]:
- Strict markers and config
- Shows test durations
- Socket access disabled by default (for unit tests)
- Update version in
pyproject.toml - Commit and push changes
- Go to GitHub Actions → Release workflow
- Click "Run workflow" and enter the version number
- The workflow will:
- Run all tests
- Build the package
- Publish to PyPI
- Create a GitHub release
The project uses PyPI's trusted publishing feature, which eliminates the need for API tokens. The publisher is configured on PyPI to trust releases from the main branch of this repository's release workflow.
- Fork the repository
- Create a feature branch
- Make your changes
- Run
make checkto ensure all tests pass - Commit your changes (pre-commit hooks will run)
- Push and create a pull request
The CI pipeline will automatically run all checks on your pull request.