Skip to content

Commit 20c8cd2

Browse files
authored
Fix type stub packaging (pynamodb#585)
1 parent d5bd027 commit 20c8cd2

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

setup.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33

44
from setuptools import setup, find_packages
55

6+
7+
def find_stubs(package):
8+
stubs = []
9+
for root, dirs, files in os.walk(package):
10+
for f in files:
11+
path = os.path.join(root, f).replace(package + os.sep, '', 1)
12+
if path.endswith('.pyi') or path.endswith('py.typed'):
13+
stubs.append(path)
14+
return {package: stubs}
15+
16+
617
if sys.argv[-1] == 'publish':
718
os.system('python setup.py sdist upload')
819
os.system('python setup.py bdist_wheel upload')
@@ -42,7 +53,5 @@
4253
extras_require={
4354
'signals': ['blinker>=1.3,<2.0'],
4455
},
45-
package_data={
46-
'pynamodb': ['py.typed'],
47-
},
56+
package_data=find_stubs('pynamodb'),
4857
)

0 commit comments

Comments
 (0)