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

Use myst-nb to demo ipywidgets double render bug #1765

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,16 @@
"_extension.gallery_directive",
"_extension.component_directive",
# For extension examples and demos
"myst_parser",
# "myst_parser",
"ablog",
"jupyter_sphinx",
"sphinxcontrib.youtube",
"nbsphinx",
# "nbsphinx",
"numpydoc",
"sphinx_togglebutton",
"jupyterlite_sphinx",
"sphinx_favicon",
"myst_nb",
]

jupyterlite_config = "jupyterlite_config.json"
Expand Down
51 changes: 48 additions & 3 deletions docs/examples/pydata.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@
"\n",
"This theme has built-in support and special styling for several major visualization libraries in the PyData ecosystem.\n",
"This ensures that the images and output generated by these libraries looks good for both light and dark modes.\n",
"Below are examples of each that we use as a benchmark for reference.\n",
"\n",
"Below are examples of each that we use as a benchmark for reference."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Pandas"
]
},
Expand All @@ -30,6 +35,46 @@
"df"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## IPyWidget"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import ipywidgets as widgets\n",
"from IPython.display import display\n",
"\n",
"tab = widgets.Tab()\n",
"\n",
"descr_str = \"Hello\"\n",
"\n",
"title = widgets.HTML(descr_str)\n",
"\n",
"# create output widgets\n",
"widget_images = widgets.Output()\n",
"widget_annotations = widgets.Output()\n",
"\n",
"# render in output widgets\n",
"with widget_images:\n",
" display(pd.DataFrame(np.random.randn(10,10)))\n",
"with widget_annotations:\n",
" display(pd.DataFrame(np.random.randn(10,10)))\n",
"\n",
"tab.children = [widget_images, widget_annotations]\n",
"tab.titles = [\"Images\", \"Annotations\"]\n",
"\n",
"display(widgets.VBox([title, tab]))"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -143,7 +188,7 @@
},
"language_info": {
"name": "python",
"version": "3.10.8"
"version": "3.11.6"
}
},
"nbformat": 4,
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ doc = [
"nbsphinx",
"ipyleaflet",
"colorama",
"ipywidgets",
"myst-nb"
]
test = ["pytest", "pytest-cov", "pytest-regressions"]
dev = ["pyyaml", "pre-commit", "nox", "pydata-sphinx-theme[doc,test]"]
Expand Down
Loading