Skip to content

Commit 9abf921

Browse files
author
peng.li24
committed
feat: add numpy/numpy_py.h umbrella for pybind11 wrappers
Mirrors numpy/numpy.h for the C++ core — single include for all _py.h modules: #include <numpycpp/numpy/numpy_py.h>
1 parent d08ba2d commit 9abf921

2 files changed

Lines changed: 29 additions & 6 deletions

File tree

numpy/numpy_py.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// ════════════════════════════════════════════════════════════════════════════
2+
// numpycpp — numpy/numpy_py.h [PUBLIC HEADER]
3+
//
4+
// Single umbrella header — includes all pybind11 wrapper modules.
5+
//
6+
// Usage:
7+
// #include "numpy/numpy_py.h"
8+
//
9+
// Prerequisite:
10+
// #include <pybind11/pybind11.h>
11+
// #include <pybind11/stl.h>
12+
//
13+
// Or include individual wrapper modules as needed:
14+
// #include "numpy/init_py.h" // zeros_like, ones_like, full, …
15+
// #include "numpy/elementwise_py.h" // sqrt, exp, sin, astype, …
16+
// #include "numpy/reduce_py.h" // sum, mean, std, var, cumsum, …
17+
// #include "numpy/manipulation_py.h" // transpose, take, slice, put, …
18+
// #include "numpy/io_py.h" // isin, interp, unwrap, asarray, …
19+
// #include "numpy/linalg_py.h" // dot, norm, matmul, einsum
20+
// ════════════════════════════════════════════════════════════════════════════
21+
#pragma once
22+
23+
#include "init_py.h"
24+
#include "elementwise_py.h"
25+
#include "reduce_py.h"
26+
#include "manipulation_py.h"
27+
#include "io_py.h"
28+
#include "linalg_py.h"

tests/module.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@
44

55
#include <pybind11/pybind11.h>
66
#include <pybind11/stl.h>
7-
#include "numpy/init_py.h"
8-
#include "numpy/elementwise_py.h"
9-
#include "numpy/reduce_py.h"
10-
#include "numpy/manipulation_py.h"
11-
#include "numpy/io_py.h"
12-
#include "numpy/linalg_py.h"
7+
#include "numpy/numpy_py.h"
138

149
namespace py = pybind11;
1510

0 commit comments

Comments
 (0)