Skip to content

[grpcio] Add keys, values and items to aio.Metadata - #16566

Merged
JelleZijlstra merged 1 commit into
python:mainfrom
Blacksujit:grpcio-aio-metadata-views
Oct 19, 2026
Merged

JelleZijlstra merged 1 commit into
python:mainfrom
Blacksujit:grpcio-aio-metadata-views

Conversation

@Blacksujit

Copy link
Copy Markdown
Contributor

Since #15899 rebased grpc.aio.Metadata on Collection, metadata.keys(), metadata.values() and metadata.items() are reported as missing attributes, although the runtime class defines them.

This adds the three methods with their runtime types. Note that the views group values per key, so values() and items() yield list[str | bytes], unlike iteration over the metadata itself, which yields one (key, value) tuple per entry.

Upstream (v1.84.0): https://github.com/grpc/grpc/blob/v1.84.0/src/python/grpcio/grpc/aio/_metadata.py#L130-L137

AI agent used: Claude Code (claude-opus-5-5).

@github-actions

Copy link
Copy Markdown
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

scipy-stubs (https://github.com/scipy/scipy-stubs)
- tests/misc/test_submodules_empty.pyi:3: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports

@JelleZijlstra
JelleZijlstra merged commit b38b2a7 into python:main Oct 19, 2026
74 checks passed
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