一键导入
pybind11-interop-standards
Directs high-performance Python bindings creation, zero-copy buffer transfers, GIL management, and C++/Python memory safety.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Directs high-performance Python bindings creation, zero-copy buffer transfers, GIL management, and C++/Python memory safety.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Guides creation of modular Slint UI components, design tokens, responsive layouts, and modern aesthetics.
Manages C++20 integrations with Slint UI, CMake target linkage, thread-safe data models, and event loop dispatching.
Executes hot-reloading preview sessions and Slint LSP syntax verification for iterative UI development.
Enforces data-oriented design (SoA vs AoS), SIMD loop friendliness, Google Benchmark integration, cache-line alignment, and microbenchmarking best practices.
Enforces modern C++20 standards, RAII resource management, immutability by default, and memory locality.
Enforces hyper-dense communication protocols and strict token economy constraints. Eliminates conversational filler, meta-commentary, and redundant explanations.
| name | pybind11-interop-standards |
| description | Directs high-performance Python bindings creation, zero-copy buffer transfers, GIL management, and C++/Python memory safety. |
This skill governs the implementation, optimization, and maintenance of Python C++ extension bindings located in src/bindings/.
py::array_t<T, py::array::c_style | py::array::forcecast> to receive or export multi-dimensional array data without copying underlying memory.Cell and Trajectory coordinate buffers directly to Python using py::buffer_info.// GOOD: Zero-copy NumPy array exposure
m.def("compute_distances", [](py::array_t<double> coords) {
py::buffer_info buf = coords.request();
if (buf.ndim != 2 || buf.shape[1] != 3) {
throw std::runtime_error("Input array must have shape (N, 3)");
}
std::span<const Vector3D> points(
reinterpret_cast<const Vector3D*>(buf.ptr),
buf.shape[0]
);
return DistanceCalculator::compute(points);
});
py::gil_scoped_release before calling CPU-intensive OpenMP, TBB, or SYCL GPU calculations in C++.py::gil_scoped_acquire.// GOOD: Releasing GIL during compute phase
m.def("calculate_rdf", [](Trajectory& traj, const RDFNormalizationParams& params) {
py::gil_scoped_release release;
RDFCalculator calc;
return calc.calculate(traj, params); // Multi-threaded TBB compute loop
});
std::shared_ptr<T> as the holder type (py::class_<T, std::shared_ptr<T>>) when instances are co-owned by Python and C++ runtimes.std::invalid_argument -> ValueError, std::out_of_range -> IndexError).