From 18f66b6333d2d021222e6db8b605caec8672afcf Mon Sep 17 00:00:00 2001 From: LemurPwned Date: Wed, 8 May 2024 21:19:31 +0200 Subject: [PATCH] another take at stubs --- setup.py | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/setup.py b/setup.py index 33308a3..fc916bc 100644 --- a/setup.py +++ b/setup.py @@ -1,12 +1,12 @@ import contextlib import os -import sys +from pathlib import Path import setuptools from setuptools import Extension, find_namespace_packages, setup from setuptools.command.build_ext import build_ext -__version__ = "1.5.1" +__version__ = "1.5.2" """ As per https://github.com/pybind/python_example @@ -128,6 +128,10 @@ def build_extensions(self): build_ext.build_extensions(self) +def find_stubs(path: Path): + return [str(pyi.relative_to(path)) for pyi in path.rglob("*.pyi")] + + setup( name="cmtj", version=__version__, @@ -140,18 +144,7 @@ def build_extensions(self): include_package_data=True, namespace_packages=["cmtj"], packages=find_namespace_packages(include=["cmtj.*"]), - package_data={"cmtj": ["py.typed", "*.pyi"]}, - data_files=[ - ("shared/typehints/python{}.{}/cmtj").format( - *sys.version_info[:2], "cmtj/__init__.pyi" - ), - ("shared/typehints/python{}.{}/cmtj/stack").format( - *sys.version_info[:2], "cmtj/stack/__init__.pyi" - ), - ("shared/typehints/python{}.{}/cmtj/noise").format( - *sys.version_info[:2], "cmtj/noise/__init__.pyi" - ), - ], + package_data={"cmtj": [*find_stubs(path=Path("cmtj"))]}, setup_requires=["pybind11>=2.6.1"], cmdclass={"build_ext": BuildExt}, zip_safe=False,