Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .commitlintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
extends:
- '@commitlint/config-conventional'
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ env/
.Python
build/
develop-eggs/
dist/
# Keep dist/ for FastAPI example - needs the wheel file
# dist/
downloads/
eggs/
.eggs/
Expand Down
80 changes: 80 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# GitHub Copilot Instructions for dqlitepy

## Python Command Execution

**ALWAYS use `uv run` for Python commands in this project.**

This project uses `uv` for dependency management and virtual environment handling. All Python commands must be prefixed with `uv run`.

### Examples:

✅ **CORRECT:**
- `uv run python script.py`


❌ **INCORRECT:**
- `python script.py`
- `pytest tests/`
- `python -m vantage_cli.main`
- `vantage --help`
- `coverage run`
- `mypy .`
- `black .`
- `ruff check`

### Just Commands (Primary Development Workflow):

**Testing:**
- `just unit` - Run unit tests with coverage (80% threshold)
- `just integration` - Run integration tests
- `just coverage-all` - Run full test suite with combined coverage

**Code Quality:**
- `just typecheck` - Run static type checker (pyright)
- `just lint` - Check code against style standards (codespell + ruff)
- `just fmt` - Apply coding style standards (ruff format + fix)

**Documentation:**
- `just docs-dev` - Start Docusaurus development server
- `just docs-dev-port [port]` - Start dev server on specific port
- `just docs-build` - Build documentation for production
- `just docs-serve` - Serve built documentation
- `just docs-clean` - Clean documentation build artifacts
- `just docs-help` - Show documentation commands

**Development:**
- `just lock` - Regenerate uv.lock file

### Installation Commands:
- Install dependencies: `uv sync`
- Add new dependency: `uv add package-name`
- Add dev dependency: `uv add --dev package-name`
- Regenerate lock: `just lock`

## Project Structure

This is a Python CLI application using:
- `uv` for dependency management
- `pytest` for testing
- `just` for task automation
- `dqlitepy` as the main package
- `docusaurus` for documentation
- `examples/` directory for usage patterns
## Testing Patterns

When writing tests, ensure:
1. Use `uv run pytest` to execute tests
2. Place tests in the `tests/` directory
3. Use fixtures for setup/teardown


## Test Patterns

When working with tests, ensure:
1. MockConsole includes all necessary Rich console methods
3. All async functions are properly awaited in tests
4. Function signatures match current implementation

## Never Forget

**EVERY Python command MUST start with `uv run`** - this is critical for proper dependency resolution and virtual environment isolation in this project.
47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: DQLite Code Quality Checks
on:
workflow_call:
pull_request:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
commitlint:
runs-on: ubuntu-latest
permissions:
contents: read
if: github.event_name == 'pull_request'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install commitlint
run: npm install -D @commitlint/cli @commitlint/config-conventional
- name: Validate PR commits with commitlint
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose

ci-tests:
name: CI-Tests
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install `just`
run: sudo snap install just --classic
- name: Install `uv`
run: sudo snap install astral-uv --classic
- name: Run lint checks
run: just lint
- name: Run type checks
run: just typecheck
- name: Run unit tests
run: just unit
205 changes: 205 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
# Copyright (c) 2025 Vantage Compute Corporation.
name: Build and Release

on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+a[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+b[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
workflow_dispatch: # Allow manual triggering

permissions:
contents: write # Required for creating releases
id-token: write # Required for PyPI trusted publishing

jobs:
build:
name: Build Distribution
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch full history for proper version detection

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential
sudo snap install astral-uv --classic


- name: Install git-cliff
run: |
curl -L https://github.com/orhun/git-cliff/releases/download/v2.10.0/git-cliff-2.10.0-x86_64-unknown-linux-gnu.tar.gz | tar xz
sudo mv git-cliff-*/git-cliff /usr/local/bin/
git-cliff --version

- name: Build Python package
run: |
uv build

- name: Check build artifacts
run: |
ls -la dist/
# Basic validation - ensure files exist
test -n "$(find dist -name '*.whl')" || (echo "No wheel files found" && exit 1)
test -n "$(find dist -name '*.tar.gz')" || (echo "No source distribution found" && exit 1)

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: distribution-files
path: dist/
retention-days: 7

test-install:
name: Test Installation
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12', '3.13']

steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: distribution-files
path: dist/

- name: Test wheel installation
run: |
sudo snap install astral-uv --classic
uv venv
uv pip install dist/*.whl
uv run python3 -c "import dqlitepy; print('Package imported successfully')"

publish-pypi:
name: Publish to PyPI
needs: [build, test-install]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
environment:
name: pypi
url: https://pypi.org/p/dqlitepy

steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: distribution-files
path: dist/

- name: Publish to PyPI
run: |
sudo snap install astral-uv --classic
uv publish

create-release:
name: Create GitHub Release
needs: [build, test-install]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: distribution-files
path: dist/

- name: Extract version from tag
id: get_version
run: |
VERSION=${GITHUB_REF#refs/tags/}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT

- name: Generate release notes
id: release_notes
run: |
# Extract release notes from CHANGELOG.md if it exists
if [ -f "CHANGELOG.md" ]; then
# Try to extract notes for this version using git-cliff for consistency
VERSION="${{ steps.get_version.outputs.version }}"

# Use git-cliff to generate notes for this specific version
git-cliff --latest --strip header --strip footer > release_notes.txt || true

# If that fails, fall back to grep method
if [ ! -s release_notes.txt ]; then
grep -A 1000 "^## .*${VERSION}" CHANGELOG.md | grep -B 1000 -m 2 "^## " | head -n -1 | tail -n +2 > release_notes.txt || true
fi

# If no specific version notes found, create generic notes
if [ ! -s release_notes.txt ]; then
echo "Release ${{ steps.get_version.outputs.tag }}" > release_notes.txt
echo "" >> release_notes.txt
echo "### Changes" >> release_notes.txt
echo "- See CHANGELOG.md for detailed changes" >> release_notes.txt
fi
else
echo "Release ${{ steps.get_version.outputs.tag }}" > release_notes.txt
echo "" >> release_notes.txt
echo "### Files" >> release_notes.txt
echo "- Source distribution (tar.gz)" >> release_notes.txt
echo "- Wheel distribution (.whl)" >> release_notes.txt
fi

echo "Release notes:"
cat release_notes.txt

- name: Create Release
uses: softprops/action-gh-release@v1
with:
name: Release ${{ steps.get_version.outputs.tag }}
body_path: release_notes.txt
files: |
dist/*.tar.gz
dist/*.whl
draft: false
prerelease: ${{ contains(steps.get_version.outputs.version, 'rc') || contains(steps.get_version.outputs.version, 'beta') || contains(steps.get_version.outputs.version, 'alpha') }}
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

notify-success:
name: Notify Success
needs: [publish-pypi, create-release]
runs-on: ubuntu-latest
if: success() && startsWith(github.ref, 'refs/tags/')

steps:
- name: Extract version from tag
id: get_version
run: |
VERSION=${GITHUB_REF#refs/tags/}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT

- name: Success notification
run: |
echo "🎉 Successfully released dqlitepy ${{ steps.get_version.outputs.tag }}"
echo "📦 Published to PyPI: https://pypi.org/project/dqlitepy/${{ steps.get_version.outputs.version }}/"
echo "🚀 GitHub Release: ${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ steps.get_version.outputs.tag }}"
Loading
Loading