Skip to content

Commit e203e04

Browse files
committed
[python-ldap] Integrate typing into the build/CI system
1 parent 979f24d commit e203e04

File tree

5 files changed

+35
-7
lines changed

5 files changed

+35
-7
lines changed

Lib/ldap/py.typed

Whitespace-only changes.

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
include MANIFEST.in Makefile CHANGES INSTALL LICENCE README TODO
22
include tox.ini .coveragerc
33
include Modules/*.c Modules/*.h
4+
include Lib/ldap/py.typed
5+
include Lib/_ldap.pyi
46
recursive-include Build *.cfg*
57
recursive-include Lib *.py
68
recursive-include Demo *.py

setup.cfg

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,14 @@ python_files = t_*.py
4949
filterwarnings =
5050
error
5151
ignore::ldap.LDAPBytesWarning
52+
53+
# mypy, https://mypy.readthedocs.io/en/latest/
54+
[mypy]
55+
strict = True
56+
files = Lib/
57+
58+
[mypy-pyasn1.*]
59+
ignore_missing_imports = True
60+
61+
[mypy-pyasn1_modules.*]
62+
ignore_missing_imports = True

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ class OpenLDAP2:
157157
install_requires=[
158158
'pyasn1 >= 0.3.7',
159159
'pyasn1_modules >= 0.1.5',
160+
'typing_extensions',
160161
],
161162
zip_safe=False,
162163
python_requires='>=3.6',

tox.ini

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,25 @@
44
# and then run "tox" from this directory.
55

66
[tox]
7-
# Note: when updating Python versions, also change setup.py and .github/worlflows/*
8-
envlist = py{36,37,38,39,310,311,312},c90-py{36,37},py3-nosasltls,doc,py3-trace,pypy3.9
7+
# Note: when updating Python versions, also change setup.py and .github/workflows/*
8+
envlist =
9+
py{36,37,38,39,310,311,312}
10+
c90-py{36,37}
11+
py3-nosasltls
12+
doc
13+
mypy
14+
py3-trace
15+
pypy3.9
916
minver = 1.8
1017

1118
[gh-actions]
1219
python =
1320
3.6: py36
14-
3.7: py37
15-
3.8: py38, doc, py3-nosasltls
16-
3.9: py39, py3-trace
17-
3.10: py310
18-
3.11: py311
21+
3.7: py37, mypy
22+
3.8: py38, mypy, doc, py3-nosasltls
23+
3.9: py39, mypy, py3-trace
24+
3.10: py310, mypy
25+
3.11: py311, mypy
1926
3.12: py312
2027
pypy3.9: pypy3.9
2128

@@ -42,6 +49,7 @@ deps =
4249
{[testenv]deps}
4350
pyasn1
4451
pyasn1_modules
52+
typing_extensions
4553
passenv = {[testenv]passenv}
4654
setenv =
4755
CI_DISABLED=LDAPI:SASL:TLS
@@ -91,6 +99,12 @@ basepython = pypy3
9199
deps = pytest
92100
commands = {envpython} -m pytest {posargs}
93101

102+
[testenv:mypy]
103+
basepython = python3
104+
deps = mypy
105+
commands =
106+
{envpython} -m mypy --config-file {toxinidir}/setup.cfg {posargs}
107+
94108
[testenv:doc]
95109
basepython = python3
96110
deps =

0 commit comments

Comments
 (0)