Skip to content

Commit 06f7a31

Browse files
committed
add example with stubs
1 parent 40f2491 commit 06f7a31

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

python_example/_C/__init__.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
def add(a: int, b: int) ->int:...
2+
3+
def subtract(a: int, b: int) ->int:...

python_example/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from python_example._C import *

setup.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Available at setup time due to pyproject.toml
22
from pybind11.setup_helpers import Pybind11Extension, build_ext
3-
from setuptools import setup
3+
from setuptools import setup, find_packages
44

55
__version__ = "0.0.1"
66

@@ -15,7 +15,7 @@
1515

1616
ext_modules = [
1717
Pybind11Extension(
18-
"python_example",
18+
"python_example/_C",
1919
["src/main.cpp"],
2020
# Example: passing in the version to the compiled code
2121
define_macros=[("VERSION_INFO", __version__)],
@@ -30,8 +30,10 @@
3030
url="https://github.com/pybind/python_example",
3131
description="A test project using pybind11",
3232
long_description="",
33+
packages=find_packages(include="python_example/*"),
3334
ext_modules=ext_modules,
3435
extras_require={"test": "pytest"},
36+
package_data={"python_example": ["_C/*.pyi"]},
3537
# Currently, build_ext only provides an optional "highest supported C++
3638
# level" feature, but in the future it may provide more features.
3739
cmdclass={"build_ext": build_ext},

0 commit comments

Comments
 (0)