]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
document no-pep681 workarounds
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 11 Mar 2023 15:38:44 +0000 (10:38 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 12 Mar 2023 16:07:41 +0000 (12:07 -0400)
commit3a4705225d2d7ccfdc48c31bd5a4436bc3830c5d
treebc953673ed32cbf0a82f124641f2348dae7f441a
parent85897db771bd3150d10ebb80cade909c69264ac0
document no-pep681 workarounds

Mypy 1.1.1 has been released which includes a non-compliant pep-681
implementation that fails with SQLAlchemy's :class:`.MappedAsDataclass` and
similar features. In order to work around this issue until Mypy is able to
release a fix, as well as to support other typing tools which may have
non-compliant pep-681 implementations, document a workaround class
for :class:`.MappedAsDataclass`.

Including this class as well as a decorator was considered, but overall
this is an issue with typing tools that they will have to resolve
and I'm not ready to set up for this issue going on long term.  There's
also no good solution for the decorator version since you have to
have an ``__init__`` method indicated somewhere.

References: https://github.com/python/mypy/issues/13856
Fixes: #9467
Change-Id: I1be6abea7f7fc72883c14ab2447edad937d0c23f
doc/build/orm/dataclasses.rst
doc/build/orm/mapping_api.rst