diff --git a/README.md b/README.md index b27a201..a42af87 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # skilldiff -[![CI](https://github.com/shunvel/skilldiff/actions/workflows/ci.yml/badge.svg)](https://github.com/shunvel/skilldiff/actions/workflows/ci.yml) -[![PyPI version](https://img.shields.io/pypi/v/skilldiff.svg)](https://pypi.org/project/skilldiff/) -[![Python versions](https://img.shields.io/pypi/pyversions/skilldiff.svg)](https://pypi.org/project/skilldiff/) +[![CI](https://github.com/shunvel/skilldiff/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/shunvel/skilldiff/actions/workflows/ci.yml?query=branch%3Amain) +[![PyPI version](https://img.shields.io/pypi/v/skilldiff.svg?logo=pypi&label=PyPI)](https://pypi.org/project/skilldiff/) +[![Python versions](https://img.shields.io/pypi/pyversions/skilldiff.svg?logo=python&label=python)](https://pypi.org/project/skilldiff/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) Adding a tool, rewriting a skill, or swapping a system prompt is cheap. Knowing whether the agent got *better* is not. Offline evals score a final answer. They miss the trajectory: extra tool hops, silent regressions, and “it still printed the right string” failures. diff --git a/pyproject.toml b/pyproject.toml index 8b52668..40f8e0e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,6 +57,7 @@ packages = ["skilldiff"] testpaths = ["tests"] asyncio_mode = "auto" addopts = "-q" +pythonpath = ["."] [tool.ruff] line-length = 120 @@ -69,4 +70,9 @@ select = ["E", "F", "I", "W"] python_version = "3.10" packages = ["skilldiff"] ignore_missing_imports = true -warn_unused_ignores = true +warn_unused_ignores = false + +[[tool.mypy.overrides]] +module = ["google.*", "google.genai.*"] +ignore_missing_imports = true +ignore_errors = true diff --git a/skilldiff/tools_schema.py b/skilldiff/tools_schema.py index dca4441..40e638c 100644 --- a/skilldiff/tools_schema.py +++ b/skilldiff/tools_schema.py @@ -53,6 +53,7 @@ def load_tools_from_script(script_path: Path) -> dict[str, Callable[..., Any]]: raise ImportError(f"Unable to load tool script: {script_path}") module = importlib.util.module_from_spec(spec) + sys.modules[module_name] = module parent_dir = str(script_path.parent.resolve()) if parent_dir not in sys.path: sys.path.insert(0, parent_dir) diff --git a/tests/test_http_utils.py b/tests/test_http_utils.py index 35d0c55..1ed850d 100644 --- a/tests/test_http_utils.py +++ b/tests/test_http_utils.py @@ -1,22 +1,26 @@ """Tests for example HTTP helpers.""" +import sys +from pathlib import Path from unittest.mock import MagicMock, patch -from examples.http_utils import fetch_url_text +from skilldiff.tools_schema import load_tools_from_script def test_fetch_url_text_uses_certifi_context() -> None: + tools = load_tools_from_script(Path("examples/http_utils.py")) + fetch_url_text = tools["fetch_url_text"] + module = sys.modules[fetch_url_text.__module__] + html = b"Example Domain" mock_response = MagicMock() mock_response.read.return_value = html mock_response.__enter__.return_value = mock_response mock_response.__exit__.return_value = False - with ( - patch("examples.http_utils.urlopen", return_value=mock_response) as mocked_open, - patch("examples.http_utils.ssl.create_default_context") as mocked_ssl, - ): - result = fetch_url_text("https://example.com") + with patch.object(module, "urlopen", return_value=mock_response) as mocked_open: + with patch.object(module.ssl, "create_default_context") as mocked_ssl: + result = fetch_url_text("https://example.com") assert "Example Domain" in result mocked_open.assert_called_once()