Loading repository data…
Loading repository data…
itsfuad / repository
Cp2P is a powerful CLI tool that automatically generates Python bindings for C++ code. It supports multiple compilers and platforms, making it easy to create Python interfaces for your C++ libraries.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
A tool to generate Python bindings for C++ code, supporting multiple compilers and platforms.
Compiler Detection:
C++ Code Analysis:
Binding Generation:
Build Process:
# Clone the repository
git clone https://github.com/yourusername/cp2p.git
cd cp2p
# Install dependencies
go mod download
# Build the tool
go build -o cp2p
# Generate bindings from a C++ file
cp2p --input example.cpp --output ./bindings
# Use a specific compiler
cp2p --input example.cpp --output ./bindings --compiler gcc
# Use a configuration file
cp2p --input example.cpp --output ./bindings --config config.json
--input: Path to the C++ source file or project entry point--output: Output directory for generated bindings (default: ./bindings)--compiler: Compiler choice (gcc, clang, msvc, auto)--config: Optional JSON config file (if not provided, will parse C++ file){
"classes": [
{
"name": "MyClass",
"methods": ["method1", "method2"],
"constructors": ["default", "withParams"]
}
],
"functions": ["globalFunc1", "globalFunc2"],
"include_paths": ["/path/to/includes"],
"compiler_flags": ["-std=c++17", "-O2"]
}
// example.cpp
#include <string>
class MyClass {
public:
MyClass() {}
std::string getMessage() { return "Hello from C++!"; }
};
// Bindings will be automatically generated for this class
# Python code using the generated bindings
from bindings import MyClass
obj = MyClass()
print(obj.getMessage()) # Output: Hello from C++!
The tool automatically detects available compilers in the following order:
# Run all tests
go test ./...
# Run specific test
go test ./compiler -run TestCompilerDetection
CompilerType enumdetect.godetect_test.goMIT License - see LICENSE file for details