Convert all four public interfaces (JsonRepositoryInterface, ObjectRepositoryInterface, ConnectionAwareInterface, ContextAwareInterface) to @runtime_checkableProtocol classes with @abstractmethod members
Reorder adapter inheritance so concrete bases come before Protocol interfaces (ConnectionAwareAdapter first), preserving super().__init__() behavior
Add structural typing unit tests for duck-typed implementations without inheritance
Document nominal (subclass adapter) vs structural (type-annotate against interface) usage in README
Notes
class X(Protocol, ABC) is invalid at runtime in Python; Protocol with @abstractmethod provides the intended behavior (structural typing + instantiation guards for explicit subclasses)
No breaking changes for existing adapter subclasses; scan_keys default remains for nominal implementors
Test plan
uv run pytest tests/unit/ -v (99 passed)
uv run mypy python_repositories tests
uv run ruff check / ruff format
## Summary
- Convert all four public interfaces (`JsonRepositoryInterface`, `ObjectRepositoryInterface`, `ConnectionAwareInterface`, `ContextAwareInterface`) to `@runtime_checkable` `Protocol` classes with `@abstractmethod` members
- Reorder adapter inheritance so concrete bases come before Protocol interfaces (`ConnectionAwareAdapter` first), preserving `super().__init__()` behavior
- Add structural typing unit tests for duck-typed implementations without inheritance
- Document nominal (subclass adapter) vs structural (type-annotate against interface) usage in README
## Notes
- `class X(Protocol, ABC)` is invalid at runtime in Python; `Protocol` with `@abstractmethod` provides the intended behavior (structural typing + instantiation guards for explicit subclasses)
- No breaking changes for existing adapter subclasses; `scan_keys` default remains for nominal implementors
## Test plan
- [x] `uv run pytest tests/unit/ -v` (99 passed)
- [x] `uv run mypy python_repositories tests`
- [x] `uv run ruff check` / `ruff format`
Record the one-to-one unit test file convention in README and add rules for test placement and copy-ready PR text after first push.
Co-authored-by: Cursor <[email protected]>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
JsonRepositoryInterface,ObjectRepositoryInterface,ConnectionAwareInterface,ContextAwareInterface) to@runtime_checkableProtocolclasses with@abstractmethodmembersConnectionAwareAdapterfirst), preservingsuper().__init__()behaviorNotes
class X(Protocol, ABC)is invalid at runtime in Python;Protocolwith@abstractmethodprovides the intended behavior (structural typing + instantiation guards for explicit subclasses)scan_keysdefault remains for nominal implementorsTest plan
uv run pytest tests/unit/ -v(99 passed)uv run mypy python_repositories testsuv run ruff check/ruff formatTest Coverage Report:
Test Coverage Report:
Test Coverage Report: