]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
mypy: sqlalchemy.util
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 9 Jan 2022 16:49:02 +0000 (11:49 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 24 Jan 2022 20:14:01 +0000 (15:14 -0500)
commitff1ab665cb1694b85085680d1a02c7c11fa2a6d4
treebb8414b44946d9cb96361d7dcd4a4541d8254672
parentaba3ab247da4628e4e7baf993702e2efaccbc547
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
35 files changed:
.github/workflows/run-test.yaml
MANIFEST.in
lib/sqlalchemy/cyextension/collections.pyx
lib/sqlalchemy/cyextension/immutabledict.pyx
lib/sqlalchemy/engine/base.py
lib/sqlalchemy/engine/create.py
lib/sqlalchemy/engine/reflection.py
lib/sqlalchemy/event/attr.py
lib/sqlalchemy/exc.py
lib/sqlalchemy/inspection.py
lib/sqlalchemy/log.py
lib/sqlalchemy/orm/collections.py
lib/sqlalchemy/orm/decl_api.py
lib/sqlalchemy/orm/mapper.py
lib/sqlalchemy/pool/impl.py
lib/sqlalchemy/sql/_py_util.py
lib/sqlalchemy/sql/_typing.py [new file with mode: 0644]
lib/sqlalchemy/sql/util.py
lib/sqlalchemy/util/__init__.py
lib/sqlalchemy/util/_collections.py
lib/sqlalchemy/util/_concurrency_py3k.py
lib/sqlalchemy/util/_preloaded.py
lib/sqlalchemy/util/_py_collections.py
lib/sqlalchemy/util/compat.py
lib/sqlalchemy/util/concurrency.py
lib/sqlalchemy/util/deprecations.py
lib/sqlalchemy/util/langhelpers.py
lib/sqlalchemy/util/queue.py
lib/sqlalchemy/util/typing.py
pyproject.toml
setup.cfg
test/base/test_utils.py
test/engine/test_execute.py
test/orm/test_merge.py
tox.ini