summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2021-02-16 18:36:50 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2021-03-13 19:01:41 -0500
commit5f8ee3920066c0cbe5d6d6b0ceb987524f7542c4 (patch)
treeef0f08f0d88a8e9e038deaf5b15db910120e8813 /lib/sqlalchemy/testing
parent76b33bb435f1f55111cd68cde9b7cb735c748bcd (diff)
downloadsqlalchemy-5f8ee3920066c0cbe5d6d6b0ceb987524f7542c4.tar.gz
Implement Mypy plugin
Rudimentary and experimental support for Mypy has been added in the form of a new plugin, which itself depends on new typing stubs for SQLAlchemy. The plugin allows declarative mappings in their standard form to both be compatible with Mypy as well as to provide typing support for mapped classes and instances. Fixes: #4609 Change-Id: Ia035978c02ad3a5c0e5b3c6c30044dd5a3155170
Diffstat (limited to 'lib/sqlalchemy/testing')
-rw-r--r--lib/sqlalchemy/testing/requirements.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/sqlalchemy/testing/requirements.py b/lib/sqlalchemy/testing/requirements.py
index f16ba326c..de2b8f12c 100644
--- a/lib/sqlalchemy/testing/requirements.py
+++ b/lib/sqlalchemy/testing/requirements.py
@@ -1173,6 +1173,18 @@ class SuiteRequirements(Requirements):
)
@property
+ def sqlalchemy2_stubs(self):
+ def check(config):
+ try:
+ __import__("sqlalchemy-stubs.ext.mypy")
+ except ImportError:
+ return False
+ else:
+ return True
+
+ return exclusions.only_if(check)
+
+ @property
def python2(self):
return exclusions.skip_if(
lambda: sys.version_info >= (3,),