From 9ef78d26346cb27601a708cc6ea9b7ed19ab74ab Mon Sep 17 00:00:00 2001 From: Andrew Sazonov Date: Fri, 22 Aug 2025 12:07:32 +0200 Subject: [PATCH 1/6] Simplifies Plotly figure display logic --- .../plotting/plotters/plotter_plotly.py | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/easydiffraction/plotting/plotters/plotter_plotly.py b/src/easydiffraction/plotting/plotters/plotter_plotly.py index af31dd95..fc086213 100644 --- a/src/easydiffraction/plotting/plotters/plotter_plotly.py +++ b/src/easydiffraction/plotting/plotters/plotter_plotly.py @@ -117,13 +117,21 @@ def plot( # because it can emit `application/vnd.plotly.v1+json` outputs that some toolchains warn about. # Instead, convert the figure to HTML and display it directly. # Use a regular Figure and show it - if not is_github_ci() or display is None or HTML is None: - fig.show(config=config) - else: - html_fig = pio.to_html( - fig, - include_plotlyjs='cdn', - full_html=False, - config=config, - ) - display(HTML(html_fig)) + #if not is_github_ci() or display is None or HTML is None: + # fig.show(config=config) + #else: + # html_fig = pio.to_html( + # fig, + # include_plotlyjs='cdn', + # full_html=False, + # config=config, + # ) + # display(HTML(html_fig)) + + html_fig = pio.to_html( + fig, + include_plotlyjs='cdn', + full_html=False, + config=config, + ) + display(HTML(html_fig)) \ No newline at end of file From 20582222e23d3c3fa17ad1457ac1e8bdc5586bbf Mon Sep 17 00:00:00 2001 From: Andrew Sazonov Date: Fri, 22 Aug 2025 12:18:46 +0200 Subject: [PATCH 2/6] Update plot display logic for PyCharm compatibility --- .../plotting/plotters/plotter_plotly.py | 36 ++++++------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/src/easydiffraction/plotting/plotters/plotter_plotly.py b/src/easydiffraction/plotting/plotters/plotter_plotly.py index fc086213..ef397b5e 100644 --- a/src/easydiffraction/plotting/plotters/plotter_plotly.py +++ b/src/easydiffraction/plotting/plotters/plotter_plotly.py @@ -12,7 +12,7 @@ display = None HTML = None -from easydiffraction.utils.utils import is_github_ci +from easydiffraction.utils.utils import is_pycharm from .plotter_base import SERIES_CONFIG from .plotter_base import PlotterBase @@ -111,27 +111,13 @@ def plot( # Show the figure - # In GitHub CI builds (e.g., during Jupyter Book generation), avoid - # - # calling `fig.show()` - # because it can emit `application/vnd.plotly.v1+json` outputs that some toolchains warn about. - # Instead, convert the figure to HTML and display it directly. - # Use a regular Figure and show it - #if not is_github_ci() or display is None or HTML is None: - # fig.show(config=config) - #else: - # html_fig = pio.to_html( - # fig, - # include_plotlyjs='cdn', - # full_html=False, - # config=config, - # ) - # display(HTML(html_fig)) - - html_fig = pio.to_html( - fig, - include_plotlyjs='cdn', - full_html=False, - config=config, - ) - display(HTML(html_fig)) \ No newline at end of file + if is_pycharm() or display is None or HTML is None: + fig.show(config=config) + else: + html_fig = pio.to_html( + fig, + include_plotlyjs='cdn', + full_html=False, + config=config, + ) + display(HTML(html_fig)) From 19d225adcfccaa66db3ae18cd48d768ceb00996b Mon Sep 17 00:00:00 2001 From: Andrew Sazonov Date: Fri, 22 Aug 2025 12:28:02 +0200 Subject: [PATCH 3/6] Comments out Jupyter execute ignors --- docs/mkdocs.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 7d33a50a..b8a41df8 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -27,15 +27,14 @@ extra: name: EasyDiffraction Library Source Code on GitHub # Jupyter notebooks -plugins: - - mkdocs-jupyter: - execute_ignore: - - 'quick*.ipynb' - - 'basic*.ipynb' - - 'advanced*.ipynb' - - 'cryst*.ipynb' - - 'pdf*.ipynb' -# - '*emcee*.ipynb' # Ignore notebooks with 'emcee' in the name from execution +#plugins: +# - mkdocs-jupyter: +# execute_ignore: +# - 'quick*.ipynb' +# - 'basic*.ipynb' +# - 'advanced*.ipynb' +# - 'cryst*.ipynb' +# - 'pdf*.ipynb' ################## # Add new settings From d354aa14990ce9c68b9987e0900278417ed3de69 Mon Sep 17 00:00:00 2001 From: Andrew Sazonov Date: Fri, 22 Aug 2025 12:32:22 +0200 Subject: [PATCH 4/6] Removes redundant documentation comment --- .../dmsc-summer-school-2025_analysis-powder-diffraction.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tutorials/dmsc-summer-school-2025_analysis-powder-diffraction.py b/tutorials/dmsc-summer-school-2025_analysis-powder-diffraction.py index bac31a05..de53449e 100644 --- a/tutorials/dmsc-summer-school-2025_analysis-powder-diffraction.py +++ b/tutorials/dmsc-summer-school-2025_analysis-powder-diffraction.py @@ -13,11 +13,6 @@ # introduction to EasyScience, EasyDiffraction is built on that framework and # offers a high-level interface focused specifically for diffraction analysis. # -# This notebook is self-contained and designed for hands-on learning. -# For more advanced features and additional capabilities of the EasyDiffraction -# library, please see the official documentation: -# https://docs.easydiffraction.org/lib - # This notebook is self-contained and designed for hands-on learning. # However, if you're interested in exploring more advanced features or learning # about additional capabilities of the EasyDiffraction library, please refer to From be52af3a94bda2a5cf7804b8d96a99ea4f541473 Mon Sep 17 00:00:00 2001 From: Andrew Sazonov Date: Fri, 22 Aug 2025 12:37:32 +0200 Subject: [PATCH 5/6] WIP on plotly --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 318f603c..76d7f184 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,7 +67,7 @@ docs = [ visualization = [ 'darkdetect', # Detecting dark mode 'pandas', # Displaying tables in juptyer notebooks - 'plotly<6.1.0', # Interactive plots. 0.6.0 => Empty charts in Jupyter notebooks ... + 'plotly', # Interactive plots 'py3Dmol', # Visualisation of crystal structures ] @@ -115,7 +115,7 @@ source = 'versioningit' # Use versioningit to manage the version [tool.versioningit.format] distance = '{base_version}+d{distance}' # example: 0.5.8+d3, 1.2.3.post4+d2 dirty = '{base_version}' # example: 0.5.8, 1.2.3.post4 -distance-dirty = '{base_version}+d{distance}' # +distance-dirty = '{base_version}+d{distance}' # see 1st example # Configure how versioningit detects versions from Git # - 'match' ensures it only considers tags starting with 'v' From 3ae1f0f9b54a48660d431ebacfb97f5d0ae2a859 Mon Sep 17 00:00:00 2001 From: Andrew Sazonov Date: Fri, 22 Aug 2025 12:38:07 +0200 Subject: [PATCH 6/6] Unpin plotly --- pyproject.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 76d7f184..a0d65abc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,10 +65,10 @@ docs = [ 'pyyaml', # YAML parser ] visualization = [ - 'darkdetect', # Detecting dark mode - 'pandas', # Displaying tables in juptyer notebooks - 'plotly', # Interactive plots - 'py3Dmol', # Visualisation of crystal structures + 'darkdetect', # Detecting dark mode + 'pandas', # Displaying tables in juptyer notebooks + 'plotly', # Interactive plots + 'py3Dmol', # Visualisation of crystal structures ] [project.urls]