A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
Fix deepcopy in from_anywidget.py (#5134)
jmsmdy7d0987275623
diff --git a/marimo/_plugins/ui/_impl/from_anywidget.py b/marimo/_plugins/ui/_impl/from_anywidget.pyindex 703880ec57..065a7b3260 100644--- a/marimo/_plugins/ui/_impl/from_anywidget.py+++ b/marimo/_plugins/ui/_impl/from_anywidget.py@@ -3,6 +3,7 @@ from __future__ import annotationsimport hashlibimport weakref+from copy import deepcopyfrom dataclasses import dataclassfrom typing import TYPE_CHECKING, Any, Optional@@ -190,6 +191,11 @@ class anywidget(UIElement[T, T]):self._prev_state = valuereturn value+ def __deepcopy__(self, memo):+ # Overriding UIElement deepcopy implementation+ widget_deep_copy = deepcopy(self.widget, memo)+ return from_anywidget(widget_deep_copy) # reuse caching+# After the widget has been initialized# forward all setattr to the widgetdef __setattr__(self, name: str, value: Any) -> None: