Skip to content

Commit b2980cb

Browse files
zzzeekRamazan Elsunkaev
authored and
Ramazan Elsunkaev
committed
update Mypy plugin status
The Mypy plugin is not maintainable long-term and will be replaced by new APIs that allow for typing to work inline without the need for plugins. Change-Id: Icc7a203df1d0b19bde2fd852719b7b7215774c58 References: sqlalchemy#7535
1 parent 5ad6498 commit b2980cb

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

doc/build/orm/extensions/mypy.rst

+22-6
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,29 @@ Mypy / Pep-484 Support for ORM Mappings
66
Support for :pep:`484` typing annotations as well as the
77
`Mypy <https://mypy.readthedocs.io/>`_ type checking tool.
88

9+
.. topic:: SQLAlchemy Mypy Plugin Status Update
10+
11+
The SQLAlchemy Mypy plugin, while it has technically never left the
12+
"alpha" stage, should **now be considered as legacy**. SQLAlchemy 2.0
13+
will allow for construction of declarative mappings in place which will
14+
support proper typing directly, without the need for plugins.
15+
16+
The Mypy plugin itself does not solve the issue of supplying correct typing
17+
with other typing tools such as Pylance/Pyright, Pytype, Pycharm, etc, which
18+
cannot make use of Mypy plugins. Additionally, Mypy plugins are extremely
19+
difficult to develop, maintain and test, as a Mypy plugin must be deeply
20+
integrated with Mypy's internal datastructures and processes, which itself
21+
are not stable within the Mypy project itself. The SQLAlchemy Mypy plugin
22+
has lots of limitations when used with code that deviates from very basic
23+
patterns which are reported regularly.
24+
25+
For these reasons, new non-regression issues reported against the Mypy
26+
plugin are unlikely to be fixed; the plugin will be supplied with SQLAlchemy
27+
2.0 as well but will be legacy support only. SQLAlchemy 2.0 code that
28+
makes use of upcoming declarative APIs, which are slightly adjusted from
29+
the existing APIs, will enjoy full compliance with pep-484 as well as
30+
working correctly within IDEs and other typing tools.
931

10-
.. note:: The Mypy plugin and typing annotations should be regarded as
11-
**alpha level** for the
12-
early 1.4 releases of SQLAlchemy. The plugin has not been tested in real world
13-
scenarios and may have many unhandled cases and error conditions.
14-
Specifics of the new typing stubs are also **subject to change** during
15-
the 1.4 series.
1632

1733
Installation
1834
------------

0 commit comments

Comments
 (0)