Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ dependencies = [
"httpx>=0.27,<1.0",
"pydantic>=2.6,<3.0",
"pydantic-settings>=2.2,<3.0",
"requests>=2.33.0,<3.0",
"sqlalchemy>=2.0,<3.0",
"sse-starlette>=2.1,<4.0",
"uvicorn>=0.29,<1.0",
Expand Down Expand Up @@ -72,6 +71,9 @@ package = true
fallback_version = "0+unknown"
tag_regex = "^v?(?P<version>.+)$"

[tool.setuptools.package-data]
opencode_a2a = ["py.typed"]

[tool.mypy]
python_version = "3.11"
files = ["src/opencode_a2a"]
Expand Down
12 changes: 12 additions & 0 deletions scripts/smoke_test_built_cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ UV_TOOL_DIR="${tool_dir}" \
UV_TOOL_BIN_DIR="${tool_bin_dir}" \
uv tool install "${artifact_path}" --python "${python_bin}"

mapfile -t installed_python_paths < <(
find "${tool_dir}" \( -type f -o -type l \) -path '*/bin/python' | sort
)
if [[ "${#installed_python_paths[@]}" -ne 1 ]]; then
echo "Expected exactly one installed tool python, found ${#installed_python_paths[@]}" >&2
printf ' - %s\n' "${installed_python_paths[@]}" >&2 || true
exit 1
fi
installed_python="${installed_python_paths[0]}"

"${installed_python}" -c "import opencode_a2a; print(opencode_a2a.__version__)" >/dev/null

port="$(
"${python_bin}" - <<'PY'
import socket
Expand Down
3 changes: 3 additions & 0 deletions src/opencode_a2a/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
"""A2A wrapper for opencode."""

import logging
from importlib.metadata import PackageNotFoundError, version

UNKNOWN_VERSION = "0+unknown"
logger = logging.getLogger("opencode_a2a")
logger.addHandler(logging.NullHandler())


def get_package_version() -> str:
Expand Down
1 change: 1 addition & 0 deletions src/opencode_a2a/py.typed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

9 changes: 9 additions & 0 deletions tests/package/test_logging.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import logging

from opencode_a2a import logger


def test_package_logger_installs_null_handler() -> None:
handlers = logger.handlers

assert any(isinstance(handler, logging.NullHandler) for handler in handlers)
9 changes: 9 additions & 0 deletions tests/package/test_typing_contract.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from pathlib import Path

PYPROJECT_TEXT = Path("pyproject.toml").read_text()


def test_package_declares_py_typed_marker() -> None:
assert Path("src/opencode_a2a/py.typed").is_file()
assert "[tool.setuptools.package-data]" in PYPROJECT_TEXT
assert 'opencode_a2a = ["py.typed"]' in PYPROJECT_TEXT
7 changes: 7 additions & 0 deletions tests/scripts/test_script_health_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ def test_smoke_test_requires_explicit_wheel_selection_when_dist_is_ambiguous() -
assert 'uv tool install "${artifact_path}" --python "${python_bin}"' in SMOKE_TEST_TEXT


def test_smoke_test_imports_installed_package_before_health_check() -> None:
assert "find \"${tool_dir}\" \\( -type f -o -type l \\) -path '*/bin/python'" in SMOKE_TEST_TEXT
assert '"${installed_python}" -c "import opencode_a2a; print(opencode_a2a.__version__)"' in (
SMOKE_TEST_TEXT
)


def test_coverage_policy_tracks_overall_and_critical_file_thresholds() -> None:
assert "OVERALL_MINIMUM = 90.0" in COVERAGE_GATE_TEXT
assert '"src/opencode_a2a/execution/executor.py": 90.0' in COVERAGE_GATE_TEXT
Expand Down
2 changes: 0 additions & 2 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.