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
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

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

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4

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

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"

- name: Run linter
run: ruff check src/ tests/

- name: Run tests
run: pytest tests/ -v
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,7 @@ htmlcov/
# Build output
dist/
build/

# Agent/workflow tracking
.agent/
.beads/
9 changes: 5 additions & 4 deletions src/tpuff/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
import click

from tpuff import __version__
from tpuff.commands.list import list_cmd
from tpuff.commands.search import search
from tpuff.commands.delete import delete
from tpuff.commands.edit import edit
from tpuff.commands.get import get
from tpuff.commands.export import export

from tpuff.commands.get import get
from tpuff.commands.list import list_cmd
from tpuff.commands.schema import schema
from tpuff.commands.search import search

# Context settings to enable -h as help alias for all commands
CONTEXT_SETTINGS = {"help_option_names": ["-h", "--help"]}
Expand All @@ -35,6 +35,7 @@ def cli(ctx: click.Context, debug: bool) -> None:
cli.add_command(get)
cli.add_command(export)
cli.add_command(export, name="metrics") # alias
cli.add_command(schema)


def main() -> None:
Expand Down
1 change: 0 additions & 1 deletion src/tpuff/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from tpuff.utils.debug import debug_log
from tpuff.utils.regions import DEFAULT_REGION


# Global client cache to avoid re-creating clients for the same region
_client_cache: dict[str, Turbopuffer] = {}

Expand Down
3 changes: 1 addition & 2 deletions src/tpuff/commands/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from tpuff.client import get_turbopuffer_client
from tpuff.utils.debug import debug_log


console = Console()


Expand Down Expand Up @@ -91,7 +90,7 @@ def delete(
console.print(f"[dim] - {ns.id}[/dim]")

console.print("\n[bold yellow]💀 This is your last chance to back out! 💀[/bold yellow]")
console.print(f"[dim]To confirm, please type: [bold red]yolo[/bold red][/dim]\n")
console.print("[dim]To confirm, please type: [bold red]yolo[/bold red][/dim]\n")

answer = prompt_user(">")

Expand Down
1 change: 0 additions & 1 deletion src/tpuff/commands/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from tpuff.client import get_namespace
from tpuff.utils.debug import debug_log


console = Console()


Expand Down
11 changes: 5 additions & 6 deletions src/tpuff/commands/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import threading
import time
from datetime import datetime
from http.server import HTTPServer, BaseHTTPRequestHandler
from http.server import BaseHTTPRequestHandler, HTTPServer
from typing import Any

import click
Expand All @@ -21,14 +21,13 @@
get_unindexed_bytes,
)
from tpuff.utils.metrics import (
PrometheusMetric,
MetricValue,
format_prometheus_metrics,
PrometheusMetric,
create_simple_gauge,
format_prometheus_metrics,
get_current_timestamp,
)


console = Console()


Expand Down Expand Up @@ -382,11 +381,11 @@ def shutdown_handler(signum: int, frame: Any) -> None:
console.print("[dim] Note: Recall estimation runs queries and incurs costs[/dim]")
else:
console.print("[dim] Recall: disabled (use --include-recall to enable)[/dim]")
console.print(f"\n[dim] Endpoints:[/dim]")
console.print("\n[dim] Endpoints:[/dim]")
console.print(f"[dim] http://localhost:{port}/metrics[/dim]")
console.print(f"[dim] http://localhost:{port}/health[/dim]")
console.print(f"[dim] http://localhost:{port}/[/dim]")
console.print(f"\n[dim] Press Ctrl+C to stop[/dim]\n")
console.print("\n[dim] Press Ctrl+C to stop[/dim]\n")

# Start server
try:
Expand Down
1 change: 0 additions & 1 deletion src/tpuff/commands/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from tpuff.client import get_namespace
from tpuff.utils.debug import debug_log


console = Console()


Expand Down
3 changes: 1 addition & 2 deletions src/tpuff/commands/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from rich.console import Console
from rich.table import Table

from tpuff.client import get_namespace, get_turbopuffer_client
from tpuff.client import get_namespace
from tpuff.utils.debug import debug_log
from tpuff.utils.metadata_fetcher import (
NamespaceWithMetadata,
Expand All @@ -17,7 +17,6 @@
get_unindexed_bytes,
)


console = Console()


Expand Down
Loading