diff --git a/CHANGELOG.md b/CHANGELOG.md index a25f836d4e6..7eaa68f6c5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,22 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +## [1.10.0] - 2016-05-19 +### Fixed +Version 1.9.13 fixed an issue in offline mode where if you ran `init_notebook_mode` +more than once the function would skip importing (because it saw that it had +already imported the library) but then accidentally clear plotly.js from the DOM. +This meant that if you ran `init_notebook_mode` more than once, your graphs would +not appear when you refreshed the page. +Version 1.9.13 solved this issue by injecting plotly.js with every iplot call. +While this works, it also injects the library excessively, causing notebooks +to have multiple versions of plotly.js inline in the DOM, potentially making +notebooks with many `iplot` calls very large. +Version 1.10.0 brings back the requirement to call `init_notebook_mode` before +making an `iplot` call. It makes `init_notebook_mode` idempotent: you can call +it multiple times without worrying about losing your plots on refresh. + + ## [1.9.13] - 2016-05-19 ### Fixed - Fixed issue in offline mode related to the inability to reload plotly.js on page refresh and extra init_notebook_mode calls. diff --git a/plotly/offline/offline.py b/plotly/offline/offline.py index f51507136be..170bf8f3cfa 100644 --- a/plotly/offline/offline.py +++ b/plotly/offline/offline.py @@ -14,6 +14,7 @@ import plotly from plotly import tools, utils +from plotly.exceptions import PlotlyError try: import IPython @@ -28,6 +29,7 @@ except ImportError: _matplotlib_imported = False +__PLOTLY_OFFLINE_INITIALIZED = False def download_plotlyjs(download_url): warnings.warn(''' @@ -50,16 +52,11 @@ def init_notebook_mode(): yet. This is an idempotent method and can and should be called from any offline methods that require plotly.js to be loaded into the notebook dom. """ - warnings.warn(''' - `init_notebook_mode` is deprecated and will be removed in the - next release. Notebook mode is now automatically initialized when - notebook methods are invoked, so it is no - longer necessary to manually initialize. - ''', DeprecationWarning) - if not _ipython_imported: raise ImportError('`iplot` can only run inside an IPython Notebook.') + global __PLOTLY_OFFLINE_INITIALIZED + # Inject plotly.js into the output cell script_inject = ( '' '