python-ldap: add package stubs - #16103
Conversation
|
Diff from mypy_primer, showing the effect of this PR on open source code: zulip (https://github.com/zulip/zulip)
- zproject/dev_settings.py:142: error: Cannot find implementation or library stub for module named "ldap" [import-not-found]
+ zproject/dev_settings.py:149: error: Module has no attribute "SCOPE_ONELEVEL" [attr-defined]
+ zproject/dev_settings.py:152: error: Module has no attribute "SCOPE_ONELEVEL" [attr-defined]
+ zproject/dev_settings.py:157: error: Module has no attribute "SCOPE_ONELEVEL" [attr-defined]
- zproject/prod_settings_template.py:177: error: Cannot find implementation or library stub for module named "ldap" [import-not-found]
+ zproject/prod_settings_template.py:228: error: Module has no attribute "SCOPE_SUBTREE" [attr-defined]
- zproject/backends.py:25: error: Cannot find implementation or library stub for module named "ldap" [import-not-found]
+ zproject/backends.py:1611: error: Module has no attribute "SCOPE_BASE" [attr-defined]
+ zproject/backends.py:1616: error: Module has no attribute "NO_SUCH_OBJECT" [attr-defined]
- zerver/lib/test_helpers.py:17: error: Cannot find implementation or library stub for module named "ldap" [import-not-found]
+ zerver/lib/test_helpers.py:62: error: Name "ldap.LDAPError" is not defined [name-defined]
+ zerver/lib/test_helpers.py:65: error: Name "ldap.INVALID_CREDENTIALS" is not defined [name-defined]
+ zerver/lib/test_helpers.py:68: error: Name "ldap.NO_SUCH_OBJECT" is not defined [name-defined]
+ zerver/lib/test_helpers.py:71: error: Name "ldap.ALREADY_EXISTS" is not defined [name-defined]
- zproject/computed_settings.py:1102: error: Cannot find implementation or library stub for module named "ldap" [import-not-found]
+ zproject/computed_settings.py:1104: error: Module has no attribute "OPT_REFERRALS" [attr-defined]
+ zproject/computed_settings.py:1114: error: Module has no attribute "OPT_REFERRALS" [attr-defined]
- zerver/tests/test_email_notifications.py:5: error: Cannot find implementation or library stub for module named "ldap" [import-not-found]
+ zerver/tests/test_email_notifications.py:298: error: Module has no attribute "SCOPE_ONELEVEL" [attr-defined]
- zerver/tests/test_auth_backends.py:19: error: Cannot find implementation or library stub for module named "ldap" [import-not-found]
+ zerver/tests/test_auth_backends.py:7781: error: Module has no attribute "SCOPE_ONELEVEL" [attr-defined]
+ zerver/tests/test_auth_backends.py:7904: error: Module has no attribute "SCOPE_ONELEVEL" [attr-defined]
+ zerver/tests/test_auth_backends.py:7907: error: Module has no attribute "SCOPE_ONELEVEL" [attr-defined]
+ zerver/tests/test_auth_backends.py:8131: error: Module has no attribute "SCOPE_ONELEVEL" [attr-defined]
+ zerver/tests/test_auth_backends.py:8515: error: Module has no attribute "LDAPError" [attr-defined]
+ zerver/tests/test_auth_backends.py:9778: error: Module has no attribute "SCOPE_ONELEVEL" [attr-defined]
+ zerver/tests/test_auth_backends.py:9845: error: Module has no attribute "SCOPE_ONELEVEL" [attr-defined]
+ zerver/tests/test_auth_backends.py:9945: error: Module has no attribute "SCOPE_ONELEVEL" [attr-defined]
- zproject/test_extra_settings.py:3: error: Cannot find implementation or library stub for module named "ldap" [import-not-found]
+ zproject/test_extra_settings.py:79: error: Module has no attribute "SCOPE_ONELEVEL" [attr-defined]
+ zproject/test_extra_settings.py:83: error: Module has no attribute "SCOPE_ONELEVEL" [attr-defined]
|
donbarbos
left a comment
There was a problem hiding this comment.
Hi, thanks for the contributing! Here are a few things I noticed during a quick review.
I noticed that Any is often used as a placeholder. In typeshed, it's generally preferred to either add a (brief) comment explaining why Any is being used or what types are expected, or use Incomplete instead.
In your case, Incomplete would be a better fit.
If you need a placeholder for "not fully typed yet", either leave out the annotation or use Incomplete (imported from _typeshed) when that's not syntactically impossible. For example, you could use Iterable[Incomplete] to mark that you know that it's an iterable, but the exact types in the iterable are to be determined.
| version = "3.4.*" | ||
| dependencies = ["types-pyasn1"] | ||
| upstream-repository = "https://github.com/python-ldap/python-ldap" | ||
| extra-description = """ | ||
| Type stubs for python-ldap, covering the public API as documented at | ||
| https://www.python-ldap.org/doc/html/api.html. | ||
| """ | ||
| partial-stub = true | ||
|
|
||
| [tool.stubtest] | ||
| stubtest-dependencies = ["python-ldap"] |
There was a problem hiding this comment.
There is no need for extra description and adding the package itself to stubtest dependencies (it is already there)
| version = "3.4.*" | |
| dependencies = ["types-pyasn1"] | |
| upstream-repository = "https://github.com/python-ldap/python-ldap" | |
| extra-description = """ | |
| Type stubs for python-ldap, covering the public API as documented at | |
| https://www.python-ldap.org/doc/html/api.html. | |
| """ | |
| partial-stub = true | |
| [tool.stubtest] | |
| stubtest-dependencies = ["python-ldap"] | |
| version = "3.4.*" | |
| upstream-repository = "https://github.com/python-ldap/python-ldap" | |
| dependencies = ["types-pyasn1"] | |
| partial-stub = true | |
| [tool.stubtest] | |
| apt-dependencies = ["libsasl2-dev"] |
| ".pytype", | ||
| "python-ldap", |
There was a problem hiding this comment.
Please, remove unrelated diffs
| ".pytype", | |
| "python-ldap", |
| "stubs/geopandas", | ||
| // test cases use a custom config file | ||
| "**/@tests/test_cases", | ||
| "python-ldap" |
There was a problem hiding this comment.
Please, remove unrelated diffs
| "python-ldap" |
There was a problem hiding this comment.
Could you also delete unused file?
Resumo
Adiciona stubs parciais para o pacote
python-ldap, incluindo módulos públicos, metadados e a dependência tipada depyasn1.Validação
PATH="$PWD/.venv/bin:$PATH" .venv/bin/python tests/runtests.py stubs/python-ldap