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
77 changes: 77 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name-template: v$NEXT_PATCH_VERSION
tag-template: v$NEXT_PATCH_VERSION

categories:
- title: '💥 Breaking Changes'
labels:
- 'breaking change'
- 'breaking'

- title: '✨ Features'
labels:
- 'feat'
- 'feature'
- 'enhancement'

- title: '🐛 Bug Fixes'
labels:
- 'fix'
- 'bug'

- title: '🚀 Performance'
labels:
- 'perf'
- 'performance'

- title: '♻️ Refactor'
labels:
- 'refactor'

- title: '📖 Documentation'
labels:
- 'docs'
- 'documentation'

- title: '✅ Tests'
labels:
- 'test'
- 'testing'

- title: '👷 CI'
labels:
- 'ci'

- title: '🔧 Maintenance'
labels:
- 'chore'

- title: '⏪ Reverts'
labels:
- 'revert'

- title: '⬆️ Dependencies'
collapse-after: 3
labels:
- 'dependencies'
- 'deps'

version-resolver:
major:
labels:
- 'breaking'
minor:
labels:
- 'feat'
- 'feature'
- 'enhancement'
default: patch

change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # Escapes to prevent mentions and markdown formatting

template: |
## What's Changed 🚀

$CHANGES

**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$NEXT_PATCH_VERSION
36 changes: 36 additions & 0 deletions .github/workflows/pr-test-suite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: PR Test Suite

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
style:
runs-on: ubuntu-latest
timeout-minutes: 15
env:
UV_PYTHON: "3.10"
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v7
- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-python-${{ env.UV_PYTHON }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run style checks
run: uv run pre-commit run --all-files

test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.13"]
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
- name: Run tests
run: uv run pytest tests/ -v
37 changes: 37 additions & 0 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish Package

on:
push:
tags:
- v*

workflow_dispatch:
inputs:
test-pypi:
description: Publish to TestPyPI instead of PyPI
type: boolean
default: false

jobs:
publish:
runs-on: ubuntu-latest
environment: ${{ github.event_name == 'workflow_dispatch' && inputs.test-pypi && 'testpypi' || 'pypi' }}
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: astral-sh/setup-uv@v7
- name: Build wheel and sdist
run: uv build --sdist --wheel

- name: Publish to TestPyPI
if: github.event_name == 'workflow_dispatch' && inputs.test-pypi
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

- name: Publish to PyPI
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && !inputs.test-pypi)
uses: pypa/gh-action-pypi-publish@release/v1
36 changes: 36 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Adapted from: https://github.com/release-drafter/release-drafter#readme

name: Release Drafter

on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- main
workflow_dispatch:


permissions:
# write permission is required to create a github release
contents: write
# write permission is required for autolabeler (which we don't use here)
# otherwise, read permission is required at least
pull-requests: read

jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
# (Optional) GitHub Enterprise requires GHE_HOST variable set
#- name: Set GHE_HOST
# run: |
# echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV

# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v7
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
# with:
# config-name: my-config.yml
# disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29 changes: 29 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Python
**/__pycache__/
*.py[cod]
*.egg-info/
dist/
build/
*.so
*.dylib
*.pyd
.python-version
**/.ipynb_checkpoints/
.mypy_cache
.ruff_cache
.coverage
.env
.venv/

# IDE
.idea/
.vscode/
*.swp

# OS
.DS_Store

# Agent Prompting Templates
CLAUDE.local.md
.claude/**/*.md
.claude/worktrees/
47 changes: 47 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
# General file hygiene and linting
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace # Strip trailing whitespace from all files
- id: end-of-file-fixer # Ensure files end with a newline
- id: check-yaml # Validate YAML syntax
- id: check-toml # Validate TOML syntax (pyproject.toml)
- id: check-added-large-files # Prevent accidental commit of large files
exclude: uv.lock
- id: check-merge-conflict # Check for remaining merge conflicts
- id: detect-private-key # Block commits containing private keys

# TOML and YAML formatting
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.15.0
hooks:
- id: pretty-format-toml
args: [--autofix, --no-sort]
exclude: uv.lock
- id: pretty-format-yaml
args: [--autofix, --preserve-quotes]

# Python linting and formatting
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.20
hooks:
- id: ruff-check # Lint Python files and auto-fix safe issues
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
- id: ruff-format # Format Python files
name: Python code Formatting

# Python type checking
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v2.1.0
hooks:
- id: mypy # Static type checker for Python
additional_dependencies: [daft>=0.7.5]

# Check that uv.lock is up to date with pyproject.toml
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.11.2
hooks:
- id: uv-lock
58 changes: 58 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
fix = true
indent-width = 4
line-length = 120

[format]
docstring-code-format = true
# Like Black, indent with spaces, rather than tabs.
indent-style = "space"
# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"
# Like Black, use double quotes for strings.
quote-style = "double"
# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false

[lint]
extend-select = [
"UP", # pyupgrade
"LOG", # flake8-logging
"G", # flake8-logging-format
"I", # isort
"D", # pydocstyle rules
"RUF010", # Use explicit conversion flag
"RUF013", # PEP 484 prohibits implicit Optional
"RUF015", # Prefer next({iterable}) over single element slice
"RUF017", # Avoid quadratic list summation
"RUF022", # __all__ is not sorted
"RUF032", # Decimal() called with float literal argument
"RUF034", # Useless if-else condition
"RUF041", # Unnecessary nested Literal
"RUF100", # unused-noqa
"T10" # flake8-debugger
]
ignore = [
"E402", # Module level import not at top of file [TODO(sammy): We want to fix this]
"D417", # requires documentation for every function parameter.
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
"D105", # Missing docstring in magic method
"D106", # Missing docstring in public nested class
"D107" # Missing docstring in __init__
]
preview = true

[lint.isort]
known-first-party = ["daft_ext_template"]
known-third-party = ["daft"]
required-imports = ["from __future__ import annotations"]

[lint.per-file-ignores]
# Do not enforce usage and import order rules in init files
"__init__.py" = ["E402", "F401", "I"]

[lint.pydocstyle]
convention = "google"
17 changes: 17 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Resources

- https://docs.daft.ai for the user-facing API docs for Daft
- https://docs.daft.ai/en/stable/extensions/authoring/ for writing Daft extensions
- - https://docs.daft.ai/en/stable/api/udf/ for `@daft.func`, `@daft.cls`, and `@daft.udaf`


# Dev Workflow

1. Set up Python environment, install dependencies, and build dev package: `uv sync`
2. Activate .venv: `source .venv/bin/activate`
3. Run tests: `uv run pytest tests/ -v`

# PR Conventions

- Titles: Conventional Commits format; enforced by `.github/workflows/pr-labeller.yml`.
- Descriptions: follow `.github/pull_request_template.md`.
Loading
Loading