]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Remove declarative_mixin
authorFederico Caselli <cfederico87@gmail.com>
Mon, 24 Feb 2025 19:46:09 +0000 (20:46 +0100)
committerFederico Caselli <cfederico87@gmail.com>
Mon, 24 Feb 2025 19:46:09 +0000 (20:46 +0100)
Removed the ``declarative_mixin`` decorator since it was used only
by the now removed mypy plugin.

Fixes: #12346
Change-Id: I6709c7b33bf99ef94c3dc074a25386e8c13c9131

doc/build/changelog/unreleased_21/12346.rst [new file with mode: 0644]
doc/build/orm/declarative_mixins.rst
doc/build/orm/mapping_api.rst
lib/sqlalchemy/orm/decl_api.py
test/orm/declarative/test_mixin.py

diff --git a/doc/build/changelog/unreleased_21/12346.rst b/doc/build/changelog/unreleased_21/12346.rst
new file mode 100644 (file)
index 0000000..9ed0885
--- /dev/null
@@ -0,0 +1,6 @@
+.. change::
+    :tags: typing, orm
+    :tickets: 12346
+
+    Deprecated the ``declarative_mixin`` decorator since it was used only
+    by the now removed mypy plugin.
index 1c6179809a2040e4401245755af5a7feb73e0ca7..8087276d9129a955d433740997710d0b4b08c8da 100644 (file)
@@ -724,7 +724,7 @@ define on the class itself. The
 here to create user-defined collation routines that pull
 from multiple collections::
 
-    from sqlalchemy.orm import declarative_mixin, declared_attr
+    from sqlalchemy.orm import declared_attr
 
 
     class MySQLSettings:
index 399111d6058467d1749470968dd87c63cae31433..f453429759951ee2fe053a88dba223ff8558a2e3 100644 (file)
@@ -13,8 +13,6 @@ Class Mapping API
 
 .. autofunction:: declarative_base
 
-.. autofunction:: declarative_mixin
-
 .. autofunction:: as_declarative
 
 .. autofunction:: mapped_column
index 97da200ef3a302d3d20296cd9282afbb98a2df73..0fadd0f7fe93a09c4035b58eee8deb2095a88f76 100644 (file)
@@ -476,6 +476,11 @@ class _stateful_declared_attr(declared_attr[_T]):
         return declared_attr(fn, **self.kw)
 
 
+@util.deprecated(
+    "2.1",
+    "The declarative_mixin decorator was used only by the now removed "
+    "mypy plugin so it has no longer any use and can be safely removed.",
+)
 def declarative_mixin(cls: Type[_T]) -> Type[_T]:
     """Mark a class as providing the feature of "declarative mixin".
 
index d670e96dcbfdd7da7e44ce0cda5aa05396592e3a..42745e46690bd01eba34b421bc87e09b92596655 100644 (file)
@@ -37,6 +37,7 @@ from sqlalchemy.testing import fixtures
 from sqlalchemy.testing import is_
 from sqlalchemy.testing import is_true
 from sqlalchemy.testing import mock
+from sqlalchemy.testing import uses_deprecated
 from sqlalchemy.testing.fixtures import fixture_session
 from sqlalchemy.testing.schema import Column
 from sqlalchemy.testing.schema import mapped_column
@@ -299,6 +300,10 @@ class DeclarativeMixinTest(DeclarativeTestBase):
         eq_(obj.name, "testing")
         eq_(obj.foo(), "bar1")
 
+    @uses_deprecated(
+        "The declarative_mixin decorator was used only by the now removed "
+        "mypy plugin so it has no longer any use and can be safely removed."
+    )
     def test_declarative_mixin_decorator(self):
         @declarative_mixin
         class MyMixin: