diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-01-09 11:49:02 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-01-24 15:14:01 -0500 |
commit | ff1ab665cb1694b85085680d1a02c7c11fa2a6d4 (patch) | |
tree | bb8414b44946d9cb96361d7dcd4a4541d8254672 /lib/sqlalchemy/sql/_typing.py | |
parent | aba3ab247da4628e4e7baf993702e2efaccbc547 (diff) | |
download | sqlalchemy-ff1ab665cb1694b85085680d1a02c7c11fa2a6d4.tar.gz |
mypy: sqlalchemy.util
Starting to set up practices and conventions to
get the library typed.
Key goals for typing are:
1. whole library can pass mypy without any strict
turned on.
2. we can incrementally turn on some strict flags on a per-package/
module basis, as here we turn on more strictness for sqlalchemy.util, exc,
and log
3. mypy ORM plugin tests work fully without sqlalchemy2-stubs
installed
4. public facing methods all have return types, major parameter
signatures filled in also
5. Foundational elements like util etc. are typed enough so that
we can use them in fully typed internals higher up the stack.
Conventions set up here:
1. we can use lots of config in setup.cfg to limit where mypy
is throwing errors and how detailed it should be in different
packages / modules. We can use this to push up gerrits
that will pass tests fully without everything being typed.
2. a new tox target pep484 is added. this links to a new jenkins
pep484 job that works across all projects (alembic, dogpile, etc.)
We've worked around some mypy bugs that will likely
be around for awhile, and also set up some core practices
for how to deal with certain things such as public_factory
modules (mypy won't accept a module from a callable at all,
so need to use simple type checking conditionals).
References: #6810
Change-Id: I80be58029896a29fd9f491aa3215422a8b705e12
Diffstat (limited to 'lib/sqlalchemy/sql/_typing.py')
-rw-r--r-- | lib/sqlalchemy/sql/_typing.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/_typing.py b/lib/sqlalchemy/sql/_typing.py new file mode 100644 index 000000000..b5b0efb21 --- /dev/null +++ b/lib/sqlalchemy/sql/_typing.py @@ -0,0 +1,9 @@ +from typing import Any +from typing import Mapping +from typing import Sequence +from typing import Union + +_SingleExecuteParams = Mapping[str, Any] +_MultiExecuteParams = Sequence[_SingleExecuteParams] +_ExecuteParams = Union[_SingleExecuteParams, _MultiExecuteParams] +_ExecuteOptions = Mapping[str, Any] |