]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commit
generate .pyi files for proxied classes
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 11 Aug 2021 19:58:16 +0000 (15:58 -0400)
committerCaselIT <cfederico87@gmail.com>
Sun, 22 Aug 2021 20:14:40 +0000 (22:14 +0200)
commit1977047a11124221461ad8daee502bc4c74d5f6c
tree3d574f53ef89569f57caaaa6fd9b94f46a08e154
parent6aad68605f510e8b51f42efa812e02b3831d6e33
generate .pyi files for proxied classes

Stub .pyi files have been added for the "dynamically"
generated Alembic modules ``alembic.op`` and ``alembic.context``, which
include complete function signatures and docstrings, so that the functions
in these namespaces will have both IDE support (vscode, pycharm, etc) as
well as support for typing tools like Mypy. The files themselves are
statically generated from their source functions within the source tree.

Still not available is sphinx autodoc from the .pyi file.  so
we might want to further modify this to write into the .py directly.

if we do *that*, we could almost get rid of ModuleClsProxy and
just generate proxying methods fully in op.py.  however, this won't work
for the "extending ops" use case.

Change-Id: I3f084040de25ed3f8e92a4e9d0bb83d69b78eac6
15 files changed:
alembic/config.py
alembic/context.pyi [new file with mode: 0644]
alembic/op.pyi [new file with mode: 0644]
alembic/operations/base.py
alembic/py.typed [new file with mode: 0644]
alembic/script/write_hooks.py
alembic/testing/__init__.py
alembic/util/compat.py
alembic/util/langhelpers.py
alembic/util/sqla_compat.py
docs/build/unreleased/py3_typing.rst
setup.cfg
tests/test_stubs.py [new file with mode: 0644]
tools/write_pyi.py [new file with mode: 0644]
tox.ini