summaryrefslogtreecommitdiff
path: root/setup.cfg
diff options
context:
space:
mode:
authorRan Benita <ran@unusedvar.com>2020-07-31 09:46:56 +0300
committerRan Benita <ran@unusedvar.com>2020-07-31 10:09:11 +0300
commit8d98de8f8aef70a68ec98c1dd7ed0291efb37429 (patch)
tree5a44e3d28b63a63dd380e7ff52ddb1199f3353b7 /setup.cfg
parent645cbc91fc1db67a36cca5c5be26e889e81cc768 (diff)
downloadpytest-8d98de8f8aef70a68ec98c1dd7ed0291efb37429.tar.gz
typing: set no_implicit_reexport
In Python, if module A defines a name `name`, and module B does `import name from A`, then another module C can `import name from B`. Sometimes it is intentional -- module B is meant to "reexport" `name`. But sometimes it is just confusion/inconsistency on where `name` should be imported from. mypy has a flag `--no-implicit-reexport` which puts some order into this. A name can only be imported from a module if 1. The module defines the name 2. The module's `__all__` includes the name 3. The module imports the name as `from ... import .. as name`. This flag is included in mypy's `--strict` flag. I like this flag, but I realize it is a bit controversial, and in particular item 3 above is a bit unfriendly to contributors who don't know about it. So I didn't intend to add it to pytest. But while investigating issue 7589 I came upon mypy issue 8754 which causes `--no-implicit-reexport` to leak into installed libraries and causes some unexpected typing differences *in pytest* if the user uses this flag. Since the diff mostly makes sense, let's just conform to it.
Diffstat (limited to 'setup.cfg')
-rw-r--r--setup.cfg1
1 files changed, 1 insertions, 0 deletions
diff --git a/setup.cfg b/setup.cfg
index 31123f28e..4a86e7ec1 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -104,3 +104,4 @@ strict_equality = True
warn_redundant_casts = True
warn_return_any = True
warn_unused_configs = True
+no_implicit_reexport = True