ipywidgets icon indicating copy to clipboard operation
ipywidgets copied to clipboard

POC: Creation of a Comm Python package

Open martinRenou opened this issue 3 years ago • 1 comments

Related discussions:

  • https://github.com/jupyter-xeus/xeus-python/issues/342
  • https://github.com/jupyter-widgets/ipywidgets/issues/3514

Currently working on a Python comm package on https://github.com/martinRenou/comm for now, but it should probably be moved in the IPython org

This has the benefit of being able to:

  • remove the ipykernel dependency in ipywidgets https://github.com/jupyter-widgets/ipywidgets/pull/3533
  • remove the ipykernel monkey patch in xeus-python https://github.com/jupyter-xeus/xeus-python/pull/548
  • remove the ipykernel package mock in jupyterlite's pyolite
  • remove the ipykernel package mock in emscripten-forge

martinRenou avatar Aug 01 '22 13:08 martinRenou

Binder :point_left: Launch a binder notebook on branch martinRenou/ipywidgets/move_comm

github-actions[bot] avatar Aug 01 '22 13:08 github-actions[bot]

This has the benefit of being able to:

remove the ipykernel dependency in ipywidgets https://github.com/jupyter-widgets/ipywidgets/pull/3533 remove the ipykernel monkey patch in xeus-python https://github.com/jupyter-xeus/xeus-python/pull/548 remove the ipykernel package mock in jupyterlite's pyolite remove the ipykernel package mock in emscripten-forge

Wow. I think it is quite an improvement.

SylvainCorlay avatar Nov 18 '22 14:11 SylvainCorlay

Thanks a lot for your review @maartenbreddels ! I will resolve your comment and get the CI green hopefully :D

martinRenou avatar Feb 10 '23 12:02 martinRenou

@maartenbreddels it was difficult to get green but now it seems good!

Thankfully, the Python 3.7 build requires an old version of ipykernel (latest ipykernel does not support 3.7?) so we have tests against the old versions and new versions.

martinRenou avatar Feb 16 '23 14:02 martinRenou

Would you have time to make it a review @maartenbreddels ?

martinRenou avatar Mar 16 '23 13:03 martinRenou

Thanks for the review! I resolved your comments

martinRenou avatar Mar 17 '23 08:03 martinRenou

Hello. Is there a plan to merge and release this soon? We are seeing deprecation warning from stable version of ipykernel downstream. Thank you!

pllim avatar Mar 20 '23 16:03 pllim

@martinRenou do you know what caused that change? I'm fine removing the newlines, but maybe good to be aware what is responsible for this change?

Hello. Is there a plan to merge and release this soon?

Yes, I think we should get this released asap, which I could do tomorrow if we manage to get this in.

maartenbreddels avatar Mar 20 '23 17:03 maartenbreddels

I'm fine removing the newlines, but maybe good to be aware what is responsible for this change?

Are you talking about the test failure? If yes, this one can be reproduced on master, and this PR fixes it. I have not found what is causing this though, but I suspect an IPython change?

martinRenou avatar Mar 21 '23 08:03 martinRenou

Yes, I think we should get this released asap, which I could do tomorrow if we manage to get this in.

💯

martinRenou avatar Mar 21 '23 08:03 martinRenou

@maartenbreddels all green!

martinRenou avatar Mar 21 '23 08:03 martinRenou

@martinRenou great work, i guess we also need to backport this to 7.x do you want to try the bot?

maartenbreddels avatar Mar 21 '23 08:03 maartenbreddels

@meeseeksdev please backport to 7.x

martinRenou avatar Mar 21 '23 09:03 martinRenou

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
git checkout 7.x
git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -x -m1 785d1598b38f6fb43917489f530d14e28876fc24
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #3533: Using the new Comm Python package'
  1. Push to a named branch:
git push YOURFORK 7.x:auto-backport-of-pr-3533-on-7.x
  1. Create a PR against branch 7.x, I would have named this PR:

"Backport PR #3533 on branch 7.x (Using the new Comm Python package)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove the Still Needs Manual Backport label once the PR gets merged.

If these instructions are inaccurate, feel free to suggest an improvement.

lumberbot-app[bot] avatar Mar 21 '23 09:03 lumberbot-app[bot]

If seeing errors like this in pytest:

    def _create_comm(*args, **kwargs):
        """Create a Comm.
    
        This method is intended to be replaced, so that it returns your Comm instance.
        """
>       raise NotImplementedError("Cannot ")
E       NotImplementedError: Cannot

Adding:

import ipykernel.ipkernel  # noqa

Is enough to trigger the side-effects to overload that manager.

Seems like it should go in the docs... or even in that unhelpful traceback itself, cuz 99% of the time, i reckon people are testing with ipykernel lying around.

bollwyvl avatar Mar 21 '23 20:03 bollwyvl