Skip to content

docs: add docstrings to memory channel classes#3406

Open
wavebyrd wants to merge 2 commits intopython-trio:mainfrom
wavebyrd:docs/memory-channel-docstrings
Open

docs: add docstrings to memory channel classes#3406
wavebyrd wants to merge 2 commits intopython-trio:mainfrom
wavebyrd:docs/memory-channel-docstrings

Conversation

@wavebyrd
Copy link

Summary

Add docstrings to memory channel classes so they show up properly in the Sphinx-generated documentation:

  • MemoryChannelStatistics: Added docstring documenting all six attributes
  • MemorySendChannel: Added docstring referencing open_memory_channel and noting it implements SendChannel interface
  • MemoryReceiveChannel: Added docstring referencing open_memory_channel and noting it implements ReceiveChannel interface

Partial fix for #3221 (addresses 3 of the 11 items)

Test plan

  • Documentation builds without errors
  • New docstrings appear in generated documentation

🤖 Generated with Claude Code

Add docstrings to MemoryChannelStatistics, MemorySendChannel, and
MemoryReceiveChannel classes so they show up properly in the
Sphinx-generated documentation.

- MemoryChannelStatistics: Document all attributes with descriptions
- MemorySendChannel: Reference open_memory_channel and note it
  implements SendChannel interface
- MemoryReceiveChannel: Reference open_memory_channel and note it
  implements ReceiveChannel interface

Partial fix for python-trio#3221

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@wavebyrd
Copy link
Author

Hi! Just checking in on this documentation PR. Happy to address any feedback.

Copy link
Contributor

@A5rocks A5rocks left a comment

Choose a reason for hiding this comment

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

Overall looks good, two nitpicks where I'm maybe confused.

Also please make CI pass.

returns a pair of (:class:`MemorySendChannel`, :class:`MemoryReceiveChannel`).
See :func:`open_memory_channel` for full documentation.

This implements the :class:`~trio.abc.ReceiveChannel` interface.
Copy link
Contributor

Choose a reason for hiding this comment

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

Huh I don't think this is necessary. Do we do this elsewhere?

"""Statistics about a memory channel.

This object is returned by the ``statistics()`` method on
:class:`MemorySendChannel` and :class:`MemoryReceiveChannel`.
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO not necessary to have a backref like this here.

@A5rocks A5rocks added the skip newsfragment Newsfragment is not required label Mar 16, 2026
Address review feedback:
- Remove backref in MemoryChannelStatistics docstring
- Remove "implements interface" lines from Send/ReceiveChannel

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@wavebyrd
Copy link
Author

Thanks for the review! I've addressed both nitpicks - removed the backref in MemoryChannelStatistics and the 'implements interface' lines from both channel classes.

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

Labels

skip newsfragment Newsfragment is not required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants