nodepyx 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +399 -0
  3. package/binding.gyp +73 -0
  4. package/dist/core/PyCallable.d.ts +65 -0
  5. package/dist/core/PyCallable.d.ts.map +1 -0
  6. package/dist/core/PyCallable.js +109 -0
  7. package/dist/core/PyCallable.js.map +1 -0
  8. package/dist/core/PyContext.d.ts +76 -0
  9. package/dist/core/PyContext.d.ts.map +1 -0
  10. package/dist/core/PyContext.js +228 -0
  11. package/dist/core/PyContext.js.map +1 -0
  12. package/dist/core/PyIterator.d.ts +84 -0
  13. package/dist/core/PyIterator.d.ts.map +1 -0
  14. package/dist/core/PyIterator.js +243 -0
  15. package/dist/core/PyIterator.js.map +1 -0
  16. package/dist/core/PyModule.d.ts +55 -0
  17. package/dist/core/PyModule.d.ts.map +1 -0
  18. package/dist/core/PyModule.js +172 -0
  19. package/dist/core/PyModule.js.map +1 -0
  20. package/dist/core/PyProxy.d.ts +65 -0
  21. package/dist/core/PyProxy.d.ts.map +1 -0
  22. package/dist/core/PyProxy.js +483 -0
  23. package/dist/core/PyProxy.js.map +1 -0
  24. package/dist/core/PyRuntime.d.ts +105 -0
  25. package/dist/core/PyRuntime.d.ts.map +1 -0
  26. package/dist/core/PyRuntime.js +438 -0
  27. package/dist/core/PyRuntime.js.map +1 -0
  28. package/dist/env/CondaManager.d.ts +118 -0
  29. package/dist/env/CondaManager.d.ts.map +1 -0
  30. package/dist/env/CondaManager.js +401 -0
  31. package/dist/env/CondaManager.js.map +1 -0
  32. package/dist/env/PackageInstaller.d.ts +233 -0
  33. package/dist/env/PackageInstaller.d.ts.map +1 -0
  34. package/dist/env/PackageInstaller.js +609 -0
  35. package/dist/env/PackageInstaller.js.map +1 -0
  36. package/dist/env/PythonDetector.d.ts +103 -0
  37. package/dist/env/PythonDetector.d.ts.map +1 -0
  38. package/dist/env/PythonDetector.js +381 -0
  39. package/dist/env/PythonDetector.js.map +1 -0
  40. package/dist/env/VenvManager.d.ts +117 -0
  41. package/dist/env/VenvManager.d.ts.map +1 -0
  42. package/dist/env/VenvManager.js +331 -0
  43. package/dist/env/VenvManager.js.map +1 -0
  44. package/dist/index.d.ts +169 -0
  45. package/dist/index.d.ts.map +1 -0
  46. package/dist/index.js +393 -0
  47. package/dist/index.js.map +1 -0
  48. package/dist/plugins/Plugin.interface.d.ts +41 -0
  49. package/dist/plugins/Plugin.interface.d.ts.map +1 -0
  50. package/dist/plugins/Plugin.interface.js +12 -0
  51. package/dist/plugins/Plugin.interface.js.map +1 -0
  52. package/dist/plugins/PluginManager.d.ts +26 -0
  53. package/dist/plugins/PluginManager.d.ts.map +1 -0
  54. package/dist/plugins/PluginManager.js +174 -0
  55. package/dist/plugins/PluginManager.js.map +1 -0
  56. package/dist/plugins/builtin/NumpyPlugin.d.ts +17 -0
  57. package/dist/plugins/builtin/NumpyPlugin.d.ts.map +1 -0
  58. package/dist/plugins/builtin/NumpyPlugin.js +41 -0
  59. package/dist/plugins/builtin/NumpyPlugin.js.map +1 -0
  60. package/dist/plugins/builtin/PandasPlugin.d.ts +19 -0
  61. package/dist/plugins/builtin/PandasPlugin.d.ts.map +1 -0
  62. package/dist/plugins/builtin/PandasPlugin.js +57 -0
  63. package/dist/plugins/builtin/PandasPlugin.js.map +1 -0
  64. package/dist/plugins/builtin/TorchPlugin.d.ts +23 -0
  65. package/dist/plugins/builtin/TorchPlugin.d.ts.map +1 -0
  66. package/dist/plugins/builtin/TorchPlugin.js +50 -0
  67. package/dist/plugins/builtin/TorchPlugin.js.map +1 -0
  68. package/dist/plugins/index.d.ts +7 -0
  69. package/dist/plugins/index.d.ts.map +1 -0
  70. package/dist/plugins/index.js +12 -0
  71. package/dist/plugins/index.js.map +1 -0
  72. package/dist/serialization/DataFrameBridge.d.ts +141 -0
  73. package/dist/serialization/DataFrameBridge.d.ts.map +1 -0
  74. package/dist/serialization/DataFrameBridge.js +355 -0
  75. package/dist/serialization/DataFrameBridge.js.map +1 -0
  76. package/dist/serialization/MsgPackSerializer.d.ts +45 -0
  77. package/dist/serialization/MsgPackSerializer.d.ts.map +1 -0
  78. package/dist/serialization/MsgPackSerializer.js +242 -0
  79. package/dist/serialization/MsgPackSerializer.js.map +1 -0
  80. package/dist/serialization/NumpyBridge.d.ts +96 -0
  81. package/dist/serialization/NumpyBridge.d.ts.map +1 -0
  82. package/dist/serialization/NumpyBridge.js +323 -0
  83. package/dist/serialization/NumpyBridge.js.map +1 -0
  84. package/dist/serialization/Serializer.d.ts +78 -0
  85. package/dist/serialization/Serializer.d.ts.map +1 -0
  86. package/dist/serialization/Serializer.js +281 -0
  87. package/dist/serialization/Serializer.js.map +1 -0
  88. package/dist/types/PythonTypeMapper.d.ts +87 -0
  89. package/dist/types/PythonTypeMapper.d.ts.map +1 -0
  90. package/dist/types/PythonTypeMapper.js +449 -0
  91. package/dist/types/PythonTypeMapper.js.map +1 -0
  92. package/dist/types/StubCache.d.ts +109 -0
  93. package/dist/types/StubCache.d.ts.map +1 -0
  94. package/dist/types/StubCache.js +333 -0
  95. package/dist/types/StubCache.js.map +1 -0
  96. package/dist/types/TypeGenerator.d.ts +139 -0
  97. package/dist/types/TypeGenerator.d.ts.map +1 -0
  98. package/dist/types/TypeGenerator.js +372 -0
  99. package/dist/types/TypeGenerator.js.map +1 -0
  100. package/dist/types/addon.d.ts +114 -0
  101. package/dist/types/addon.d.ts.map +1 -0
  102. package/dist/types/addon.js +32 -0
  103. package/dist/types/addon.js.map +1 -0
  104. package/dist/types/config.d.ts +175 -0
  105. package/dist/types/config.d.ts.map +1 -0
  106. package/dist/types/config.js +35 -0
  107. package/dist/types/config.js.map +1 -0
  108. package/dist/types/index.d.ts +10 -0
  109. package/dist/types/index.d.ts.map +1 -0
  110. package/dist/types/index.js +12 -0
  111. package/dist/types/index.js.map +1 -0
  112. package/dist/types/python.d.ts +235 -0
  113. package/dist/types/python.d.ts.map +1 -0
  114. package/dist/types/python.js +7 -0
  115. package/dist/types/python.js.map +1 -0
  116. package/dist/utils/ErrorTranslator.d.ts +83 -0
  117. package/dist/utils/ErrorTranslator.d.ts.map +1 -0
  118. package/dist/utils/ErrorTranslator.js +210 -0
  119. package/dist/utils/ErrorTranslator.js.map +1 -0
  120. package/dist/utils/Logger.d.ts +27 -0
  121. package/dist/utils/Logger.d.ts.map +1 -0
  122. package/dist/utils/Logger.js +115 -0
  123. package/dist/utils/Logger.js.map +1 -0
  124. package/dist/utils/MemoryMonitor.d.ts +44 -0
  125. package/dist/utils/MemoryMonitor.d.ts.map +1 -0
  126. package/dist/utils/MemoryMonitor.js +143 -0
  127. package/dist/utils/MemoryMonitor.js.map +1 -0
  128. package/package.json +177 -0
  129. package/python/error_handler.py +433 -0
  130. package/python/nodepyx_runtime.py +575 -0
  131. package/python/serializer.py +379 -0
  132. package/python/type_inspector.py +288 -0
  133. package/scripts/build-native.js +68 -0
  134. package/scripts/download-prebuilds.js +99 -0
  135. package/scripts/generate-stubs.js +405 -0
  136. package/scripts/install.js +260 -0
  137. package/src/core/PyCallable.ts +137 -0
  138. package/src/core/PyContext.ts +296 -0
  139. package/src/core/PyIterator.ts +294 -0
  140. package/src/core/PyModule.ts +194 -0
  141. package/src/core/PyProxy.ts +605 -0
  142. package/src/core/PyRuntime.ts +504 -0
  143. package/src/env/CondaManager.ts +451 -0
  144. package/src/env/PackageInstaller.ts +738 -0
  145. package/src/env/PythonDetector.ts +414 -0
  146. package/src/env/VenvManager.ts +396 -0
  147. package/src/index.ts +425 -0
  148. package/src/native/gil_guard.cpp +26 -0
  149. package/src/native/gil_guard.h +175 -0
  150. package/src/native/nodepyx_addon.cpp +886 -0
  151. package/src/native/python_bridge.cpp +790 -0
  152. package/src/native/python_bridge.h +257 -0
  153. package/src/native/thread_pool.cpp +336 -0
  154. package/src/native/thread_pool.h +175 -0
  155. package/src/native/type_converter.cpp +901 -0
  156. package/src/native/type_converter.h +272 -0
  157. package/src/nextjs/PyProvider.tsx +123 -0
  158. package/src/nextjs/index.ts +21 -0
  159. package/src/nextjs/usePython.ts +106 -0
  160. package/src/nextjs/withnodepyx.ts +88 -0
  161. package/src/plugins/Plugin.interface.ts +51 -0
  162. package/src/plugins/PluginManager.ts +155 -0
  163. package/src/plugins/builtin/NumpyPlugin.ts +36 -0
  164. package/src/plugins/builtin/PandasPlugin.ts +49 -0
  165. package/src/plugins/builtin/TorchPlugin.ts +56 -0
  166. package/src/plugins/index.ts +7 -0
  167. package/src/serialization/DataFrameBridge.ts +398 -0
  168. package/src/serialization/MsgPackSerializer.ts +220 -0
  169. package/src/serialization/NumpyBridge.ts +332 -0
  170. package/src/serialization/Serializer.ts +320 -0
  171. package/src/types/PythonTypeMapper.ts +495 -0
  172. package/src/types/StubCache.ts +340 -0
  173. package/src/types/TypeGenerator.ts +491 -0
  174. package/src/types/addon.ts +170 -0
  175. package/src/types/config.ts +226 -0
  176. package/src/types/index.ts +55 -0
  177. package/src/types/python.ts +309 -0
  178. package/src/types/stubs/numpy.d.ts +441 -0
  179. package/src/types/stubs/pandas.d.ts +575 -0
  180. package/src/types/stubs/sklearn.d.ts +728 -0
  181. package/src/types/stubs/torch.d.ts +694 -0
  182. package/src/utils/ErrorTranslator.ts +220 -0
  183. package/src/utils/Logger.ts +119 -0
  184. package/src/utils/MemoryMonitor.ts +175 -0
