From: Aaron Griffin Date: Wed, 28 Aug 2024 21:36:30 +0000 (-0500) Subject: Improve write_pyi usage X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=679ea5c67ebbf5062891d50dabf6323cf5348d82;p=thirdparty%2Fsqlalchemy%2Falembic.git Improve write_pyi usage Due to some problems when running write_pyi, this includes the following changes: 1. move the sys.path.append up before alembic is imported - this is using global imports otherwise 2. use tox to run write_pyi in order to avoid globally installed dependencies --- diff --git a/tools/write_pyi.py b/tools/write_pyi.py index 363d727e..b2ad2300 100644 --- a/tools/write_pyi.py +++ b/tools/write_pyi.py @@ -11,12 +11,12 @@ from tempfile import NamedTemporaryFile import textwrap import typing +sys.path.append(str(Path(__file__).parent.parent)) + from alembic.autogenerate.api import AutogenContext from alembic.ddl.impl import DefaultImpl from alembic.runtime.migration import MigrationInfo -sys.path.append(str(Path(__file__).parent.parent)) - if True: # avoid flake/zimports messing with the order from alembic.operations.base import BatchOperations from alembic.operations.base import Operations diff --git a/tox.ini b/tox.ini index f1bfcac3..77439be3 100644 --- a/tox.ini +++ b/tox.ini @@ -101,3 +101,12 @@ deps= commands = flake8 ./alembic/ ./tests/ setup.py docs/build/conf.py {posargs} black --check setup.py tests alembic + +[testenv:write_pyi] +basepython = python3 +deps= + sqlalchemy>=2 + mako + zimports + black==24.1.1 +commands = python tools/write_pyi.py