Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b56a001
feat: add custom auth headers, bearer token support, and URL fallback…
bokelley Nov 5, 2025
ef9f2b5
feat: add streamable HTTP transport and fix A2A agent card endpoint
bokelley Nov 5, 2025
eb9d0cd
docs: comprehensive research findings and protocol analysis
bokelley Nov 5, 2025
cb6958f
feat: add streamable_http transport with SSE as safe default
bokelley Nov 6, 2025
06b99eb
feat: make streamable_http the default (matches JS client)
bokelley Nov 6, 2025
59564aa
feat: add list_tools/call_tool methods and improve async cleanup
bokelley Nov 6, 2025
b3d262c
fix: address critical code review issues
bokelley Nov 6, 2025
ecf5cf0
feat: add comprehensive logging and exception hierarchy
bokelley Nov 6, 2025
670c09e
feat: export exception hierarchy in public API
bokelley Nov 6, 2025
343960b
feat: add critical infrastructure improvements
bokelley Nov 6, 2025
6b9889a
feat: add configuration validation and improved error messages
bokelley Nov 6, 2025
e8db750
feat: rewrite CLI to match JavaScript version exactly
bokelley Nov 6, 2025
eb2c660
feat: add schema auto-generation from AdCP spec
bokelley Nov 6, 2025
1bf0761
feat: add CI/CD workflows with schema validation
bokelley Nov 6, 2025
ebdb665
fix: handle stdin gracefully in CLI
bokelley Nov 6, 2025
5d2d1a8
fix: resolve all blocker and high priority issues from code review
bokelley Nov 6, 2025
1365001
feat: integrate typed requests and responses into all client methods
bokelley Nov 6, 2025
3aa18a5
refactor: remove legacy kwargs API, require typed requests
bokelley Nov 6, 2025
38a5174
fix: resolve all linter errors for CI
bokelley Nov 6, 2025
a9b51d0
fix: escape quotes and newlines in generated model descriptions
bokelley Nov 6, 2025
8f8a2c7
feat: comprehensive infrastructure improvements to prevent CI failures
bokelley Nov 6, 2025
5bbc719
fix: resolve all mypy type checking errors
bokelley Nov 6, 2025
ca7fd7b
fix: resolve test failure and MCP type issues
bokelley Nov 6, 2025
1d09f2f
fix: use TYPE_CHECKING for optional MCP imports
bokelley Nov 6, 2025
d6aea78
fix: add type: ignore for MCP session return values
bokelley Nov 6, 2025
15b9373
fix: correct type ignore error code for MCP session returns
bokelley Nov 6, 2025
d20704d
fix: resolve all remaining CI test failures
bokelley Nov 6, 2025
adb2dd6
fix: correct PyPI API token secret name in release workflow
bokelley Nov 6, 2025
d3ba48b
revert: restore correct PYPY_API_TOKEN secret name
bokelley Nov 6, 2025
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
93 changes: 93 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: CI

on:
push:
branches: [main, python-adcp-sdk-setup]
pull_request:
branches: [main]

jobs:
test:
name: Test Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"

- name: Run linter
run: |
ruff check src/

- name: Run type checker
run: |
mypy src/adcp/

- name: Run tests
run: |
pytest tests/ -v --cov=src/adcp --cov-report=term-missing

schema-check:
name: Validate schemas are up-to-date
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"

- name: Download latest schemas
run: python scripts/sync_schemas.py

- name: Fix schema references
run: python scripts/fix_schema_refs.py

- name: Generate models
run: python scripts/generate_models_simple.py

- name: Validate generated code syntax
run: |
echo "Validating generated code can be parsed..."
python -m py_compile src/adcp/types/generated.py
echo "✓ Syntax validation passed"

- name: Validate generated code imports
run: |
echo "Validating generated code can be imported..."
python -c "from adcp.types import generated; print(f'✓ Successfully imported {len(dir(generated))} symbols')"

- name: Run code generation tests
run: |
echo "Running code generation test suite..."
pytest tests/test_code_generation.py -v --tb=short

- name: Check for schema drift
run: |
if git diff --exit-code src/adcp/types/generated.py schemas/cache/; then
echo "✓ Schemas are up-to-date"
else
echo "✗ Schemas are out of date!"
echo "Run: make regenerate-schemas"
git diff src/adcp/types/generated.py
exit 1
fi
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Release

on:
push:
tags:
- "v*"

jobs:
release:
name: Build and publish to PyPI
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine

- name: Build package
run: python -m build

