Skip to content

Pluggable transport#9

Draft
asheshvidyut wants to merge 75 commits intomainfrom
pluggable-transport
Draft

Pluggable transport#9
asheshvidyut wants to merge 75 commits intomainfrom
pluggable-transport

Conversation

@asheshvidyut
Copy link
Copy Markdown
Owner

No description provided.

Copy link
Copy Markdown

@sreenithi sreenithi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please double check if ClientSession / ServerSession is not being changed to ClientTransportSession / ServerTransportSession in files specific to the native transports like stdio, streamable-http, sse.

I've already commented on files which looked specific to these transports, but please double check once from your side too

"""Send a request"""
raise NotImplementedError

async def send_notification(
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abstractmethod is missing here

This class is an async context manager that automatically starts processing
messages when entered.

This is need for JSON-RPC based transports.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be at the beginning, and please write it in a better way combining this and the first line of the docstring, instead of 2 separate sentences.


@pytest.fixture
async def initialized_sse_client_session(server: None, server_url: str) -> AsyncGenerator[ClientSession, None]:
async def initialized_sse_client_session(server: None, server_url: str) -> AsyncGenerator[ClientTransportSession, None]:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be unchanged because it is yielding a ClientSession object in this function.

Similarly, I think even changes in tests/shared/test_streamable_http.py and tests/shared/test_ws.py shouldn't be done, because I'm expecting these tests are meant for only those specific transports like SSE, Streamable HTTP and WebSocket transports which are still under the ClientSession object only.

When there are new tests written for other transports like gRPC or anything else, they can use the upper level ClientTransportSession type, but I don't think it makes sense to change it for these 3 native transports.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in previous comment I don't think this file should be changed.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in previous comment I don't think this file should be changed.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is specific to the studio transport, and studio transport uses ClientSession only, so we shouldn't be updating this.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the type here and in the classes below this one. Don't we need to change them?


SessionT_co = TypeVar(
"SessionT_co",
bound=Union[BaseSession[Any, Any, Any, Any, Any], "ClientTransportSession", "ServerTransportSession"],
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think binding it to the new Session abstract class we created will be better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants