Skip to content

buf 1.62.1 generated client is incompatible with connect-python>=0.6.0 #78

@SpencerWhitehead7

Description

@SpencerWhitehead7

Sorry if this is the wrong place to open this issue, but https://connectrpc.com/ has a big banner that says "CREATED BY BUF" so I hope it's alright. If this is something that should be addressed by the buf cli, just redirect me to where I can file an issue with them instead.

When I use the buf [email protected] (latest at time of writing) with buf generate to create python service files from protobuf definitions, I get a pyright error in the generated code for XXXServiceASGIApplication

Argument missing for parameter "service"Pylance[reportCallIssue](https://github.com/microsoft/pylance-release/blob/main/docs/diagnostics/reportCallIssue.md)
(method) def __init__(
    *,
    service: Unknown | AsyncGenerator[Unknown, None],
    endpoints: (Unknown) -> Mapping[str, Endpoint[Unknown, Unknown]],
    interceptors: Iterable[Interceptor] = (),
    read_max_bytes: int | None = None
) -> None
Initialize the ASGI application.

The attached zip file is a uv repo that shows the issue. You should be able to run uv sync to download the dependencies and create a fresh .venv.

Then you can run pyright to see the error, or look at gen/ping/v1/ping_service_connect.py in an editor with pyright integration.

If you downgrade connect-python to ==0.5.0 in pyproject.toml, then run uv sync and pyright again, the error goes away.

I can hand-patch the error away by adding service=service to the __init__'s arguments, but that reveals another pyright error

Argument of type "dict[str, EndpointUnary[PingRequest, PingResponse]]" cannot be assigned to parameter "endpoints" of type "(Unknown) -> Mapping[str, Endpoint[Unknown, Unknown]]" in function "__init__"Pylance[reportArgumentType](https://github.com/microsoft/pylance-release/blob/main/docs/diagnostics/reportArgumentType.md)

which I did not try and patch.

buf_1.62.1_generated_client_is_incompatible_with_connect-python_0.6.0.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions