From fdc11f4ee2213950b48419bc6f3e6e0f4afcfbd1 Mon Sep 17 00:00:00 2001 From: Danny Sepler Date: Sat, 30 May 2020 14:17:36 -0400 Subject: [PATCH 1/3] Debug in same module --- dash/dash.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/dash/dash.py b/dash/dash.py index 9da6233840..a6c7b7eabe 100644 --- a/dash/dash.py +++ b/dash/dash.py @@ -1338,14 +1338,19 @@ def enable_dev_tools( _reload = self._hot_reload _reload.hash = generate_hash() + # find_loader should return None on __main__ but doesn't + # on some python versions https://bugs.python.org/issue14710 + packages = [ + pkgutil.find_loader(x) + for x in list(ComponentRegistry.registry) + ["dash_renderer"] + if x not in ("__main__") + ] + component_packages_dist = [ os.path.dirname(package.path) if hasattr(package, "path") else package.filename - for package in ( - pkgutil.find_loader(x) - for x in list(ComponentRegistry.registry) + ["dash_renderer"] - ) + for package in packages ] _reload.watch_thread = threading.Thread( From 9d81ad10637001a0f60f496718c286aa3f7039c6 Mon Sep 17 00:00:00 2001 From: Danny Sepler Date: Sat, 30 May 2020 14:23:39 -0400 Subject: [PATCH 2/3] Changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b5bd28ee4b..5a197a119f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - [#1249](https://github.com/plotly/dash/pull/1249) Fixes [#919](https://github.com/plotly/dash/issues/919) so `dash.testing` is compatible with more `pytest` plugins, particularly `pytest-flake8` and `pytest-black`. - [#1248](https://github.com/plotly/dash/pull/1248) Fixes [#1245](https://github.com/plotly/dash/issues/1245), so you can use prop persistence with components that have dict IDs, ie for pattern-matching callbacks. - [#1185](https://github.com/plotly/dash/pull/1185) Sort asset directories, same as we sort files inside those directories. This way if you need your assets loaded in a certain order, you can add prefixes to subdirectory names and enforce that order. +- [#1288](https://github.com/plotly/dash/pull/1288) Closes [#1285](https://github.com/plotly/dash/issues/1285): Debug=True should work in the __main__ module. ## [1.12.0] - 2020-05-05 ### Added From 4fac5cee8fe3a15e35a3679c1e613f157b8904a0 Mon Sep 17 00:00:00 2001 From: Danny Sepler Date: Mon, 1 Jun 2020 01:10:44 -0400 Subject: [PATCH 3/3] "!=" instead of "not in" Co-authored-by: alexcjohnson --- dash/dash.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dash/dash.py b/dash/dash.py index a6c7b7eabe..3367e1d236 100644 --- a/dash/dash.py +++ b/dash/dash.py @@ -1343,7 +1343,7 @@ def enable_dev_tools( packages = [ pkgutil.find_loader(x) for x in list(ComponentRegistry.registry) + ["dash_renderer"] - if x not in ("__main__") + if x != "__main__" ] component_packages_dist = [