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

Add a cookiecutter based tutorial to build a custom widget #2919

Merged
merged 16 commits into from
Feb 17, 2021

Conversation

jtpio
Copy link
Member

@jtpio jtpio commented Jul 13, 2020

Fixes #2731

The idea is to update the tutorial so it uses the TypeScript cookiecutter to bootstrap the widget.

For now we can probably keep the content and narration of the original tutorial (email widget, screenshot in #2731 (comment)), and we might want to iterate on it more later.

Structure and narration inspired by: https://jupyterlab.readthedocs.io/en/latest/developer/extension_tutorial.html

Screenshot:

Screenshot_2020-07-14 Building a Custom Widget - Email widget — Jupyter Widgets 8 0 0a0 documentation

TODO

  • Add doc for the cookiecutter based setup
  • Update the instructions so they match the cookiecutter structure ("modify this files with the following content")
  • Post a screenshot of the rendered page
  • Add screenshot

@jtpio jtpio added the docs label Jul 14, 2020
@jtpio
Copy link
Member Author

jtpio commented Jul 14, 2020

This should now cover the content of the previous tutorial and be ready for review.

@jtpio jtpio marked this pull request as ready for review July 14, 2020 08:58
Copy link
Contributor

@ianhi ianhi left a comment

Choose a reason for hiding this comment

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

Definitely a helpful read. I left a few comments on some things that might be nice to mention.

Also: I think it would be great to have a screenshot of the finished product right at the top as a hook to capture interest. The widget architecture screenshot is useful but it is not the most inviting start to the tutorial.

docs/source/examples/Widget Custom.ipynb Outdated Show resolved Hide resolved
docs/source/examples/Widget Custom.ipynb Outdated Show resolved Hide resolved
docs/source/examples/Widget Custom.ipynb Show resolved Hide resolved
docs/source/examples/Widget Custom.ipynb Outdated Show resolved Hide resolved
@jtpio
Copy link
Member Author

jtpio commented Sep 14, 2020

I think it would be great to have a screenshot of the finished product right at the top as a hook to capture interest

Good idea, added that to the todo list 👍

@MicaelJarniac MicaelJarniac mentioned this pull request Jan 12, 2021
2 tasks
@MicaelJarniac
Copy link
Contributor

There are references to Widget Custom.ipynb on other files (#3061). At least one of those references includes a specific anchor (#DOMWidget,-ValueWidget-and-Widget), which may need updating.

@MicaelJarniac MicaelJarniac mentioned this pull request Jan 12, 2021
@jtpio
Copy link
Member Author

jtpio commented Feb 1, 2021

Thanks @MicaelJarniac for the pointer.

Adding the PR to the 8.0 milestone since the previous notebook-based tutorial was removed in #2677

@jtpio
Copy link
Member Author

jtpio commented Feb 3, 2021

Add a screenshot for the end result:

end-result

@jtpio
Copy link
Member Author

jtpio commented Feb 3, 2021

@ianhi I've pushed a couple of changes based on the comments above, thanks!

Ideally we will enable the read the docs autobuild for pull requests soon: #2921

So the tutorial can be reviewed more easily.

@jtpio
Copy link
Member Author

jtpio commented Feb 3, 2021

Also, we will want to update the tutorial for JupyterLab 3.0 too, when changes are backported from the 7.x branch to master.

This can probably be tracked and done in a separate PR.

@ianhi
Copy link
Contributor

ianhi commented Feb 7, 2021

I'm going to close and re-open to try to pick up the RTD build on PRs

Copy link
Contributor

@ianhi ianhi left a comment

Choose a reason for hiding this comment

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

This is looking great! I left a comments on a few small things which can mostly done in subsequent PRs. I think the only things that really need addressing are contents of some of the code blocks. Following along I found that I was misled into deleting things, or never ended up defining a necessary variable a few times.

Other than that a great read, I learned a few things along the way :)

"- Union\n",
"\n",
"\n",
"Not all of these traitlets can be synchronized across the network, only the JSON-able traits and Widget instances will be synchronized."
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we specify which ones can't be synced? Maybe just with an asterisk after them in the bulleted list?

Copy link
Member Author

Choose a reason for hiding this comment

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

We can probably go through the list and check them all with a call to json.dumps() to know which ones are serializable.

docs/source/examples/Widget Custom.ipynb Show resolved Hide resolved
docs/source/examples/Widget Custom.ipynb Outdated Show resolved Hide resolved
docs/source/examples/Widget Custom.ipynb Outdated Show resolved Hide resolved
docs/source/examples/Widget Custom.ipynb Show resolved Hide resolved
docs/source/examples/Widget Custom.ipynb Outdated Show resolved Hide resolved
docs/source/examples/Widget Custom.ipynb Outdated Show resolved Hide resolved
docs/source/examples/Widget Custom.ipynb Outdated Show resolved Hide resolved
docs/source/examples/Widget Custom.ipynb Outdated Show resolved Hide resolved
@jtpio
Copy link
Member Author

jtpio commented Feb 17, 2021

Thanks @ianhi for the comments, I pushed changes to the branch which should be available on the RTD preview now too: https://ipywidgets--2919.org.readthedocs.build/en/2919/examples/Widget%20Custom.html

@jtpio
Copy link
Member Author

jtpio commented Feb 17, 2021

We could probably iterate more on this tutorial in separate PRs, to cover the following points:

  • Update instructions to JupyterLab 3.0
  • List non JSON serializable trait types

Copy link
Contributor

@ianhi ianhi left a comment

Choose a reason for hiding this comment

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

This is fantastic 🎉 thanks!

We could probably iterate more on this tutorial in separate PRs, to cover the following points:

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cookiecutter based tutorial
3 participants