File tree Expand file tree Collapse file tree 5 files changed +40
-1
lines changed Expand file tree Collapse file tree 5 files changed +40
-1
lines changed Original file line number Diff line number Diff line change
1
+ import pycmtemplate_c
2
+
3
+ functionFromCPP = pycmtemplate_c .functionFromCPP
4
+ functionFromCPP2 = pycmtemplate_c .functionFromCPP2
5
+
6
+ variableFromCPP = pycmtemplate_c .variableFromCPP
7
+ variableFromCPP2 = pycmtemplate_c .variableFromCPP2
Original file line number Diff line number Diff line change
1
+ """
2
+ Interface file for the C++ module. (pycmtemplate/ctopy.pyi)
3
+ This file is used to define the interface of the C++ module.
4
+ The interface file is used by the Python type checker to check the types of the C++ module.
5
+ """
6
+
7
+ # Function definitions
8
+ def functionFromCPP () -> int : ...
9
+ def functionFromCPP2 (a : int , b : int ) -> int : ...
10
+
11
+ # Variable definitions
12
+ variableFromCPP : int
13
+ variableFromCPP2 : str
Original file line number Diff line number Diff line change 1
- from setuptools import setup , Extension
1
+ from setuptools import setup , Extension , find_packages
2
2
3
3
# C/C++ extension module configuration
4
4
module = Extension (
15
15
long_description = "Python C/C++ template project" ,
16
16
author = "Etkin Dogan" ,
17
17
18
+ packages = find_packages (),
19
+ install_requires = [],
18
20
python_requires = ">=3.8" ,
19
21
ext_modules = [module ],
22
+ package_data = {
23
+ # Required for .pyi files to be included in the package
24
+ "pycmtemplate" : ["py.typed" ],
25
+ },
20
26
)
Original file line number Diff line number Diff line change
1
+ import pycmtemplate
2
+
3
+ print ("Function calls" )
4
+ r1 = pycmtemplate .functionFromCPP ()
5
+ r2 = pycmtemplate .functionFromCPP2 (3 , 5 )
6
+
7
+ print ("Print results" )
8
+ print (r1 )
9
+ print (r2 )
10
+
11
+ print ("Print variables" )
12
+ print (pycmtemplate .variableFromCPP )
13
+ print (pycmtemplate .variableFromCPP2 )
You can’t perform that action at this time.
0 commit comments