diff --git a/.gitleaks.toml b/.gitleaks.toml index 9130d0c..350e1cc 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 85dd206..aa38561 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 2c4d789..07c279b 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -395,6 +395,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 06ee744..ab9154d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,6 +24,11 @@ dependencies = [ "mcp>=1.30.0,<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>=1.27"] build-backend = "hatchling.build" @@ -51,6 +56,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,9 +69,6 @@ testpaths = ["tests"] asyncio_mode = "strict" asyncio_default_fixture_loop_scope = "function" -[tool.ruff.lint.per-file-ignores] -"examples/**.py" = ["E501", "F841", "E402"] - [tool.ruff] line-length = 110 target-version = "py311" @@ -86,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 4732adf..5f3b38b 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/toolset.py b/stackone_ai/toolset.py index c535376..e35c9f5 100644 --- a/stackone_ai/toolset.py +++ b/stackone_ai/toolset.py @@ -310,7 +310,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 @@ -325,6 +325,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 e849270..9cd72b4 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 730757d..c1f8c0d 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 47c36f3..7046981 100644 --- a/uv.lock +++ b/uv.lock @@ -3530,6 +3530,7 @@ dependencies = [ dev = [ { name = "hypothesis" }, { name = "langchain-core" }, + { name = "pydantic-ai-slim" }, { name = "pytest" }, { name = "pytest-asyncio" }, { name = "pytest-cov" }, @@ -3562,6 +3563,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" },