Skip to content

Handle Yjs awareness on the widget comm#40

Merged
davidbrochart merged 9 commits intomainfrom
support-awareness-comm
Apr 13, 2026
Merged

Handle Yjs awareness on the widget comm#40
davidbrochart merged 9 commits intomainfrom
support-awareness-comm

Conversation

@gjmooney
Copy link
Copy Markdown
Contributor

@gjmooney gjmooney commented Apr 2, 2026

This PR wires up pycrdt Awareness, so the kernel can consume YMessageType.AWARENESS frames.

CommProvider creates an Awareness(ydoc) alongside sync/update handling. Inbound messages whose first byte is YMessageType.AWARENESS are decoded with read_message and applied with apply_awareness_update.

CommWidget exposes awareness, plus on_awareness_change / unobserve_awareness as thin wrappers over Awareness.observe / unobserve for notebooks and library code.

@martinRenou
Copy link
Copy Markdown
Member

Maybe pin pytest=8 for now so that the CI passes

@davidbrochart
Copy link
Copy Markdown
Member

I think it requires rethinking the async fixtures, I can look at it.

@davidbrochart davidbrochart force-pushed the support-awareness-comm branch from da62498 to 5e14812 Compare April 4, 2026 12:29
@davidbrochart
Copy link
Copy Markdown
Member

Thanks @gjmooney. We'll need a test for the new functionality.

@davidbrochart davidbrochart force-pushed the support-awareness-comm branch 3 times, most recently from b0c950a to a295d55 Compare April 5, 2026 18:25
@gjmooney gjmooney requested a review from davidbrochart April 7, 2026 11:05
Copy link
Copy Markdown
Member

@davidbrochart davidbrochart left a comment

Choose a reason for hiding this comment

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

I think that there is too much mocking in the tests, in the end they don't test much.
Could you try and test more with less mocking?

@davidbrochart
Copy link
Copy Markdown
Member

I think that there is too much mocking in the tests, in the end they don't test much. Could you try and test more with less mocking?

@gjmooney Don't worry if you cannot reach full coverage. I'm fine with no test and explicit # pragma: nocover in the code. In the end it's an optional feature that should not break existing code.

@gjmooney gjmooney force-pushed the support-awareness-comm branch from de328d0 to 2d86227 Compare April 8, 2026 09:58
@davidbrochart
Copy link
Copy Markdown
Member

There is something I don't understand: your CommWidget will receive and apply awareness updates, but how are you going to set the awareness and send the updates from the kernel?

@martinRenou
Copy link
Copy Markdown
Member

but how are you going to set the awareness and send the updates from the kernel?

For now setting the awareness from the kernel has not been evoked on our side. I wonder if that is something we want to do?

@davidbrochart
Copy link
Copy Markdown
Member

Isn't test_remote_manager_applies_awareness_messages doing just that? I suggest to remove it then.

@gjmooney gjmooney force-pushed the support-awareness-comm branch 5 times, most recently from 062974a to 61782e4 Compare April 9, 2026 17:04
@gjmooney gjmooney force-pushed the support-awareness-comm branch from ae6cfb2 to 121e201 Compare April 13, 2026 14:37
Copy link
Copy Markdown
Member

@davidbrochart davidbrochart left a comment

Choose a reason for hiding this comment

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

Thanks @gjmooney!

@davidbrochart davidbrochart merged commit b401cb4 into main Apr 13, 2026
15 checks passed
@davidbrochart davidbrochart deleted the support-awareness-comm branch April 13, 2026 16:18
@davidbrochart
Copy link
Copy Markdown
Member

Just a note for the future: could you fork the repo and make a PR from there instead of creating a branch here?

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants