| 961 | ) |
| 962 | |
| 963 | def _config(self): |
| 964 | # pieces of config needed by the front end |
| 965 | config = { |
| 966 | "url_base_pathname": self.config.url_base_pathname, |
| 967 | "requests_pathname_prefix": self.config.requests_pathname_prefix, |
| 968 | "ui": self._dev_tools.ui, |
| 969 | "props_check": self._dev_tools.props_check, |
| 970 | "disable_version_check": self._dev_tools.disable_version_check, |
| 971 | "show_undo_redo": self.config.show_undo_redo, |
| 972 | "suppress_callback_exceptions": self.config.suppress_callback_exceptions, |
| 973 | "update_title": self.config.update_title, |
| 974 | "children_props": ComponentRegistry.children_props, |
| 975 | "serve_locally": self.config.serve_locally, |
| 976 | "dash_version": __version__, |
| 977 | "python_version": sys.version, |
| 978 | "dash_version_url": DASH_VERSION_URL, |
| 979 | "ddk_version": ddk_version, |
| 980 | "plotly_version": plotly_version, |
| 981 | "validate_callbacks": self._dev_tools.validate_callbacks, |
| 982 | "csrf_token_name": self.config.csrf_token_name, |
| 983 | "csrf_header_name": self.config.csrf_header_name, |
| 984 | } |
| 985 | if self._plotly_cloud is None: |
| 986 | if os.getenv("DASH_ENTERPRISE_ENV") == "WORKSPACE": |
| 987 | # Disable the placeholder button on workspace. |
| 988 | self._plotly_cloud = True |
| 989 | else: |
| 990 | try: |
| 991 | # pylint: disable=C0415,W0611 |
| 992 | import plotly_cloud # type: ignore # noqa: F401 |
| 993 | |
| 994 | self._plotly_cloud = True |
| 995 | except ImportError: |
| 996 | self._plotly_cloud = False |
| 997 | |
| 998 | config["plotly_cloud_installed"] = self._plotly_cloud |
| 999 | if not self.config.serve_locally: |
| 1000 | config["plotlyjs_url"] = self._plotlyjs_url |
| 1001 | if self._dev_tools.hot_reload: |
| 1002 | config["hot_reload"] = { |
| 1003 | # convert from seconds to msec as used by js `setInterval` |
| 1004 | "interval": int(self._dev_tools.hot_reload_interval * 1000), |
| 1005 | "max_retry": self._dev_tools.hot_reload_max_retry, |
| 1006 | } |
| 1007 | if self.validation_layout and not self.config.suppress_callback_exceptions: |
| 1008 | validation_layout = self.validation_layout |
| 1009 | |
| 1010 | # Add extra components |
| 1011 | if self._extra_components: |
| 1012 | validation_layout = html.Div( |
| 1013 | children=[validation_layout] + self._extra_components |
| 1014 | ) |
| 1015 | |
| 1016 | config["validation_layout"] = validation_layout |
| 1017 | |
| 1018 | if self._dev_tools.ui: |
| 1019 | # Add custom dev tools hooks if the ui is activated. |
| 1020 | custom_dev_tools = [] |