diff --git a/CHANGELOG.md b/CHANGELOG.md index 4beb5d5db8..80f8cffca7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](https://semver.org/). ### Fixed +- [#2223](https://github.com/plotly/dash/pull/2223) Exclude hidden folders when building `dash.page_registry`. - [#2182](https://github.com/plotly/dash/pull/2182) Fix [#2172](https://github.com/plotly/dash/issues/2172) Make it so that when using pages, if `suppress_callback_exceptions=True` the `validation_layout` is not set. - [#2152](https://github.com/plotly/dash/pull/2152) Fix bug [#2128](https://github.com/plotly/dash/issues/2128) preventing rendering of multiple components inside a dictionary. - [#2187](https://github.com/plotly/dash/pull/2187) Fix confusing error message when trying to use pytest fixtures but `dash[testing]` is not installed. diff --git a/dash/dash.py b/dash/dash.py index 8fbda5df82..b51e804220 100644 --- a/dash/dash.py +++ b/dash/dash.py @@ -1963,7 +1963,10 @@ def verify_url_part(served_part, url_part, part_name): def _import_layouts_from_pages(self): walk_dir = self.config.pages_folder - for (root, _, files) in os.walk(walk_dir): + for (root, dirs, files) in os.walk(walk_dir): + dirs[:] = [ + d for d in dirs if not d.startswith(".") and not d.startswith("_") + ] for file in files: if ( file.startswith("_") diff --git a/tests/integration/multi_page/pages/.no_import/no_import.py b/tests/integration/multi_page/pages/.no_import/no_import.py new file mode 100644 index 0000000000..25211d3054 --- /dev/null +++ b/tests/integration/multi_page/pages/.no_import/no_import.py @@ -0,0 +1,5 @@ +from dash import register_page + +register_page(__name__) + +raise Exception("files in directories starting with . should not be imported") diff --git a/tests/integration/multi_page/pages/_no_import.py b/tests/integration/multi_page/pages/_no_import.py index 5877f359ad..5a2610e5d2 100644 --- a/tests/integration/multi_page/pages/_no_import.py +++ b/tests/integration/multi_page/pages/_no_import.py @@ -1 +1,5 @@ +from dash import register_page + +register_page(__name__) + raise Exception("files starting with _ should not be imported")