diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 4f4ac0c..0000000 --- a/.dockerignore +++ /dev/null @@ -1,16 +0,0 @@ -.git -.github -.gitignore -*.md -!README.md -.env -.env.* -Dockerfile -.dockerignore -docs/ -deploy/ -api/ -tests/ -__pycache__/ -*.pyc -.venv/ diff --git a/.editorconfig b/.editorconfig index 39f1a41..43e5869 100644 --- a/.editorconfig +++ b/.editorconfig @@ -54,10 +54,6 @@ indent_size = 4 [{Makefile,*.mk}] indent_style = tab -# Dockerfiles. -[Dockerfile*] -indent_size = 4 - # GitHub Actions workflows — 2 spaces. [.github/**/*.{yml,yaml}] indent_size = 2 diff --git a/.gitattributes b/.gitattributes index 3342e8f..30e2328 100644 --- a/.gitattributes +++ b/.gitattributes @@ -31,8 +31,6 @@ # --- Build / packaging ---------------------------------------------------- Makefile text eol=lf *.mk text eol=lf -Dockerfile* text eol=lf -docker-compose*.yml text eol=lf .github/**/*.yml text eol=lf .github/**/*.yaml text eol=lf diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index 31bd212..0000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Docker - -on: - push: - branches: [main] - tags: ["v*"] - pull_request: - branches: [main] - paths: - - "Dockerfile" - - "src/**" - - "pyproject.toml" - -permissions: - contents: read - packages: write - -env: - REGISTRY: ghcr.io - IMAGE_NAME: graycodeai/hawk-sdk-python - -jobs: - build-and-push: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Log in to GHCR - if: github.event_name != 'pull_request' - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Docker metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=ref,event=branch - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=sha,prefix=sha- - - - name: Build and push - uses: docker/build-push-action@v6 - with: - context: . - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index ccb20da..0000000 --- a/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -FROM python:3.12-slim AS builder - -WORKDIR /build -COPY pyproject.toml VERSION README.md ./ -RUN pip install --no-cache-dir build - -COPY src/ src/ -RUN python -m build --wheel - -FROM python:3.12-slim -RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates tini && \ - rm -rf /var/lib/apt/lists/* && \ - adduser --disabled-password --gecos "" --uid 1000 hawk - -COPY --from=builder /build/dist/*.whl /tmp/ -RUN pip install --no-cache-dir /tmp/*.whl && rm -rf /tmp/*.whl - -USER hawk -WORKDIR /workspace -ENTRYPOINT ["tini", "--"] -CMD ["sleep", "infinity"] diff --git a/Makefile b/Makefile index 3428fc9..5d1765b 100644 --- a/Makefile +++ b/Makefile @@ -48,7 +48,7 @@ test: ## Run unit tests. test-race: test ## Alias for `test` (Python has no race detector). cover: ## Run tests with coverage report. - $(PYTHON) -m pytest --cov=src --cov-report=term-missing --cov-report=html + $(PYTHON) -m pytest --cov=hawk --cov-report=term-missing --cov-report=html @echo "Coverage report: htmlcov/index.html" bench: ## Run benchmarks (requires pytest-benchmark). diff --git a/README.md b/README.md index 07fb615..50d32a3 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Official Python client for the Hawk daemon API
diff --git a/deploy/docker/docker-compose.yml b/deploy/docker/docker-compose.yml deleted file mode 100644 index d215dee..0000000 --- a/deploy/docker/docker-compose.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: hawk-sdk-python - -services: - hawk-sdk-python: - build: - context: ../../ - dockerfile: Dockerfile - image: ghcr.io/graycodeai/hawk-sdk-python:dev - env_file: - - path: ../../.env.example - required: false diff --git a/docs/architecture.md b/docs/architecture.md index 8f52b50..b75f214 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -4,7 +4,7 @@ **Python SDK for the Hawk Daemon API** -[](https://python.org/) +[](https://python.org/) []() diff --git a/tests/test_evaluate.py b/tests/test_evaluate.py index 58acae4..fa5f8c0 100644 --- a/tests/test_evaluate.py +++ b/tests/test_evaluate.py @@ -237,6 +237,7 @@ class TestRunBenchmarkAsync: async def test_single_task(self) -> None: agent = AsyncMock() + agent.reset = MagicMock() # reset is sync; AsyncMock would leak a coroutine resp = MagicMock() resp.response = "ok" resp.tokens_in = 10 @@ -251,6 +252,7 @@ async def test_single_task(self) -> None: async def test_multiple_runs(self) -> None: agent = AsyncMock() + agent.reset = MagicMock() # reset is sync; AsyncMock would leak a coroutine resp = MagicMock() resp.response = "ok" resp.tokens_in = 10 @@ -264,6 +266,7 @@ async def test_multiple_runs(self) -> None: async def test_validation_fail(self) -> None: agent = AsyncMock() + agent.reset = MagicMock() # reset is sync; AsyncMock would leak a coroutine resp = MagicMock() resp.response = "no match" resp.tokens_in = 10 @@ -283,6 +286,7 @@ async def test_validation_fail(self) -> None: async def test_agent_exception(self) -> None: agent = AsyncMock() + agent.reset = MagicMock() # reset is sync; AsyncMock would leak a coroutine agent.chat.side_effect = RuntimeError("async crash") tasks = [EvalTask(name="t1", prompt="hello")] results = await run_benchmark_async(agent, tasks) diff --git a/tests/test_streaming.py b/tests/test_streaming.py index 0947809..60d6605 100644 --- a/tests/test_streaming.py +++ b/tests/test_streaming.py @@ -3,7 +3,7 @@ from __future__ import annotations import json -from unittest.mock import MagicMock +from unittest.mock import AsyncMock, MagicMock import httpx import pytest @@ -149,7 +149,7 @@ async def _aiter_lines(): yield line response.aiter_lines.return_value = _aiter_lines() - response.aclose = MagicMock(return_value=_async_noop()) + response.aclose = AsyncMock() reader = AsyncStreamReader(response) events = [] @@ -175,7 +175,7 @@ async def _aiter_lines(): yield line response.aiter_lines.return_value = _aiter_lines() - response.aclose = MagicMock(return_value=_async_noop()) + response.aclose = AsyncMock() reader = AsyncStreamReader(response) events = [] @@ -203,13 +203,9 @@ async def _aiter_lines(): yield line response.aiter_lines.return_value = _aiter_lines() - response.aclose = MagicMock(return_value=_async_noop()) + response.aclose = AsyncMock() reader = AsyncStreamReader(response) text = await reader.collect_text() assert text == "Async text" - - -async def _async_noop() -> None: - pass