From c00a40bda7212fd77821c111a479c20ae5fd0f2e Mon Sep 17 00:00:00 2001 From: S2D2 Date: Tue, 10 Nov 2026 20:55:41 +0000 Subject: [PATCH 1/4] chore: clear out stale config and fix small doc and test gaps - release-please: drop the bump-*-pre-major flags, which only apply below 1.0 (the package is at 3.0.0). - gitleaks: drop the venv/ allowlist entry; .venv/ is the only virtualenv the repo uses and stays allowlisted. - pyproject: drop the E501 ignore for examples (no line is over 110), the py.typed coverage omit (coverage only measures .py files) and an exclude_lines that restated the default; add [project.urls] so the PyPI page links the repo, changelog and issues. - dev extra: add pydantic-ai-slim, as langchain-core already is, and turn the pydantic_ai importorskip calls into plain imports, so those tests fail on a dev-only install instead of silently skipping. - fetch_tools(mode=...) is typed ToolMode | None and documented. - MIGRATION.md: the 3.0 hand-built tool snippet gets its imports. - validate.sh: the header named a different ADK checkout than the default it uses. - dependabot.yaml: the npm comment said major-only, but the MCP SDK is ignored entirely. - Tools._warn_duplicate_names: the docstring said "once", but it also warns from each adapter, which tests pin deliberately. Co-Authored-By: Claude Opus 5.5 Co-authored-by: Guillaume Lebedel <10488548+glebedel@users.noreply.github.com> --- .github/dependabot.yaml | 4 ++-- .gitleaks.toml | 2 +- .release-please-config.json | 2 -- MIGRATION.md | 7 +++++++ pyproject.toml | 13 ++++++++----- scripts/validate.sh | 4 ++-- stackone_ai/tools.py | 3 ++- stackone_ai/toolset.py | 5 ++++- tests/test_fetch_tools.py | 2 -- tests/test_integrations_pydantic_ai.py | 17 +++++++---------- uv.lock | 2 ++ 11 files changed, 35 insertions(+), 26 deletions(-) diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml index 805323f2..2166fde7 100644 --- a/.github/dependabot.yaml +++ b/.github/dependabot.yaml @@ -24,8 +24,8 @@ updates: - minor - patch - # The mock server's Node dependencies. Deliberately major-only-blocked: the MCP SDK - # is pinned exactly, because a newer version rejects the mock's raw inputSchema. + # The mock server's Node dependencies. The MCP SDK is ignored entirely: it is pinned + # exactly, because a newer version rejects the mock's raw inputSchema. - package-ecosystem: npm directory: / schedule: diff --git a/.gitleaks.toml b/.gitleaks.toml index 9130d0c6..350e1cc8 100644 --- a/.gitleaks.toml +++ b/.gitleaks.toml @@ -6,4 +6,4 @@ useDefault = true [allowlist] description = "Global allowlist" -paths = ['''uv\.lock$''', '''venv/''', '''\.venv/''', '''\.ruff_cache/'''] +paths = ['''uv\.lock$''', '''\.venv/''', '''\.ruff_cache/'''] diff --git a/.release-please-config.json b/.release-please-config.json index 85dd2062..aa385610 100644 --- a/.release-please-config.json +++ b/.release-please-config.json @@ -1,8 +1,6 @@ { "release-type": "python", "changelog-path": "CHANGELOG.md", - "bump-minor-pre-major": true, - "bump-patch-for-minor-pre-major": true, "draft": false, "prerelease": false, "include-v-in-tag": true, diff --git a/MIGRATION.md b/MIGRATION.md index a626af11..4b689807 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -392,6 +392,13 @@ tool = StackOneTool( ) # 3.0 +import json + +import httpx + +from stackone_ai import ExecuteConfig, StackOneTool, ToolParameters + + class GetEmployee(StackOneTool): def __init__(self) -> None: super().__init__( diff --git a/pyproject.toml b/pyproject.toml index 9defced4..8c7f694e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,6 +23,11 @@ dependencies = [ "mcp>=1.24.3,<2.0.0", ] +[project.urls] +Repository = "https://github.com/StackOneHQ/stackone-ai-python" +Changelog = "https://github.com/StackOneHQ/stackone-ai-python/blob/main/CHANGELOG.md" +Issues = "https://github.com/StackOneHQ/stackone-ai-python/issues" + [build-system] requires = ["hatchling"] build-backend = "hatchling.build" @@ -50,6 +55,7 @@ examples = [ dev = [ "hypothesis>=6.141.1", "langchain-core>=0.3.36", + "pydantic-ai-slim>=1.83.0", "pytest>=8.3.4", "pytest-asyncio>=0.25.3", "pytest-cov>=6.0.0", @@ -63,7 +69,7 @@ asyncio_mode = "strict" asyncio_default_fixture_loop_scope = "function" [tool.ruff.lint.per-file-ignores] -"examples/**.py" = ["E501", "F841", "E402"] +"examples/**.py" = ["F841", "E402"] [tool.ruff] line-length = 110 @@ -83,10 +89,7 @@ select = [ [tool.coverage.run] source = ["stackone_ai"] branch = true -omit = ["stackone_ai/__init__.py", "**/py.typed"] - -[tool.coverage.report] -exclude_lines = ["pragma: no cover"] +omit = ["stackone_ai/__init__.py"] [tool.coverage.json] output = "coverage/coverage.json" diff --git a/scripts/validate.sh b/scripts/validate.sh index 4732adfb..5f3b38bc 100755 --- a/scripts/validate.sh +++ b/scripts/validate.sh @@ -4,8 +4,8 @@ # ./scripts/validate.sh # all sections # ./scripts/validate.sh examples # one of: examples | conformance | sdk | pydantic | adk # -# Sibling repo locations can be overridden: -# CONFORMANCE=/path/to/sdk-conformance ADK=/path/to/stackone-adk-plugin ./scripts/validate.sh +# Sibling repo locations default to ../sdk-conformance and ../adk-26-ci, and can be overridden: +# CONFORMANCE=/path/to/sdk-conformance ADK=/path/to/adk-checkout ./scripts/validate.sh # # Everything here runs against the sdk-conformance mock API on 127.0.0.1 with a # dummy key. Nothing touches the live StackOne API, so results are deterministic diff --git a/stackone_ai/tools.py b/stackone_ai/tools.py index 486b6aad..749d27a8 100644 --- a/stackone_ai/tools.py +++ b/stackone_ai/tools.py @@ -1655,7 +1655,8 @@ def __init__(self, tools: list[StackOneTool]) -> None: self._warn_duplicate_names() def _warn_duplicate_names(self) -> None: - """Warn once if more than one tool has the same name.""" + """Warn if more than one tool has the same name: at construction, and again from each + adapter, which offers only the first of each name.""" if len(self._tool_map) == len(self.tools): return counts = Counter(tool.name for tool in self.tools) diff --git a/stackone_ai/toolset.py b/stackone_ai/toolset.py index 07806590..1dd12f3c 100644 --- a/stackone_ai/toolset.py +++ b/stackone_ai/toolset.py @@ -311,7 +311,7 @@ def fetch_tools( account_ids: list[str] | None = None, providers: list[str] | None = None, actions: list[str] | None = None, - mode: Any = _UNSET, + mode: ToolMode | None = _UNSET, # ty: ignore[invalid-parameter-default] ) -> Tools: """Fetch tools with optional filtering by account IDs, providers, and actions @@ -326,6 +326,9 @@ def fetch_tools( needed. No matching account means no tools. actions: Optional list of action patterns with glob support (e.g., ['*_list_employees', 'hibob_create_employees']) + mode: ``tool_mode`` for this call only. ``None`` lists one tool per action, + even on a toolset built with ``tool_mode="search_execute"``. Defaults to the + toolset's ``tool_mode``. Returns: Collection of tools matching the filter criteria diff --git a/tests/test_fetch_tools.py b/tests/test_fetch_tools.py index e8492700..9cd72b49 100644 --- a/tests/test_fetch_tools.py +++ b/tests/test_fetch_tools.py @@ -380,7 +380,6 @@ def test_langchain(self, monkeypatch, served, expected): @pytest.mark.parametrize(("served", "expected"), _SERVED_REQUIRED_CASES) def test_pydantic_ai(self, monkeypatch, served, expected): - pytest.importorskip("pydantic_ai") schema = self._tool(monkeypatch, served).to_pydantic_ai_tool().function_schema.json_schema assert schema.get("required") == expected if expected is None: @@ -2049,7 +2048,6 @@ def test_langchain_does_not_forward_unsupplied_optionals_as_null(self, monkeypat assert seen["args"] == {"path_id": "x"} def test_pydantic_ai_raises_model_retry(self, monkeypatch): - pytest.importorskip("pydantic_ai") from pydantic_ai.exceptions import ModelRetry from stackone_ai.tools import StackOneMcpTool diff --git a/tests/test_integrations_pydantic_ai.py b/tests/test_integrations_pydantic_ai.py index 3bdc1cdd..89579e19 100644 --- a/tests/test_integrations_pydantic_ai.py +++ b/tests/test_integrations_pydantic_ai.py @@ -8,23 +8,20 @@ from unittest.mock import MagicMock, patch import pytest - -pytest.importorskip("pydantic_ai", reason="pydantic-ai not installed") - -from pydantic_ai import Agent # noqa: E402 -from pydantic_ai.messages import ( # noqa: E402 +from pydantic_ai import Agent +from pydantic_ai.messages import ( ModelMessage, ModelResponse, TextPart, ToolCallPart, ToolReturnPart, ) -from pydantic_ai.models.function import AgentInfo, FunctionModel # noqa: E402 -from pydantic_ai.tools import Tool # noqa: E402 +from pydantic_ai.models.function import AgentInfo, FunctionModel +from pydantic_ai.tools import Tool -from stackone_ai import StackOneToolSet # noqa: E402 -from stackone_ai.tools import StackOneTool, Tools # noqa: E402 -from stackone_ai.types import ExecuteConfig, ToolParameters # noqa: E402 +from stackone_ai import StackOneToolSet +from stackone_ai.tools import StackOneTool, Tools +from stackone_ai.types import ExecuteConfig, ToolParameters @pytest.fixture diff --git a/uv.lock b/uv.lock index 4607ff56..afd54fc6 100644 --- a/uv.lock +++ b/uv.lock @@ -3343,6 +3343,7 @@ dependencies = [ dev = [ { name = "hypothesis" }, { name = "langchain-core" }, + { name = "pydantic-ai-slim" }, { name = "pytest" }, { name = "pytest-asyncio" }, { name = "pytest-cov" }, @@ -3375,6 +3376,7 @@ requires-dist = [ { name = "openai", marker = "extra == 'examples'", specifier = ">=2.32.0" }, { name = "pydantic", specifier = ">=2.10.6" }, { name = "pydantic-ai", marker = "extra == 'examples'", specifier = ">=1.83.0" }, + { name = "pydantic-ai-slim", marker = "extra == 'dev'", specifier = ">=1.83.0" }, { name = "pydantic-ai-slim", marker = "extra == 'pydantic-ai'", specifier = ">=1.83.0" }, { name = "pytest", marker = "extra == 'dev'", specifier = ">=8.3.4" }, { name = "pytest-asyncio", marker = "extra == 'dev'", specifier = ">=0.25.3" }, From 7a95bc9f60109349fe4b0703c261b55e8a1beb4b Mon Sep 17 00:00:00 2001 From: S2D2 Date: Wed, 11 Nov 2026 00:35:56 +0000 Subject: [PATCH 2/4] chore: type the fetch_tools mode sentinel and drop dead ruff ignores - fetch_tools(mode=...): the default is now a one-member enum, so the annotation states the sentinel instead of hiding it behind a ty ignore, and ty narrows it away after the default is resolved. - pyproject: examples pass ruff with no per-file ignores, so the remaining F841 and E402 entries go with E501. - Tools._warn_duplicate_names: the docstring repeated what _first_per_name already says about adapters; it now states only that it warns on every call. Co-Authored-By: Claude Opus 5.5 Co-authored-by: Guillaume Lebedel <10488548+glebedel@users.noreply.github.com> --- pyproject.toml | 3 --- stackone_ai/tools.py | 3 +-- stackone_ai/toolset.py | 12 +++++++++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8c7f694e..7aa2d70e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -68,9 +68,6 @@ testpaths = ["tests"] asyncio_mode = "strict" asyncio_default_fixture_loop_scope = "function" -[tool.ruff.lint.per-file-ignores] -"examples/**.py" = ["F841", "E402"] - [tool.ruff] line-length = 110 target-version = "py311" diff --git a/stackone_ai/tools.py b/stackone_ai/tools.py index 749d27a8..506ef596 100644 --- a/stackone_ai/tools.py +++ b/stackone_ai/tools.py @@ -1655,8 +1655,7 @@ def __init__(self, tools: list[StackOneTool]) -> None: self._warn_duplicate_names() def _warn_duplicate_names(self) -> None: - """Warn if more than one tool has the same name: at construction, and again from each - adapter, which offers only the first of each name.""" + """Warn, on every call, if more than one tool has the same name.""" if len(self._tool_map) == len(self.tools): return counts = Counter(tool.name for tool in self.tools) diff --git a/stackone_ai/toolset.py b/stackone_ai/toolset.py index 1dd12f3c..e1fbcd8d 100644 --- a/stackone_ai/toolset.py +++ b/stackone_ai/toolset.py @@ -5,6 +5,7 @@ import concurrent.futures import contextlib import copy +import enum import fnmatch import functools import logging @@ -13,7 +14,7 @@ import time from collections.abc import Callable, Sequence from dataclasses import dataclass, field -from typing import Any, TypeVar +from typing import Any, Literal, TypeVar from urllib.parse import urlencode import httpx @@ -58,7 +59,12 @@ logger = logging.getLogger("stackone.tools") -_UNSET = object() + +class _Unset(enum.Enum): + UNSET = enum.auto() + + +_UNSET = _Unset.UNSET """Sentinel: `mode=None` is a real mode (individual), so it cannot mean "use the default".""" _Listing = tuple[McpToolDefinition, str | None, str] @@ -311,7 +317,7 @@ def fetch_tools( account_ids: list[str] | None = None, providers: list[str] | None = None, actions: list[str] | None = None, - mode: ToolMode | None = _UNSET, # ty: ignore[invalid-parameter-default] + mode: ToolMode | None | Literal[_Unset.UNSET] = _UNSET, ) -> Tools: """Fetch tools with optional filtering by account IDs, providers, and actions From d4f8132213f15f6c62e38e608ddd90d03d88e1aa Mon Sep 17 00:00:00 2001 From: S2D2 Date: Wed, 11 Nov 2026 00:38:47 +0000 Subject: [PATCH 3/4] chore: keep the public fetch_tools mode annotation free of a private type The typed sentinel put a private enum into the public signature (`ToolMode | None | Literal[_Unset.UNSET]`), which IDEs and help() show to every caller. `ToolMode | None` with one inline ty ignore on the default states the public contract more plainly. Co-Authored-By: Claude Opus 5.5 Co-authored-by: Guillaume Lebedel <10488548+glebedel@users.noreply.github.com> --- stackone_ai/toolset.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/stackone_ai/toolset.py b/stackone_ai/toolset.py index e1fbcd8d..1dd12f3c 100644 --- a/stackone_ai/toolset.py +++ b/stackone_ai/toolset.py @@ -5,7 +5,6 @@ import concurrent.futures import contextlib import copy -import enum import fnmatch import functools import logging @@ -14,7 +13,7 @@ import time from collections.abc import Callable, Sequence from dataclasses import dataclass, field -from typing import Any, Literal, TypeVar +from typing import Any, TypeVar from urllib.parse import urlencode import httpx @@ -59,12 +58,7 @@ logger = logging.getLogger("stackone.tools") - -class _Unset(enum.Enum): - UNSET = enum.auto() - - -_UNSET = _Unset.UNSET +_UNSET = object() """Sentinel: `mode=None` is a real mode (individual), so it cannot mean "use the default".""" _Listing = tuple[McpToolDefinition, str | None, str] @@ -317,7 +311,7 @@ def fetch_tools( account_ids: list[str] | None = None, providers: list[str] | None = None, actions: list[str] | None = None, - mode: ToolMode | None | Literal[_Unset.UNSET] = _UNSET, + mode: ToolMode | None = _UNSET, # ty: ignore[invalid-parameter-default] ) -> Tools: """Fetch tools with optional filtering by account IDs, providers, and actions From 04572bcb338dbf8282e4e4aa60a59ee09fceddc4 Mon Sep 17 00:00:00 2001 From: S2D2 Date: Wed, 11 Nov 2026 09:55:52 +0000 Subject: [PATCH 4/4] docs(tools): keep the warn-once docstring on _warn_duplicate_names The duplicate-names warning moves to construction only in the warn-once change, so this PR leaves the original docstring as it is. Co-Authored-By: Claude Opus 5.5 Co-authored-by: Guillaume Lebedel <10488548+glebedel@users.noreply.github.com> --- stackone_ai/tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stackone_ai/tools.py b/stackone_ai/tools.py index 506ef596..486b6aad 100644 --- a/stackone_ai/tools.py +++ b/stackone_ai/tools.py @@ -1655,7 +1655,7 @@ def __init__(self, tools: list[StackOneTool]) -> None: self._warn_duplicate_names() def _warn_duplicate_names(self) -> None: - """Warn, on every call, if more than one tool has the same name.""" + """Warn once if more than one tool has the same name.""" if len(self._tool_map) == len(self.tools): return counts = Counter(tool.name for tool in self.tools)