Skip to content
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

feat: add jupyter widgets and demo notebook for python support #16

Closed
wants to merge 3 commits into from

Conversation

mkery
Copy link
Collaborator

@mkery mkery commented Jun 7, 2022

@grtlr please try installing this notebook extension to verify my instructions work, thanks!

See the README.MD in the py-notebook folder for usage & install instructions.

@mkery mkery requested a review from domoritz June 7, 2022 16:55
Copy link
Collaborator

@grtlr grtlr left a comment

Choose a reason for hiding this comment

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

@mkery Thank you very much for working on the Python support! Unfortunately, I could not reproduce the steps in py-notebook/README.md. I added GitHub comments to the specific commands that went wrong.

Also, I don't have any experience with creating extensions for Jupyter notebooks, but maybe that's a good thing for going through the documentation 🙈 .


1. In a terminal, navigate to the included jupyter extension folder:

`$ cd neo-confusion-jupyter`
Copy link
Collaborator

Choose a reason for hiding this comment

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

I had to run this command from the jupyter-widget folder.


2. Locally install the neo jupyter extension package to Python:

`$ pip install -e .`
Copy link
Collaborator

Choose a reason for hiding this comment

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

When I call this (from the jupyter-widget folder), I get the following webpack error:

ERROR in main
    Module not found: Error: Can't resolve './lib/embed.js' in '/Users/.../ml-hierarchical-confusion-matrix/py-notebook/jupyter-widget/js'

@domoritz domoritz changed the title Added jupyter widgets and demo notebook for python support feat: add jupyter widgets and demo notebook for python support Jun 23, 2022
Copy link
Member

@domoritz domoritz left a comment

Choose a reason for hiding this comment

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

Let's add an action to test (at least test that it runs) the Python widget code.

@grtlr
Copy link
Collaborator

grtlr commented Jun 23, 2022

Yeah, that would be cool as it would also document the required steps.

tafsiri and others added 2 commits February 27, 2023 11:15
Co-authored-by: Yannick Assogba <yassogba@apple.com>
Copy link
Member

@domoritz domoritz left a comment

Choose a reason for hiding this comment

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

Looks good. Let's use yarn namespaces to keep the package more maintainable.

@@ -0,0 +1,52 @@
{
"name": "neo-confusion-jupyter",
Copy link
Member

Choose a reason for hiding this comment

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

The corresponding lockfile should ideally be at the top level as well. We can use yarn workspaces to make this work.

Without workspaces, we will need to keep the lock files in sync.

Copy link

Choose a reason for hiding this comment

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

Could you say more about why they should be in sync? They are effectively different packages, and there doesn't need to be local links between the two (see deps section below).

Copy link

@tafsiri tafsiri left a comment

Choose a reason for hiding this comment

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

Left a few inline comments for future discussion. But the bigger design related question I'm wondering is if there is a way to not need to release the neo-confusion-jupyter javascript package? Is it possible to just bundle the built code into the python extension itself. If so that would be one less package to maintain and a likely easier release process. For context I'm not particular familiar with Jupyter extensions.

A related question I had is in the current setup who is responsible for yarn build on the widgets javascript? Does that happen on the user's machine (meaning they require npm) or at build time before upload to pypi?

This may work better to chat about synchronously, but if there are pointers that make sense to leave here that works too.

- [node](http://nodejs.org/)

```bash
npm install --save neo-confusion-jupyter
Copy link

Choose a reason for hiding this comment

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

Could you say a bit more about this? I'm not as familiar with jupyter widgets, so I'm wondering who is the consumer for this potential javascript package. Can the python package not include any necessary javascript?


//console.log("RECIEVED DATA", data);

// TODO TEST ONLY
Copy link

Choose a reason for hiding this comment

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

We should sync up on what's left for these TODOs (here and below)

},
externals: ['@jupyter-widgets/base']
},
{// Embeddable neo-confusion-jupyter bundle
Copy link

Choose a reason for hiding this comment

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

I'm guessing this is related to the answer to my question above (about why neo-confusion-jupyter needs to be a package). How would people use this version? Is there a great advantage over the pip install approach?

cmdclass=cmdclass,
author='Mary Beth Kery',
author_email='mkery@apple.com',
url='https://github.com/MI Vis/neo-confusion-jupyter',
Copy link

Choose a reason for hiding this comment

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

update to point to this repo.

- To release a new version of neo_confusion_jupyter on PyPI:

Update _version.py (set release version, remove 'dev')
git add the _version.py file and git commit
Copy link

Choose a reason for hiding this comment

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

is this step already done? also we should update this to the full path.

render() {
try {
// parse data
let dataStr = this.model.get("inputData");
Copy link

Choose a reason for hiding this comment

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

Consider const instead of let here and below.

@domoritz domoritz closed this Aug 9, 2023
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.

None yet

4 participants