Skip to content
Open
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
4 changes: 2 additions & 2 deletions ci/bump_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

def run_command(
cmd: list[str], capture_output: bool = True
) -> subprocess.CompletedProcess:
) -> subprocess.CompletedProcess[str]:
"""Run a command and return the result."""
print(f"Running: {' '.join(cmd)}")
result = subprocess.run(cmd, capture_output=capture_output, text=True)
Expand All @@ -37,7 +37,7 @@ def get_current_version() -> str:
raise ValueError("Could not find current_version in .bumpversion.toml")


def main():
def main() -> None:
parser = argparse.ArgumentParser(
description="Bump version in Python project using bump-my-version"
)
Expand Down
6 changes: 4 additions & 2 deletions ci/calculate_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
from packaging import version


def calculate_next_version(current_version, release_type, channel):
def calculate_next_version(
current_version: str, release_type: str, channel: str
) -> str:
"""Calculate the next version based on release type and channel"""

# Parse current version
Expand Down Expand Up @@ -49,7 +51,7 @@ def calculate_next_version(current_version, release_type, channel):
return new_version


def main():
def main() -> None:
parser = argparse.ArgumentParser(description="Calculate next version")
parser.add_argument("--current", required=True, help="Current version")
parser.add_argument(
Expand Down
9 changes: 5 additions & 4 deletions ci/check_pylance_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
from collections.abc import Iterable, Sequence
from dataclasses import dataclass
from pathlib import Path
from typing import Any

try:
if sys.version_info >= (3, 11):
import tomllib
except ModuleNotFoundError:
import tomli as tomllib # type: ignore
else: # pragma: no cover - Python 3.10 fallback
import tomli as tomllib

LANCE_REPO = "lance-format/lance"

Expand Down Expand Up @@ -223,7 +224,7 @@ def determine_latest_tag(tags: Iterable[TagInfo]) -> TagInfo:
return max(tags, key=lambda tag: tag.semver)


def write_outputs(args: argparse.Namespace, payload: dict) -> None:
def write_outputs(args: argparse.Namespace, payload: dict[str, Any]) -> None:
target = getattr(args, "github_output", None)
if not target:
return
Expand Down
26 changes: 18 additions & 8 deletions ci/generate_release_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@
import urllib.error
import urllib.request
from datetime import datetime
from typing import Any, Optional

#: A parsed ``git log`` entry: sha / message / author / email.
Commit = dict[str, str]

def get_github_api_data(url, token):

def get_github_api_data(url: str, token: str) -> Optional[Any]:
"""Fetch data from GitHub API"""
headers = {
"Authorization": f"token {token}",
Expand All @@ -30,7 +34,7 @@ def get_github_api_data(url, token):
return None


def get_commits_since_last_tag(tag):
def get_commits_since_last_tag(tag: str) -> tuple[list[Commit], Optional[str]]:
"""Get all commits since the last tag"""
try:
# Get the previous tag
Expand Down Expand Up @@ -67,7 +71,7 @@ def get_commits_since_last_tag(tag):
if not commits:
return [], previous_tag

commit_list = []
commit_list: list[Commit] = []
for line in commits.split("\n"):
if line:
parts = line.split("|")
Expand All @@ -88,9 +92,9 @@ def get_commits_since_last_tag(tag):
return [], None


def categorize_commits(commits):
def categorize_commits(commits: list[Commit]) -> dict[str, list[Commit]]:
"""Categorize commits based on conventional commit format"""
categories = {
categories: dict[str, list[Commit]] = {
"Features": [],
"Bug Fixes": [],
"Performance": [],
Expand Down Expand Up @@ -129,7 +133,7 @@ def categorize_commits(commits):
return categories


def extract_pr_number(message):
def extract_pr_number(message: str) -> Optional[str]:
"""Extract PR number from commit message"""
# Look for patterns like (#123) or #123
match = re.search(r"#(\d+)", message)
Expand All @@ -138,7 +142,13 @@ def extract_pr_number(message):
return None


def generate_release_notes(tag, repo, token, commits, previous_tag):
def generate_release_notes(
tag: str,
repo: str,
token: Optional[str],
commits: list[Commit],
previous_tag: Optional[str],
) -> str:
"""Generate release notes in Markdown format"""

notes = []
Expand Down Expand Up @@ -223,7 +233,7 @@ def generate_release_notes(tag, repo, token, commits, previous_tag):
return "\n".join(notes)


def main():
def main() -> None:
parser = argparse.ArgumentParser(description="Generate release notes")
parser.add_argument("--tag", required=True, help="Release tag")
parser.add_argument("--repo", required=True, help="GitHub repository (owner/repo)")
Expand Down
Loading