- name: Check package
run: twine check dist/*

- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload dist/*
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,4 @@ Thumbs.db

# Environment variables
.env
uv.lock
75 changes: 75 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Pre-commit hooks for AdCP Python client
# See https://pre-commit.com for more information
# Installation: pip install pre-commit && pre-commit install

repos:
# Black code formatting
- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black
language_version: python3.10
args: [--line-length=100]

# Ruff linting
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
exclude: ^src/adcp/types/generated\.py$

# Mypy type checking
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.14.0
hooks:
- id: mypy
additional_dependencies:
- pydantic>=2.0.0
- types-requests
args: [--config-file=pyproject.toml]
files: ^src/adcp/
exclude: ^src/adcp/types/generated\.py$

# Basic file checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
exclude: ^schemas/
- id: end-of-file-fixer
exclude: ^schemas/
- id: check-yaml
- id: check-json
exclude: ^schemas/
- id: check-added-large-files
args: [--maxkb=1000]
- id: check-merge-conflict
- id: check-case-conflict
- id: detect-private-key

# Validate generated code after schema changes
- repo: local
hooks:
- id: validate-generated-code
name: Validate generated Pydantic models
entry: python -m py_compile
language: system
files: ^src/adcp/types/generated\.py$
pass_filenames: true
description: Ensures generated code is syntactically valid Python

- id: test-code-generation
name: Test code generator
entry: pytest tests/test_code_generation.py -v --tb=short
language: system
files: ^scripts/generate_models_simple\.py$
pass_filenames: false
description: Run code generation tests when generator changes

# Configuration
default_language_version:
python: python3.10

# Run hooks on all files during manual runs
fail_fast: false
113 changes: 113 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
.PHONY: help format lint typecheck test regenerate-schemas pre-push ci-local clean install-dev

# Detect Python and use venv if available
PYTHON := $(shell if [ -f .venv/bin/python ]; then echo .venv/bin/python; else echo python3; fi)
PIP := $(shell if [ -f .venv/bin/pip ]; then echo .venv/bin/pip; else echo pip3; fi)
PYTEST := $(shell if [ -f .venv/bin/pytest ]; then echo .venv/bin/pytest; else echo pytest; fi)
BLACK := $(shell if [ -f .venv/bin/black ]; then echo .venv/bin/black; else echo black; fi)
RUFF := $(shell if [ -f .venv/bin/ruff ]; then echo .venv/bin/ruff; else echo ruff; fi)
MYPY := $(shell if [ -f .venv/bin/mypy ]; then echo .venv/bin/mypy; else echo mypy; fi)

help: ## Show this help message
@echo 'Usage: make [target]'
@echo ''
@echo 'Available targets:'
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'

install-dev: ## Install package in development mode with dev dependencies
$(PIP) install -e ".[dev]"

format: ## Format code with black
$(BLACK) src/ tests/ scripts/
@echo "✓ Code formatted successfully"

lint: ## Run linter (ruff) on source code
$(RUFF) check src/ tests/
@echo "✓ Linting passed"

typecheck: ## Run type checker (mypy) on source code
$(MYPY) src/adcp/
@echo "✓ Type checking passed"

test: ## Run test suite with coverage
$(PYTEST) tests/ -v --cov=src/adcp --cov-report=term-missing
@echo "✓ All tests passed"

test-fast: ## Run tests without coverage (faster)
$(PYTEST) tests/ -v
@echo "✓ All tests passed"

test-generation: ## Run only code generation tests
$(PYTEST) tests/test_code_generation.py -v
@echo "✓ Code generation tests passed"

regenerate-schemas: ## Download latest schemas and regenerate models
@echo "Downloading latest schemas..."
$(PYTHON) scripts/sync_schemas.py
@echo "Fixing schema references..."
$(PYTHON) scripts/fix_schema_refs.py
@echo "Generating Pydantic models..."
$(PYTHON) scripts/generate_models_simple.py
@echo "✓ Schemas regenerated successfully"

validate-generated: ## Validate generated code (syntax and imports)
@echo "Validating generated code..."
@$(PYTHON) -m py_compile src/adcp/types/generated.py
@echo "✓ Generated code validation passed"

pre-push: format lint typecheck test validate-generated ## Run all checks before pushing (format, lint, typecheck, test, validate)
@echo ""
@echo "================================"
@echo "✓ All pre-push checks passed!"
@echo "================================"
@echo ""
@echo "Safe to push to remote."

ci-local: lint typecheck test validate-generated ## Run CI checks locally (without formatting)
@echo ""
@echo "================================"
@echo "✓ All CI checks passed!"
@echo "================================"

clean: ## Clean generated files and caches
rm -rf build/
rm -rf dist/
rm -rf *.egg-info
rm -rf .pytest_cache/
rm -rf .mypy_cache/
rm -rf .ruff_cache/
rm -rf .coverage
rm -rf htmlcov/
find . -type d -name __pycache__ -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
@echo "✓ Cleaned all generated files and caches"

build: ## Build distribution packages
python -m build
@echo "✓ Distribution packages built"

# Development workflow commands

quick-check: lint test-fast ## Quick check (lint + fast tests) for rapid iteration
@echo "✓ Quick check passed"

full-check: pre-push ## Alias for pre-push (full check before committing)

# Schema workflow

check-schema-drift: ## Check if schemas are out of sync with upstream
@echo "Checking for schema drift..."
@$(PYTHON) scripts/sync_schemas.py
@$(PYTHON) scripts/fix_schema_refs.py
@$(PYTHON) scripts/generate_models_simple.py
@if git diff --exit-code src/adcp/types/generated.py schemas/cache/; then \
echo "✓ Schemas are up-to-date"; \
else \
echo "✗ Schemas are out of date!"; \
echo "Run: make regenerate-schemas"; \
git diff src/adcp/types/generated.py; \
exit 1; \
fi

# Help users understand what to run
.DEFAULT_GOAL := help
Loading