Skip to content

Add ready: bool annotation to YRoom #126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

Darshan808
Copy link

Adds a ready: bool class‐level annotation to YRoom so mypy recognizes self.ready and the [has-type] error goes away.
CI error: https://github.com/jupyterlab/jupyter-collaboration/actions/runs/14774032452/job/41478969976?pr=480

@@ -83,7 +83,7 @@ def __init__(
"""
self.ydoc = Doc() if ydoc is None else ydoc
self.ready_event = Event()
self.ready = ready
self.ready: bool = ready
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe really add the annotation at the class level above, as your comment says?

Copy link
Author

Choose a reason for hiding this comment

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

That change caused a mypy error in the CI, likely because we already have a @property defined for it. You can check the details here

Copy link
Author

Choose a reason for hiding this comment

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

The property and setter are already properly annotated as returning/taking bool, so I’m not sure why mypy is still complaining about this. To work around this, I think it’s simplest to add a class-level annotation and silence the redefinition error with a # type: ignore.

@davidbrochart
Copy link
Contributor

Adds a ready: bool class‐level annotation to YRoom so mypy recognizes self.ready and the [has-type] error goes away. CI error: https://github.com/jupyterlab/jupyter-collaboration/actions/runs/14774032452/job/41478969976?pr=480

Isn't the CI failure in jupyterlab/jupyter-collaboration#480 expected, since it updates jupyter-collaboration with changes in pycrdt-websocket that have not been released?

@Darshan808
Copy link
Author

Darshan808 commented May 7, 2025

Isn't the CI failure in jupyterlab/jupyter-collaboration#480 expected, since it updates jupyter-collaboration with changes in pycrdt-websocket that have not been released?

Ahh, I was missing that—thanks for the clarification! I'll go ahead and close this PR since it's not needed.

@Darshan808 Darshan808 closed this May 7, 2025
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