From e694b2a3332ad7af780b45de2a028dab194f14c2 Mon Sep 17 00:00:00 2001 From: shunvel Date: Mon, 17 Aug 2026 15:36:04 +0530 Subject: [PATCH] Fix README badges and CI signal on main. Pin the CI badge to main, point PyPI shields at the published package, and register dynamically loaded tool modules so tests import cleanly. Co-authored-by: Cursor --- README.md | 6 +++--- pyproject.toml | 8 +++++++- skilldiff/tools_schema.py | 1 + tests/test_http_utils.py | 16 ++++++++++------ 4 files changed, 21 insertions(+), 10 deletions(-) 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()