Skip to content

Pyright in "strict" mode complains about "begin_transaction" #1201

@AlexanderPodorov

Description

@AlexanderPodorov

When env.py is generated, this line is usually added:

from alembic.context import begin_transaction

VSCode (pylance/pyright) compains about it saying:
Type of "begin_transaction" is partially unknown
Most likely because of:

def begin_transaction() -> Union[_ProxyTransaction, ContextManager]:

where the type of ContextManager generic is not specified

Expected behavior
No warnings

Versions.

  • OS: MacOS
  • Python: 3.11.2
  • Alembic: 1.10.1
  • SQLAlchemy: 2.0.5.post1
  • Database: Postgres 15
  • DBAPI: asyncpg

Have a nice day!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions