In case you want to extend or speed up Python with C++
py_work_dir/
├─ pyproject.toml
├─ setup.py
├─ src/
│ └─ ql_package/
│ ├── __init__.py
│ ├── ql_std.cpp
│ └── ql_std_jit.py
package [ql_package]:
- defined in pyproject.toml & is sub-dir of dir(src)
- contains module [ql_std_jit]
module [ql_std_cpp]:
- defined in setup.py & in ql_std.cpp
- treated as built-in module
- build in dir(cpp_work_dir) where pyproject.toml is located:
py -m build
If build does not work, try installing the latest version of build:
pip install --upgrade build
- install a local package
pip install .\dist\ql_package-0.0.1.tar.gz
Download dir and files
Build & install
Run by typing command:
py cpp-vs-numpy.py
For python.h, see Extending Python with C or C++