From f0ec8d341e91689790d2d9da3f35bacf830cf8ac Mon Sep 17 00:00:00 2001 From: Alex Mazzeo Date: Fri, 9 Jan 2026 10:08:15 -0800 Subject: [PATCH 1/2] Remove TODO comments marked as won't do Removes TODO comments for items marked as "won't do" during todo triage: - Allow service to be provided as positional argument - Error on invalid Operation instantiation - Support dynamic Operation creation - Rename operation variables for clarity These items have been evaluated and decided not to be implemented. Co-Authored-By: Claude Sonnet 4.5 --- src/nexusrpc/_service.py | 8 -------- src/nexusrpc/handler/_decorators.py | 1 - src/nexusrpc/handler/_operation_handler.py | 1 - 3 files changed, 10 deletions(-) diff --git a/src/nexusrpc/_service.py b/src/nexusrpc/_service.py index 5e08697..f62eb67 100644 --- a/src/nexusrpc/_service.py +++ b/src/nexusrpc/_service.py @@ -125,14 +125,6 @@ class AnotherService: process: nexusrpc.Operation[ProcessInput, ProcessOutput] """ - # TODO(preview): error on attempt foo = Operation[int, str](name="bar") - # The input and output types are not accessible on the instance. - # TODO(preview): Support foo = Operation[int, str]? E.g. via - # ops = {name: nexusrpc.Operation[int, int] for name in op_names} - # service_cls = nexusrpc.service(type("ServiceContract", (), ops)) - # This will require forming a union of operations disovered via __annotations__ - # and __dict__ - def decorator(cls: type[ServiceT]) -> type[ServiceT]: if name is not None and not name: raise ValueError("Service name must not be empty.") diff --git a/src/nexusrpc/handler/_decorators.py b/src/nexusrpc/handler/_decorators.py index 8b9fb20..1e32d46 100644 --- a/src/nexusrpc/handler/_decorators.py +++ b/src/nexusrpc/handler/_decorators.py @@ -34,7 +34,6 @@ def service_handler(cls: type[ServiceHandlerT]) -> type[ServiceHandlerT]: ... -# TODO(preview): allow service to be provided as positional argument? @overload def service_handler( *, diff --git a/src/nexusrpc/handler/_operation_handler.py b/src/nexusrpc/handler/_operation_handler.py index 5a9c16a..4f4eb40 100644 --- a/src/nexusrpc/handler/_operation_handler.py +++ b/src/nexusrpc/handler/_operation_handler.py @@ -133,7 +133,6 @@ def collect_operation_handler_factories_by_method_name( """ Collect operation handler methods from a user service handler class. """ - # TODO(preview): rename op/op_defn variables in this function factories: dict[str, Callable[[ServiceHandlerT], OperationHandler[Any, Any]]] = {} service_method_names = ( {op_defn.method_name for op_defn in service.operation_definitions.values()} From a89c41339342c478f351455a3cbe33fae165d929 Mon Sep 17 00:00:00 2001 From: Alex Mazzeo Date: Fri, 9 Jan 2026 10:30:15 -0800 Subject: [PATCH 2/2] Clarify why decorator is omitted in inheritance tests Replaces TODO comments with clear explanations that child classes intentionally omit @nexusrpc.service at definition time because the decorator is applied in the test function itself. This tests that service definitions correctly inherit operations from decorated parent classes. Co-Authored-By: Claude Sonnet 4.5 --- .../test_service_definition_inheritance.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/service_definition/test_service_definition_inheritance.py b/tests/service_definition/test_service_definition_inheritance.py index 06c660c..d8af5b2 100644 --- a/tests/service_definition/test_service_definition_inheritance.py +++ b/tests/service_definition/test_service_definition_inheritance.py @@ -31,7 +31,9 @@ class TypeAnnotationsOnly(_TestCase): class A1: a: Operation[int, str] - # TODO(preview) why is the decorator omitted here? + # A2 intentionally omits @nexusrpc.service at definition time. + # The decorator will be applied in the test function to verify that + # service definitions correctly inherit operations from decorated parent classes. class A2(A1): b: Operation[int, str] # type: ignore[reportUninitializedInstanceVariable] @@ -44,7 +46,9 @@ class TypeAnnotationsWithValues(_TestCase): class A1: a: Operation[int, str] = Operation[int, str](name="a-name") - # TODO(preview) why is the decorator omitted here? + # A2 intentionally omits @nexusrpc.service at definition time. + # The decorator will be applied in the test function to verify that + # service definitions correctly inherit operations from decorated parent classes. class A2(A1): b: Operation[int, str] = Operation[int, str](name="b-name")