Professional C++ Python bindings with type-generic templates and native threading
Project description
IncludeCPP - Professional C++ Python Bindings
Professional C++ ↔ Python binding system with type-generic templates, native threading support, and maximum performance.
Features
-
Type-Generic System: Functions work with ANY type automatically
algorithms.fast_sort([1,2,3]) # int version algorithms.fast_sort([1.5, 2.3]) # float version algorithms.fast_sort(["a","b"]) # string version
-
Native Threading with GIL Release: True parallelism
game = CPP.include("threading").GameEngine() CPP.threadThis(game) # Runs in C++ thread with GIL released
-
Dynamic Configuration:
cpp.projJSON configuration -
AppData Build System: Clean separation of project and build artifacts
-
CLI Tool:
includecpp --rebuildfor easy building -
Zero Overhead: Template instantiation eliminates runtime overhead
Installation
pip install IncludeCPP
Quick Start
1. Initialize Project
cd YourProject
includecpp init
This creates:
cpp.proj- Configuration fileinclude/- Your C++ source filesplugins/- Plugin definitions (.cp files)
2. Create C++ Module
include/mymodule.cpp:
#include <vector>
#include <algorithm>
namespace includecpp {
std::vector<int> custom_sort(const std::vector<int>& data) {
std::vector<int> result = data;
std::sort(result.begin(), result.end());
return result;
}
}
plugins/mymodule.cp:
SOURCE(include/mymodule.cpp) mymodule
PUBLIC(
mymodule FUNC(custom_sort)
)
3. Build
includecpp --rebuild
Build artifacts go to:
- Windows:
%APPDATA%/YourProject&gcc-build-proj/ - Linux:
~/.local/share/includecpp/YourProject&gcc-build-proj/
4. Use in Python
import IncludeCPP as cpp
CPP = cpp.CppApi()
CPP.noFeedback() # Disable warnings
mymodule = CPP.include("mymodule")
result = mymodule.custom_sort([5, 2, 9, 1])
print(result) # [1, 2, 5, 9]
Type-Generic Templates
# plugins/algorithms.cp
SOURCE(include/algorithms.cpp) && HEADER(include/algorithms.h) algorithms
PUBLIC(
algorithms TEMPLATE_FUNC(fast_sort) TYPES(int, float, double, string)
)
Configuration
cpp.proj (auto-created by includecpp init):
{
"project": "MyProject",
"version": "1.0.0",
"include": "/include",
"plugins": "/plugins",
"compiler": {
"standard": "c++17",
"optimization": "O3",
"flags": ["-Wall", "-pthread"]
}
}
Requirements
- Python >= 3.8
- C++ compiler (g++, clang++, or MSVC)
- pybind11 >= 2.11.0
- CMake >= 3.15
License
MIT License
Links
- Documentation: https://includecpp.readthedocs.io
- GitHub: https://github.com/includecpp/includecpp
- PyPI: https://pypi.org/project/IncludeCPP
Example: Complete Module
See the examples/ directory for complete working examples including:
- Type-generic algorithms
- Threading with GIL release
- Map and Array containers
- Custom C++ classes
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file includecpp-1.1.5.tar.gz.
File metadata
- Download URL: includecpp-1.1.5.tar.gz
- Upload date:
- Size: 18.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37d85adbfcaa42fcbe211291a026ed7d9c823fdfeecc53aba551f9cea0cec905
|
|
| MD5 |
07de22ae9c79914fa357c86b54e65576
|
|
| BLAKE2b-256 |
77bde50c559dfb89707ef5cc38d6a3cf406ad3d84a3f2e77cf9361d704c38511
|
File details
Details for the file includecpp-1.1.5-py3-none-any.whl.
File metadata
- Download URL: includecpp-1.1.5-py3-none-any.whl
- Upload date:
- Size: 21.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
772e5719823b4eef1dcb733e1aac2522a8c66a01b42f26a09f38adb481c0808f
|
|
| MD5 |
c38c5dd9b84d16e34ac1bb19d49fe91d
|
|
| BLAKE2b-256 |
f8402403f0e4cf188b48f78f4e89d455e8657a2bad5bf3c881494d67a9542a2c
|