@@ -0,0 +1,175 @@
1
+ /**
2
+ * nodepyx — Core Configuration Types
3
+ * Full configuration interface for nodepyx runtime initialization.
4
+ */
5
+ export type LogLevel = 'silent' | 'error' | 'warn' | 'info' | 'debug';
6
+ export interface VirtualenvConfig {
7
+ /** Path to virtualenv directory (e.g. './.nodepyx/venv') */
8
+ path: string;
9
+ /** Python packages to install (e.g. ['pandas', 'numpy', 'scikit-learn']) */
10
+ packages: string[];
11
+ /** Automatically install missing packages at startup */
12
+ autoInstall: boolean;
13
+ /** pip index URL override */
14
+ pipIndexUrl?: string;
15
+ /** Additional pip install args */
16
+ pipArgs?: string[];
17
+ }
18
+ export interface CondaConfig {
19
+ /** Name of the conda environment */
20
+ envName: string;
21
+ /** Path to conda executable */
22
+ condaPath?: string;
23
+ /** Channels to search for packages */
24
+ channels?: string[];
25
+ /** Packages to ensure are installed */
26
+ packages?: string[];
27
+ }
28
+ export interface GILConfig {
29
+ /**
30
+ * How often to release the GIL during long Python operations (microseconds).
31
+ * Lower values improve Node.js responsiveness at cost of Python throughput.
32
+ * Default: 5000 (5ms)
33
+ */
34
+ releaseInterval?: number;
35
+ /**
36
+ * Maximum time to wait for GIL acquisition before timing out (milliseconds).
37
+ * Default: 10000 (10s)
38
+ */
39
+ acquireTimeout?: number;
40
+ }
41
+ export interface ThreadPoolConfig {
42
+ /** Number of worker threads for Python execution. Default: 4 */
43
+ size?: number;
44
+ /** Max queue depth before backpressure is applied. Default: 1000 */
45
+ maxQueueSize?: number;
46
+ /** Thread idle timeout before shrinking pool (ms). Default: 30000 */
47
+ idleTimeout?: number;
48
+ }
49
+ export interface MemoryConfig {
50
+ /** Maximum Python heap size (e.g. '2GB', '512MB'). Default: '2GB' */
51
+ limit?: string;
52
+ /** Trigger Python GC when heap exceeds this threshold. Default: '1GB' */
53
+ gcThreshold?: string;
54
+ /** Enable leak detection in debug builds. Default: false */
55
+ leakDetection?: boolean;
56
+ }
57
+ export interface ProfilingConfig {
58
+ /** Enable CPU profiling. Default: false */
59
+ enabled?: boolean;
60
+ /** Output file for profile data */
61
+ outputFile?: string;
62
+ /** Sampling interval (microseconds). Default: 1000 */
63
+ samplingInterval?: number;
64
+ }
65
+ export interface nodepyxConfig {
66
+ /**
67
+ * Path to Python executable or virtualenv root.
68
+ * If not specified, auto-detects system Python.
69
+ * Examples: '/usr/bin/python3', './.venv', '/opt/conda/envs/myenv'
70
+ */
71
+ pythonPath?: string;
72
+ /**
73
+ * Virtualenv configuration — creates and manages a dedicated virtualenv.
74
+ * Takes precedence over pythonPath if specified.
75
+ */
76
+ virtualenv?: VirtualenvConfig;
77
+ /**
78
+ * Conda environment configuration.
79
+ * Takes precedence over virtualenv and pythonPath if specified.
80
+ */
81
+ conda?: CondaConfig;
82
+ /**
83
+ * Thread pool configuration for Python execution.
84
+ */
85
+ threadPool?: ThreadPoolConfig;
86
+ /**
87
+ * Legacy shorthand for threadPool.size.
88
+ * @deprecated Use threadPool.size instead.
89
+ */
90
+ threadPoolSize?: number;
91
+ /**
92
+ * Memory configuration for Python heap.
93
+ */
94
+ memory?: MemoryConfig;
95
+ /**
96
+ * Legacy shorthand for memory.limit.
97
+ * @deprecated Use memory.limit instead.
98
+ */
99
+ memoryLimit?: string;
100
+ /**
101
+ * Directory for TypeScript type stubs generated from Python modules.
102
+ * Default: './.nodepyx/stubs'
103
+ */
104
+ stubsDir?: string;
105
+ /**
106
+ * Log level for nodepyx internal logging.
107
+ * Default: 'warn'
108
+ */
109
+ logLevel?: LogLevel;
110
+ /**
111
+ * Profiling configuration.
112
+ */
113
+ profiling?: ProfilingConfig;
114
+ /**
115
+ * Legacy shorthand for profiling.enabled.
116
+ * @deprecated Use profiling.enabled instead.
117
+ */
118
+ enableProfiling?: boolean;
119
+ /**
120
+ * Timeout for individual Python calls (milliseconds).
121
+ * Default: 30000 (30s)
122
+ */
123
+ callTimeout?: number;
124
+ /**
125
+ * GIL (Global Interpreter Lock) management configuration.
126
+ */
127
+ gil?: GILConfig;
128
+ /**
129
+ * Additional Python sys.path entries.
130
+ * Inserted at sys.path[0] in order.
131
+ */
132
+ pythonPath_extra?: string[];
133
+ /**
134
+ * Environment variables to set for the Python interpreter.
135
+ */
136
+ env?: Record<string, string>;
137
+ /**
138
+ * Enable experimental features. Use with caution.
139
+ */
140
+ experimental?: {
141
+ /** Use SharedArrayBuffer for NumPy transfers. Default: true */
142
+ sharedArrayBuffer?: boolean;
143
+ /** Cache Proxy chain resolutions. Default: true */
144
+ proxyCache?: boolean;
145
+ /** Lazy attribute resolution. Default: true */
146
+ lazyResolution?: boolean;
147
+ };
148
+ }
149
+ /**
150
+ * Resolved and normalized configuration (all fields filled with defaults).
151
+ */
152
+ export interface ResolvednodepyxConfig {
153
+ pythonExecutable: string;
154
+ pythonHome: string;
155
+ threadPoolSize: number;
156
+ maxQueueSize: number;
157
+ idleTimeout: number;
158
+ memoryLimit: string;
159
+ gcThreshold: string;
160
+ leakDetection: boolean;
161
+ stubsDir: string;
162
+ logLevel: LogLevel;
163
+ callTimeout: number;
164
+ gil: Required<GILConfig>;
165
+ profilingEnabled: boolean;
166
+ profilingFile?: string;
167
+ profilingSamplingInterval: number;
168
+ sharedArrayBuffer: boolean;
169
+ proxyCache: boolean;
170
+ lazyResolution: boolean;
171
+ env: Record<string, string>;
172
+ pythonPathExtra: string[];
173
+ }
174
+ export declare function resolveConfig(config?: nodepyxConfig): ResolvednodepyxConfig;
175
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEtE,MAAM,WAAW,gBAAgB;IAC/B,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,wDAAwD;IACxD,WAAW,EAAE,OAAO,CAAC;IACrB,6BAA6B;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kCAAkC;IAClC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAA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AAkB,GAAG,qBAAqB,CA0B/E"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ /**
3
+ * nodepyx — Core Configuration Types
4
+ * Full configuration interface for nodepyx runtime initialization.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.resolveConfig = resolveConfig;
8
+ function resolveConfig(config = {}) {
9
+ return {
10
+ pythonExecutable: config.pythonPath ?? 'python3',
11
+ pythonHome: config.pythonPath ?? '',
12
+ threadPoolSize: config.threadPool?.size ?? config.threadPoolSize ?? 4,
13
+ maxQueueSize: config.threadPool?.maxQueueSize ?? 1000,
14
+ idleTimeout: config.threadPool?.idleTimeout ?? 30000,
15
+ memoryLimit: config.memory?.limit ?? config.memoryLimit ?? '2GB',
16
+ gcThreshold: config.memory?.gcThreshold ?? '1GB',
17
+ leakDetection: config.memory?.leakDetection ?? false,
18
+ stubsDir: config.stubsDir ?? './.nodepyx/stubs',
19
+ logLevel: config.logLevel ?? 'warn',
20
+ callTimeout: config.callTimeout ?? 30000,
21
+ gil: {
22
+ releaseInterval: config.gil?.releaseInterval ?? 5000,
23
+ acquireTimeout: config.gil?.acquireTimeout ?? 10000,
24
+ },
25
+ profilingEnabled: config.profiling?.enabled ?? config.enableProfiling ?? false,
26
+ profilingFile: config.profiling?.outputFile,
27
+ profilingSamplingInterval: config.profiling?.samplingInterval ?? 1000,
28
+ sharedArrayBuffer: config.experimental?.sharedArrayBuffer ?? true,
29
+ proxyCache: config.experimental?.proxyCache ?? true,
30
+ lazyResolution: config.experimental?.lazyResolution ?? true,
31
+ env: config.env ?? {},
32
+ pythonPathExtra: config.pythonPath_extra ?? [],
33
+ };
34
+ }
35
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAmMH,sCA0BC;AA1BD,SAAgB,aAAa,CAAC,SAAwB,EAAE;IACtD,OAAO;QACL,gBAAgB,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AAe,EAAE,MAAM,CAAC,gBAAgB,IAAI,EAAE;KAC/C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * nodepyx — Types Index
3
+ * Re-exports all public type definitions.
4
+ */
5
+ export type { nodepyxConfig, ResolvednodepyxConfig, VirtualenvConfig, CondaConfig, GILConfig, ThreadPoolConfig, MemoryConfig, ProfilingConfig, LogLevel, } from './config';
6
+ export { resolveConfig } from './config';
7
+ export type { PyObjectId, PyTypeName, PyTypeInfo, PyParamInfo, PyMemberInfo, PyCallableInfo, PyClassInfo, PyModuleInspection, SerializedFormat, SerializedValue, SerializedMetadata, PyCallResult, PyErrorInfo, PyIteratorState, PyIteratorNext, DataFrameResult, SeriesResult, NumPyArrayResult, AttributePath, PyProxyInterface, } from './python';
8
+ export type { NativeAddon, AddonInitOptions, AddonImportResult, AddonAttributeResult, AddonCallOptions, AddonIteratorResult, AddonMemoryStats, AddonProfilingReport, } from './addon';
9
+ export { loadNativeAddon } from './addon';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EACV,aAAa,EACb,qBAAqB,EACrB,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,QAAQ,GACT,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,YAAY,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACZ,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,eAAe,EACf,cAAc,EACd,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,gBAAgB,GACjB,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ /**
3
+ * nodepyx — Types Index
4
+ * Re-exports all public type definitions.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.loadNativeAddon = exports.resolveConfig = void 0;
8
+ var config_1 = require("./config");
9
+ Object.defineProperty(exports, "resolveConfig", { enumerable: true, get: function () { return config_1.resolveConfig; } });
10
+ var addon_1 = require("./addon");
11
+ Object.defineProperty(exports, "loadNativeAddon", { enumerable: true, get: function () { return addon_1.loadNativeAddon; } });
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAcH,mCAAyC;AAAhC,uGAAA,aAAa,OAAA;AAoCtB,iCAA0C;AAAjC,wGAAA,eAAe,OAAA"}
@@ -0,0 +1,235 @@
1
+ /**
2
+ * nodepyx — Python Object Type Definitions
3
+ * Core types for representing Python objects in TypeScript.
4
+ */
5
+ /**
6
+ * Unique identifier for a Python object in the CPython heap.
7
+ * Stored as a C-level pointer (opaque to JavaScript).
8
+ */
9
+ export type PyObjectId = number & {
10
+ readonly __brand: 'PyObjectId';
11
+ };
12
+ /**
13
+ * Python built-in type names.
14
+ */
15
+ export type PyTypeName = 'int' | 'float' | 'complex' | 'bool' | 'str' | 'bytes' | 'bytearray' | 'list' | 'tuple' | 'dict' | 'set' | 'frozenset' | 'NoneType' | 'function' | 'method' | 'builtin_function_or_method' | 'module' | 'type' | 'classmethod' | 'staticmethod' | 'property' | 'generator' | 'coroutine' | 'async_generator' | 'iterator' | 'DataFrame' | 'Series' | 'ndarray' | 'Tensor' | string;
16
+ /**
17
+ * Metadata about a Python object's type.
18
+ */
19
+ export interface PyTypeInfo {
20
+ typeName: PyTypeName;
21
+ moduleName?: string;
22
+ qualName?: string;
23
+ isCallable: boolean;
24
+ isIterable: boolean;
25
+ isAsyncIterable: boolean;
26
+ isAwaitable: boolean;
27
+ isClass: boolean;
28
+ isModule: boolean;
29
+ isNone: boolean;
30
+ isPrimitive: boolean;
31
+ isNumeric: boolean;
32
+ isSequence: boolean;
33
+ isMapping: boolean;
34
+ }
35
+ /**
36
+ * Parameter info from Python function introspection.
37
+ */
38
+ export interface PyParamInfo {
39
+ name: string;
40
+ type: string;
41
+ optional: boolean;
42
+ hasDefault: boolean;
43
+ defaultValue?: unknown;
44
+ kind: 'positional_only' | 'positional_or_keyword' | 'var_positional' | 'keyword_only' | 'var_keyword';
45
+ }
46
+ /**
47
+ * Member/attribute info for a Python class or module.
48
+ */
49
+ export interface PyMemberInfo {
50
+ name: string;
51
+ type: string;
52
+ isReadOnly: boolean;
53
+ docstring?: string;
54
+ }
55
+ /**
56
+ * Full introspection result for a Python callable.
57
+ */
58
+ export interface PyCallableInfo {
59
+ name: string;
60
+ qualName: string;
61
+ docstring: string;
62
+ parameters: PyParamInfo[];
63
+ returnType: string;
64
+ isMethod: boolean;
65
+ isClassMethod: boolean;
66
+ isStaticMethod: boolean;
67
+ isCoroutine: boolean;
68
+ isGenerator: boolean;
69
+ }
70
+ /**
71
+ * Full introspection result for a Python class.
72
+ */
73
+ export interface PyClassInfo {
74
+ name: string;
75
+ qualName: string;
76
+ docstring: string;
77
+ bases: string[];
78
+ members: PyMemberInfo[];
79
+ methods: PyCallableInfo[];
80
+ properties: PyMemberInfo[];
81
+ classMethods: PyCallableInfo[];
82
+ staticMethods: PyCallableInfo[];
83
+ }
84
+ /**
85
+ * Full introspection result for a Python module.
86
+ */
87
+ export interface PyModuleInspection {
88
+ name: string;
89
+ file?: string;
90
+ docstring: string;
91
+ version?: string;
92
+ functions: PyCallableInfo[];
93
+ classes: PyClassInfo[];
94
+ constants: PyMemberInfo[];
95
+ submodules: string[];
96
+ }
97
+ /**
98
+ * Serialized wire format for Python ↔ JavaScript data transfer.
99
+ */
100
+ export type SerializedFormat = 'json' | 'msgpack' | 'numpy_array' | 'dataframe' | 'series' | 'pandas_dataframe' | 'pandas_series' | 'torch_tensor' | 'python_ref' | 'bytes' | 'none' | number;
101
+ export interface SerializedValue {
102
+ format: SerializedFormat;
103
+ data: Uint8Array | string | null | undefined;
104
+ metadata?: SerializedMetadata;
105
+ }
106
+ export interface SerializedMetadata {
107
+ /** For python_ref: the object ID */
108
+ objectId?: number;
109
+ /** For numpy_array: dtype, shape, strides */
110
+ dtype?: string;
111
+ shape?: number[];
112
+ strides?: number[];
113
+ order?: 'C' | 'F';
114
+ /** For numpy_array: item size in bytes (snake_case variant) */
115
+ itemsize?: number;
116
+ /** For pandas objects: column names, dtypes, index */
117
+ columns?: string[];
118
+ columnDtypes?: string[];
119
+ index?: unknown[];
120
+ indexName?: string;
121
+ /** For pandas: orient (split/records/index/columns/values) */
122
+ orient?: string;
123
+ /** For Series: series name */
124
+ name?: string;
125
+ /** For torch tensors */
126
+ device?: string;
127
+ requiresGrad?: boolean;
128
+ /** General */
129
+ length?: number;
130
+ size?: number;
131
+ itemSize?: number;
132
+ }
133
+ /**
134
+ * Result from a Python function call.
135
+ */
136
+ export interface PyCallResult {
137
+ success: boolean;
138
+ value?: SerializedValue;
139
+ error?: PyErrorInfo;
140
+ objectId?: PyObjectId;
141
+ isObject?: boolean;
142
+ }
143
+ /**
144
+ * Python exception information.
145
+ */
146
+ export interface PyErrorInfo {
147
+ /** Python exception class name, e.g. 'ValueError', 'FileNotFoundError' */
148
+ type: string;
149
+ /** Exception message */
150
+ message: string;
151
+ /** Full Python traceback */
152
+ traceback: string;
153
+ /** Exception module, e.g. 'builtins', 'pandas.errors' */
154
+ module?: string;
155
+ /** Chained exception */
156
+ cause?: PyErrorInfo;
157
+ }
158
+ /**
159
+ * Iterator state for Python iterators.
160
+ */
161
+ export interface PyIteratorState {
162
+ iteratorId: number;
163
+ objectId: PyObjectId;
164
+ done: boolean;
165
+ position: number;
166
+ }
167
+ /**
168
+ * Result from iterator next() call.
169
+ */
170
+ export interface PyIteratorNext {
171
+ done: boolean;
172
+ value?: SerializedValue;
173
+ error?: PyErrorInfo;
174
+ }
175
+ /**
176
+ * DataFrame representation after deserialization.
177
+ */
178
+ export interface DataFrameResult {
179
+ columns: string[];
180
+ /** Row data as array of column-keyed objects */
181
+ data: Record<string, unknown>[];
182
+ /** Alias for data — array of records (row objects) */
183
+ records: Record<string, unknown>[];
184
+ index: unknown[];
185
+ dtypes: Record<string, string>;
186
+ shape: [number, number];
187
+ }
188
+ /**
189
+ * Series representation after deserialization.
190
+ */
191
+ export interface SeriesResult {
192
+ name: string;
193
+ /** Series values */
194
+ data: unknown[];
195
+ /** Alias for data */
196
+ values: unknown[];
197
+ index: unknown[];
198
+ dtype: string;
199
+ length: number;
200
+ }
201
+ /**
202
+ * A typed array backed by numpy data.
203
+ */
204
+ export type NumpyTypedArray = Float32Array | Float64Array | Int8Array | Int16Array | Int32Array | BigInt64Array | Uint8Array | Uint16Array | Uint32Array | BigUint64Array;
205
+ /**
206
+ * NumPy array representation after deserialization.
207
+ * Contains the typed array data plus metadata (dtype, shape, ndim).
208
+ */
209
+ export interface NumPyArrayResult {
210
+ /** The underlying typed array */
211
+ data: NumpyTypedArray;
212
+ /** NumPy dtype string, e.g. 'float64' */
213
+ dtype: string;
214
+ /** Array shape */
215
+ shape: number[];
216
+ /** Number of dimensions */
217
+ ndim: number;
218
+ }
219
+ /**
220
+ * Attribute resolution path for lazy Proxy chains.
221
+ */
222
+ export type AttributePath = string[];
223
+ /**
224
+ * The core PyProxy interface — wraps any Python object.
225
+ * All properties return new PyProxy instances (lazy).
226
+ * Calling the proxy or awaiting it triggers the Python call.
227
+ */
228
+ export interface PyProxyInterface {
229
+ readonly _pyObjectId: PyObjectId;
230
+ readonly _path: AttributePath;
231
+ readonly _isResolved: boolean;
232
+ then(onfulfilled?: (value: unknown) => unknown, onrejected?: (reason: PyErrorInfo) => unknown): Promise<unknown>;
233
+ [key: string]: unknown;
234
+ }
235
+ //# sourceMappingURL=python.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"python.d.ts","sourceRoot":"","sources":["../../src/types/python.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAA;CAAE,CAAC;AAErE;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB,KAAK,GACL,OAAO,GACP,SAAS,GACT,MAAM,GACN,KAAK,GACL,OAAO,GACP,WAAW,GACX,MAAM,GACN,OAAO,GACP,MAAM,GACN,KAAK,GACL,WAAW,GACX,UAAU,GACV,UAAU,GACV,QAAQ,GACR,4BAA4B,GAC5B,QAAQ,GACR,MAAM,GACN,aAAa,GACb,cAAc,GACd,UAAU,GACV,WAAW,GACX,WAAW,GACX,iBAAiB,GACjB,UAAU,GACV,WAAW,GACX,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,MAAM,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,UAAU,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;IACzB,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,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
1
+ "use strict";
2
+ /**
3
+ * nodepyx — Python Object Type Definitions
4
+ * Core types for representing Python objects in TypeScript.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ //# sourceMappingURL=python.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"python.js","sourceRoot":"","sources":["../../src/types/python.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * nodepyx — Error Translator
3
+ * Converts Python exceptions into proper JavaScript Error subclasses.
4
+ * Preserves full traceback, exception type, and chained causes.
5
+ */
6
+ import type { PyErrorInfo } from '../types/python';
7
+ /**
8
+ * Base class for all Python-originating errors.
9
+ * Provides access to Python-specific error metadata.
10
+ */
11
+ export declare class PythonError extends Error {
12
+ /** Python exception class name (e.g. 'ValueError', 'FileNotFoundError') */
13
+ readonly pythonType: string;
14
+ /** Python module where the exception originated */
15
+ readonly pythonModule: string;
16
+ /** Full Python traceback string */
17
+ readonly traceback: string;
18
+ /** Original PyErrorInfo object */
19
+ readonly pyErrorInfo: PyErrorInfo;
20
+ constructor(info: PyErrorInfo);
21
+ /** Format error with Python traceback for display */
22
+ format(): string;
23
+ }
24
+ export declare class PythonValueError extends PythonError {
25
+ constructor(info: PyErrorInfo);
26
+ }
27
+ export declare class PythonTypeError extends PythonError {
28
+ constructor(info: PyErrorInfo);
29
+ }
30
+ export declare class PythonKeyError extends PythonError {
31
+ constructor(info: PyErrorInfo);
32
+ }
33
+ export declare class PythonIndexError extends PythonError {
34
+ constructor(info: PyErrorInfo);
35
+ }
36
+ export declare class PythonAttributeError extends PythonError {
37
+ constructor(info: PyErrorInfo);
38
+ }
39
+ export declare class PythonImportError extends PythonError {
40
+ constructor(info: PyErrorInfo);
41
+ }
42
+ export declare class PythonModuleNotFoundError extends PythonImportError {
43
+ constructor(info: PyErrorInfo);
44
+ }
45
+ export declare class PythonFileNotFoundError extends PythonError {
46
+ constructor(info: PyErrorInfo);
47
+ }
48
+ export declare class PythonPermissionError extends PythonError {
49
+ constructor(info: PyErrorInfo);
50
+ }
51
+ export declare class PythonRuntimeError extends PythonError {
52
+ constructor(info: PyErrorInfo);
53
+ }
54
+ export declare class PythonMemoryError extends PythonError {
55
+ constructor(info: PyErrorInfo);
56
+ }
57
+ export declare class PythonStopIteration extends PythonError {
58
+ constructor(info: PyErrorInfo);
59
+ }
60
+ export declare class PythonTimeoutError extends Error {
61
+ readonly timeoutMs: number;
62
+ constructor(timeoutMs: number, operation: string);
63
+ }
64
+ export declare class nodepyxNotInitializedError extends Error {
65
+ constructor(message?: string);
66
+ }
67
+ export declare class nodepyxShutdownError extends Error {
68
+ constructor(message?: string);
69
+ }
70
+ /**
71
+ * Translates a PyErrorInfo (from the C++ addon) into the appropriate
72
+ * JavaScript Error subclass. Falls back to generic PythonError.
73
+ */
74
+ export declare function translatePythonError(info: PyErrorInfo): PythonError;
75
+ /**
76
+ * Type guard: checks whether a value is a PythonError.
77
+ */
78
+ export declare function isPythonError(value: unknown): value is PythonError;
79
+ /**
80
+ * Type guard: checks whether a value is a specific Python exception type.
81
+ */
82
+ export declare function isPythonErrorOfType(value: unknown, pythonType: string): value is PythonError;
83
+ //# sourceMappingURL=ErrorTranslator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorTranslator.d.ts","sourceRoot":"","sources":["../../src/utils/ErrorTranslator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD;;;GAGG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACpC,2EAA2E;IAC3E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,mDAAmD;IACnD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,mCAAmC;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,kCAAkC;IAClC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;gBAEtB,IAAI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