Repository: plotly/plotly.py
Issue: update_annotations: patch should not be required



`fig.update_annotations(text='yo')` should a) not error out and b) have the same effect as `fig.update_annotations(patch=dict(text='yo'))`

I think we're missing `patch=None` in the update_annotations/update_shapes/update_layout_image family of methods...

Changed files:
packages/python/plotly/plotly/graph_objs/_figurewidget.py
packages/python/plotly/plotly/graph_objs/_figure.py
packages/python/plotly/codegen/figure.py
packages/python/plotly/plotly/tests/test_core/test_update_objects/test_update_annotations.py

diff --git a/packages/python/plotly/codegen/figure.py b/packages/python/plotly/codegen/figure.py
index 1a0f073af..6c5d98fdf 100644
--- a/packages/python/plotly/codegen/figure.py
+++ b/packages/python/plotly/codegen/figure.py
@@ -473,7 +473,7 @@ class {fig_classname}({base_classname}):\\n"""
 
     def update_{method_prefix}{plural_name}(
         self,
-        patch,
+        patch=None,
         selector=None,
         row=None,
         col=None,
diff --git a/packages/python/plotly/plotly/graph_objs/_figure.py b/packages/python/plotly/plotly/graph_objs/_figure.py
index e0077b125..d907b8634 100644
--- a/packages/python/plotly/plotly/graph_objs/_figure.py
+++ b/packages/python/plotly/plotly/graph_objs/_figure.py
@@ -17450,7 +17450,7 @@ class Figure(BaseFigure):
         return self
 
     def update_annotations(
-        self, patch, selector=None, row=None, col=None, secondary_y=None, **kwargs
+        self, patch=None, selector=None, row=None, col=None, secondary_y=None, **kwargs
     ):
         """
         Perform a property update operation on all annotations that satisfy the
@@ -17949,7 +17949,7 @@ class Figure(BaseFigure):
         return self
 
     def update_layout_images(
-        self, patch, selector=None, row=None, col=None, secondary_y=None, **kwargs
+        self, patch=None, selector=None, row=None, col=None, secondary_y=None, **kwargs
     ):
         """
         Perform a property update operation on all images that satisfy the
@@ -18221,7 +18221,7 @@ class Figure(BaseFigure):
         return self
 
     def update_shapes(
-        self, patch, selector=None, row=None, col=None, secondary_y=None, **kwargs
+        self, patch=None, selector=None, row=None, col=None, secondary_y=None, **kwargs
     ):
         """
         Perform a property update operation on all shapes that satisfy the
diff --git a/packages/python/plotly/plotly/graph_objs/_figurewidget.py b/packages/python/plotly/plotly/graph_objs/_figurewidget.py
index 89042ba66..bb8d57a1d 100644
--- a/packages/python/plotly/plotly/graph_objs/_figurewidget.py
+++ b/packages/python/plotly/plotly/graph_objs/_figurewidget.py
@@ -17450,7 +17450,7 @@ class FigureWidget(BaseFigureWidget):
         return self
 
     def update_annotations(
-        self, patch, selector=None, row=None, col=None, secondary_y=None, **kwargs
+        self, patch=None, selector=None, row=None, col=None, secondary_y=None, **kwargs
     ):
         """
         Perform a property update operation on all annotations that satisfy the
@@ -17949,7 +17949,7 @@ class FigureWidget(BaseFigureWidget):
         return self
 
     def update_layout_images(
-        self, patch, selector=None, row=None, col=None, secondary_y=None, **kwargs
+        self, patch=None, selector=None, row=None, col=None, secondary_y=None, **kwargs
     ):
         """
         Perform a property update operation on all images that satisfy the
@@ -18221,7 +18221,7 @@ class FigureWidget(BaseFigureWidget):
         return self
 
     def update_shapes(
-        self, patch, selector=None, row=None, col=None, secondary_y=None, **kwargs
+        self, patch=None, selector=None, row=None, col=None, secondary_y=None, **kwargs
     ):
         """
         Perform a property update operation on all shapes that satisfy the
diff --git a/packages/python/plotly/plotly/tests/test_core/test_update_objects/test_update_annotations.py b/packages/python/plotly/plotly/tests/test_core/test_update_objects/test_update_annotations.py
index 26e589603..0edd3cb64 100644
--- a/packages/python/plotly/plotly/tests/test_core/test_update_objects/test_update_annotations.py
+++ b/packages/python/plotly/plotly/tests/test_core/test_update_objects/test_update_annotations.py
@@ -219,6 +219,10 @@ class TestSelectForEachUpdateAnnotations(TestCase):
             "annotations", [4], patch=dict(showarrow=False), secondary_y=True
         )
 
+    def test_annotation_attributes(self):
+        self.fig.add_annotation(text="this text", yref="paper")
+        self.fig.update_annotations(text="hi")
+
     def test_update_shapes(self):
         (
             self.fig.add_shape(opacity=0.1, fillcolor="red")
@@ -237,6 +241,11 @@ class TestSelectForEachUpdateAnnotations(TestCase):
         self.assert_update("shapes", [2, 5], patch=dict(opacity=0), col=1)
         self.assert_update("shapes", [4], patch=dict(opacity=0), secondary_y=True)
 
+    def test_shape_attributes(self):
+
+        self.fig.add_shape(fillcolor="blue", opacity=0.3)
+        self.fig.update_shapes(fillcolor="red")
+
     def test_update_images(self):
         (
             self.fig.add_layout_image(opacity=0.1, source="red")
@@ -254,3 +263,7 @@ class TestSelectForEachUpdateAnnotations(TestCase):
         self.assert_update("images", [2, 3, 4], patch=dict(opacity=0), row=1)
         self.assert_update("images", [2, 5], patch=dict(opacity=0), col=1)
         self.assert_update("images", [4], patch=dict(opacity=0), secondary_y=True)
+
+    def test_image_attributes(self):
+        self.fig.add_layout_image(name="my name", x=1, y=2)
+        self.fig.update_layout_images(opacity=0.1)