zpe-imc-kernel 0.1.0__tar.gz

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.
@@ -0,0 +1,431 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "autocfg"
7
+ version = "1.5.0"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
10
+
11
+ [[package]]
12
+ name = "bumpalo"
13
+ version = "3.20.2"
14
+ source = "registry+https://github.com/rust-lang/crates.io-index"
15
+ checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb"
16
+
17
+ [[package]]
18
+ name = "cc"
19
+ version = "1.2.56"
20
+ source = "registry+https://github.com/rust-lang/crates.io-index"
21
+ checksum = "aebf35691d1bfb0ac386a69bac2fde4dd276fb618cf8bf4f5318fe285e821bb2"
22
+ dependencies = [
23
+ "find-msvc-tools",
24
+ "shlex",
25
+ ]
26
+
27
+ [[package]]
28
+ name = "cfg-if"
29
+ version = "1.0.4"
30
+ source = "registry+https://github.com/rust-lang/crates.io-index"
31
+ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
32
+
33
+ [[package]]
34
+ name = "crossbeam-deque"
35
+ version = "0.8.6"
36
+ source = "registry+https://github.com/rust-lang/crates.io-index"
37
+ checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51"
38
+ dependencies = [
39
+ "crossbeam-epoch",
40
+ "crossbeam-utils",
41
+ ]
42
+
43
+ [[package]]
44
+ name = "crossbeam-epoch"
45
+ version = "0.9.18"
46
+ source = "registry+https://github.com/rust-lang/crates.io-index"
47
+ checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
48
+ dependencies = [
49
+ "crossbeam-utils",
50
+ ]
51
+
52
+ [[package]]
53
+ name = "crossbeam-utils"
54
+ version = "0.8.21"
55
+ source = "registry+https://github.com/rust-lang/crates.io-index"
56
+ checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
57
+
58
+ [[package]]
59
+ name = "either"
60
+ version = "1.15.0"
61
+ source = "registry+https://github.com/rust-lang/crates.io-index"
62
+ checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
63
+
64
+ [[package]]
65
+ name = "find-msvc-tools"
66
+ version = "0.1.9"
67
+ source = "registry+https://github.com/rust-lang/crates.io-index"
68
+ checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
69
+
70
+ [[package]]
71
+ name = "heck"
72
+ version = "0.5.0"
73
+ source = "registry+https://github.com/rust-lang/crates.io-index"
74
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
75
+
76
+ [[package]]
77
+ name = "indoc"
78
+ version = "2.0.7"
79
+ source = "registry+https://github.com/rust-lang/crates.io-index"
80
+ checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
81
+ dependencies = [
82
+ "rustversion",
83
+ ]
84
+
85
+ [[package]]
86
+ name = "itoa"
87
+ version = "1.0.17"
88
+ source = "registry+https://github.com/rust-lang/crates.io-index"
89
+ checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2"
90
+
91
+ [[package]]
92
+ name = "libc"
93
+ version = "0.2.182"
94
+ source = "registry+https://github.com/rust-lang/crates.io-index"
95
+ checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112"
96
+
97
+ [[package]]
98
+ name = "libmimalloc-sys"
99
+ version = "0.1.44"
100
+ source = "registry+https://github.com/rust-lang/crates.io-index"
101
+ checksum = "667f4fec20f29dfc6bc7357c582d91796c169ad7e2fce709468aefeb2c099870"
102
+ dependencies = [
103
+ "cc",
104
+ "libc",
105
+ ]
106
+
107
+ [[package]]
108
+ name = "memchr"
109
+ version = "2.8.0"
110
+ source = "registry+https://github.com/rust-lang/crates.io-index"
111
+ checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
112
+
113
+ [[package]]
114
+ name = "memoffset"
115
+ version = "0.9.1"
116
+ source = "registry+https://github.com/rust-lang/crates.io-index"
117
+ checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
118
+ dependencies = [
119
+ "autocfg",
120
+ ]
121
+
122
+ [[package]]
123
+ name = "mimalloc"
124
+ version = "0.1.48"
125
+ source = "registry+https://github.com/rust-lang/crates.io-index"
126
+ checksum = "e1ee66a4b64c74f4ef288bcbb9192ad9c3feaad75193129ac8509af543894fd8"
127
+ dependencies = [
128
+ "libmimalloc-sys",
129
+ ]
130
+
131
+ [[package]]
132
+ name = "once_cell"
133
+ version = "1.21.3"
134
+ source = "registry+https://github.com/rust-lang/crates.io-index"
135
+ checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
136
+
137
+ [[package]]
138
+ name = "phf"
139
+ version = "0.11.3"
140
+ source = "registry+https://github.com/rust-lang/crates.io-index"
141
+ checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078"
142
+ dependencies = [
143
+ "phf_macros",
144
+ "phf_shared",
145
+ ]
146
+
147
+ [[package]]
148
+ name = "phf_generator"
149
+ version = "0.11.3"
150
+ source = "registry+https://github.com/rust-lang/crates.io-index"
151
+ checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d"
152
+ dependencies = [
153
+ "phf_shared",
154
+ "rand",
155
+ ]
156
+
157
+ [[package]]
158
+ name = "phf_macros"
159
+ version = "0.11.3"
160
+ source = "registry+https://github.com/rust-lang/crates.io-index"
161
+ checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216"
162
+ dependencies = [
163
+ "phf_generator",
164
+ "phf_shared",
165
+ "proc-macro2",
166
+ "quote",
167
+ "syn",
168
+ ]
169
+
170
+ [[package]]
171
+ name = "phf_shared"
172
+ version = "0.11.3"
173
+ source = "registry+https://github.com/rust-lang/crates.io-index"
174
+ checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5"
175
+ dependencies = [
176
+ "siphasher",
177
+ ]
178
+
179
+ [[package]]
180
+ name = "portable-atomic"
181
+ version = "1.13.1"
182
+ source = "registry+https://github.com/rust-lang/crates.io-index"
183
+ checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
184
+
185
+ [[package]]
186
+ name = "proc-macro2"
187
+ version = "1.0.106"
188
+ source = "registry+https://github.com/rust-lang/crates.io-index"
189
+ checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
190
+ dependencies = [
191
+ "unicode-ident",
192
+ ]
193
+
194
+ [[package]]
195
+ name = "pyo3"
196
+ version = "0.24.2"
197
+ source = "registry+https://github.com/rust-lang/crates.io-index"
198
+ checksum = "e5203598f366b11a02b13aa20cab591229ff0a89fd121a308a5df751d5fc9219"
199
+ dependencies = [
200
+ "cfg-if",
201
+ "indoc",
202
+ "libc",
203
+ "memoffset",
204
+ "once_cell",
205
+ "portable-atomic",
206
+ "pyo3-build-config",
207
+ "pyo3-ffi",
208
+ "pyo3-macros",
209
+ "unindent",
210
+ ]
211
+
212
+ [[package]]
213
+ name = "pyo3-build-config"
214
+ version = "0.24.2"
215
+ source = "registry+https://github.com/rust-lang/crates.io-index"
216
+ checksum = "99636d423fa2ca130fa5acde3059308006d46f98caac629418e53f7ebb1e9999"
217
+ dependencies = [
218
+ "once_cell",
219
+ "target-lexicon",
220
+ ]
221
+
222
+ [[package]]
223
+ name = "pyo3-ffi"
224
+ version = "0.24.2"
225
+ source = "registry+https://github.com/rust-lang/crates.io-index"
226
+ checksum = "78f9cf92ba9c409279bc3305b5409d90db2d2c22392d443a87df3a1adad59e33"
227
+ dependencies = [
228
+ "libc",
229
+ "pyo3-build-config",
230
+ ]
231
+
232
+ [[package]]
233
+ name = "pyo3-macros"
234
+ version = "0.24.2"
235
+ source = "registry+https://github.com/rust-lang/crates.io-index"
236
+ checksum = "0b999cb1a6ce21f9a6b147dcf1be9ffedf02e0043aec74dc390f3007047cecd9"
237
+ dependencies = [
238
+ "proc-macro2",
239
+ "pyo3-macros-backend",
240
+ "quote",
241
+ "syn",
242
+ ]
243
+
244
+ [[package]]
245
+ name = "pyo3-macros-backend"
246
+ version = "0.24.2"
247
+ source = "registry+https://github.com/rust-lang/crates.io-index"
248
+ checksum = "822ece1c7e1012745607d5cf0bcb2874769f0f7cb34c4cde03b9358eb9ef911a"
249
+ dependencies = [
250
+ "heck",
251
+ "proc-macro2",
252
+ "pyo3-build-config",
253
+ "quote",
254
+ "syn",
255
+ ]
256
+
257
+ [[package]]
258
+ name = "quote"
259
+ version = "1.0.45"
260
+ source = "registry+https://github.com/rust-lang/crates.io-index"
261
+ checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
262
+ dependencies = [
263
+ "proc-macro2",
264
+ ]
265
+
266
+ [[package]]
267
+ name = "rand"
268
+ version = "0.8.5"
269
+ source = "registry+https://github.com/rust-lang/crates.io-index"
270
+ checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
271
+ dependencies = [
272
+ "rand_core",
273
+ ]
274
+
275
+ [[package]]
276
+ name = "rand_core"
277
+ version = "0.6.4"
278
+ source = "registry+https://github.com/rust-lang/crates.io-index"
279
+ checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
280
+
281
+ [[package]]
282
+ name = "rayon"
283
+ version = "1.11.0"
284
+ source = "registry+https://github.com/rust-lang/crates.io-index"
285
+ checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f"
286
+ dependencies = [
287
+ "either",
288
+ "rayon-core",
289
+ ]
290
+
291
+ [[package]]
292
+ name = "rayon-core"
293
+ version = "1.13.0"
294
+ source = "registry+https://github.com/rust-lang/crates.io-index"
295
+ checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91"
296
+ dependencies = [
297
+ "crossbeam-deque",
298
+ "crossbeam-utils",
299
+ ]
300
+
301
+ [[package]]
302
+ name = "rustversion"
303
+ version = "1.0.22"
304
+ source = "registry+https://github.com/rust-lang/crates.io-index"
305
+ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
306
+
307
+ [[package]]
308
+ name = "serde"
309
+ version = "1.0.228"
310
+ source = "registry+https://github.com/rust-lang/crates.io-index"
311
+ checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
312
+ dependencies = [
313
+ "serde_core",
314
+ ]
315
+
316
+ [[package]]
317
+ name = "serde_core"
318
+ version = "1.0.228"
319
+ source = "registry+https://github.com/rust-lang/crates.io-index"
320
+ checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
321
+ dependencies = [
322
+ "serde_derive",
323
+ ]
324
+
325
+ [[package]]
326
+ name = "serde_derive"
327
+ version = "1.0.228"
328
+ source = "registry+https://github.com/rust-lang/crates.io-index"
329
+ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
330
+ dependencies = [
331
+ "proc-macro2",
332
+ "quote",
333
+ "syn",
334
+ ]
335
+
336
+ [[package]]
337
+ name = "serde_json"
338
+ version = "1.0.149"
339
+ source = "registry+https://github.com/rust-lang/crates.io-index"
340
+ checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86"
341
+ dependencies = [
342
+ "itoa",
343
+ "memchr",
344
+ "serde",
345
+ "serde_core",
346
+ "zmij",
347
+ ]
348
+
349
+ [[package]]
350
+ name = "shlex"
351
+ version = "1.3.0"
352
+ source = "registry+https://github.com/rust-lang/crates.io-index"
353
+ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
354
+
355
+ [[package]]
356
+ name = "siphasher"
357
+ version = "1.0.2"
358
+ source = "registry+https://github.com/rust-lang/crates.io-index"
359
+ checksum = "b2aa850e253778c88a04c3d7323b043aeda9d3e30d5971937c1855769763678e"
360
+
361
+ [[package]]
362
+ name = "syn"
363
+ version = "2.0.117"
364
+ source = "registry+https://github.com/rust-lang/crates.io-index"
365
+ checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
366
+ dependencies = [
367
+ "proc-macro2",
368
+ "quote",
369
+ "unicode-ident",
370
+ ]
371
+
372
+ [[package]]
373
+ name = "target-lexicon"
374
+ version = "0.13.5"
375
+ source = "registry+https://github.com/rust-lang/crates.io-index"
376
+ checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
377
+
378
+ [[package]]
379
+ name = "tinyvec"
380
+ version = "1.10.0"
381
+ source = "registry+https://github.com/rust-lang/crates.io-index"
382
+ checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa"
383
+ dependencies = [
384
+ "tinyvec_macros",
385
+ ]
386
+
387
+ [[package]]
388
+ name = "tinyvec_macros"
389
+ version = "0.1.1"
390
+ source = "registry+https://github.com/rust-lang/crates.io-index"
391
+ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
392
+
393
+ [[package]]
394
+ name = "unicode-ident"
395
+ version = "1.0.24"
396
+ source = "registry+https://github.com/rust-lang/crates.io-index"
397
+ checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
398
+
399
+ [[package]]
400
+ name = "unicode-normalization"
401
+ version = "0.1.25"
402
+ source = "registry+https://github.com/rust-lang/crates.io-index"
403
+ checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8"
404
+ dependencies = [
405
+ "tinyvec",
406
+ ]
407
+
408
+ [[package]]
409
+ name = "unindent"
410
+ version = "0.2.4"
411
+ source = "registry+https://github.com/rust-lang/crates.io-index"
412
+ checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
413
+
414
+ [[package]]
415
+ name = "zmij"
416
+ version = "1.0.21"
417
+ source = "registry+https://github.com/rust-lang/crates.io-index"
418
+ checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa"
419
+
420
+ [[package]]
421
+ name = "zpe_imc_kernel"
422
+ version = "0.1.0"
423
+ dependencies = [
424
+ "bumpalo",
425
+ "mimalloc",
426
+ "phf",
427
+ "pyo3",
428
+ "rayon",
429
+ "serde_json",
430
+ "unicode-normalization",
431
+ ]
@@ -0,0 +1,40 @@
1
+ [package]
2
+ # Governed by the repository root LICENSE (SAL v6.2); use an SPDX-style
3
+ # identifier here so fresh wheel installs do not depend on a path outside the
4
+ # crate root.
5
+ name = "zpe_imc_kernel"
6
+ version = "0.1.0"
7
+ edition = "2021"
8
+ publish = false
9
+ license = "LicenseRef-Zer0pa-SAL-6.2"
10
+ description = "Native Rust IMC stream scanner for the ZPE multimodal runtime"
11
+ homepage = "https://github.com/Zer0pa/ZPE-IMC"
12
+ repository = "https://github.com/Zer0pa/ZPE-IMC"
13
+ readme = "README.md"
14
+
15
+ [lib]
16
+ name = "zpe_imc_kernel"
17
+ crate-type = ["cdylib"]
18
+
19
+ [dependencies]
20
+ bumpalo = { version = "3", features = ["collections"] }
21
+ mimalloc = { version = "0.1", default-features = false }
22
+ phf = { version = "0.11", features = ["macros"] }
23
+ pyo3 = { version = "0.24", features = ["extension-module", "abi3-py311"] }
24
+ rayon = "1.10"
25
+ unicode-normalization = "0.1"
26
+
27
+ [build-dependencies]
28
+ serde_json = "1"
29
+
30
+ [package.metadata.maturin]
31
+ name = "zpe_imc_kernel"
32
+
33
+ [profile.release]
34
+ opt-level = 3
35
+ lto = "fat"
36
+ codegen-units = 1
37
+ strip = "symbols"
38
+ panic = "abort"
39
+ debug = false
40
+ overflow-checks = false
@@ -0,0 +1,55 @@
1
+ Metadata-Version: 2.4
2
+ Name: zpe-imc-kernel
3
+ Version: 0.1.0
4
+ Classifier: Programming Language :: Python :: 3
5
+ Classifier: Programming Language :: Python :: 3.11
6
+ Classifier: Programming Language :: Python :: 3.12
7
+ Classifier: Programming Language :: Rust
8
+ Summary: Optional native Rust kernel for zpe-multimodal stream scan and validation paths
9
+ Home-Page: https://github.com/Zer0pa/ZPE-IMC
10
+ Author: Zer0paGlyph
11
+ License: LicenseRef-Zer0pa-SAL-6.2
12
+ Requires-Python: >=3.11
13
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
14
+ Project-URL: Homepage, https://github.com/Zer0pa/ZPE-IMC
15
+ Project-URL: Repository, https://github.com/Zer0pa/ZPE-IMC
16
+
17
+ # zpe-imc-kernel
18
+
19
+ Optional native Rust kernel for `zpe-multimodal`.
20
+
21
+ This package provides the compiled backend used by the IMC native scan and
22
+ validation path. It is a companion package, not a replacement for
23
+ `zpe-multimodal`.
24
+
25
+ Current intent:
26
+
27
+ - `pip install zpe-multimodal` closes the base Python package surface.
28
+ - `pip install zpe-imc-kernel` provides the optional native backend.
29
+ - `pip install "zpe-multimodal[native]"` closes the public extra-based install
30
+ path once both packages are published.
31
+
32
+ This source tree lives in the canonical `ZPE-IMC` repo so the public kernel
33
+ lane is not trapped in a duplicate local workspace.
34
+
35
+ ## Local Build
36
+
37
+ ```bash
38
+ python -m pip install --upgrade pip maturin
39
+ python -m maturin build --release --manifest-path Cargo.toml --interpreter python
40
+ ```
41
+
42
+ Install the resulting wheel and verify from the repo root:
43
+
44
+ ```bash
45
+ python -m pip install target/wheels/zpe_imc_kernel-*.whl
46
+ python -m pip install -e ".[native]"
47
+ python -m pytest code/tests/test_imc_rust_kernel_native.py -q
48
+ ```
49
+
50
+ ## Publication Boundary
51
+
52
+ The presence of this source tree does not mean the package is already live on
53
+ PyPI. Publication still requires running the kernel publish workflow from the
54
+ canonical repo with valid PyPI credentials.
55
+
@@ -0,0 +1,38 @@
1
+ # zpe-imc-kernel
2
+
3
+ Optional native Rust kernel for `zpe-multimodal`.
4
+
5
+ This package provides the compiled backend used by the IMC native scan and
6
+ validation path. It is a companion package, not a replacement for
7
+ `zpe-multimodal`.
8
+
9
+ Current intent:
10
+
11
+ - `pip install zpe-multimodal` closes the base Python package surface.
12
+ - `pip install zpe-imc-kernel` provides the optional native backend.
13
+ - `pip install "zpe-multimodal[native]"` closes the public extra-based install
14
+ path once both packages are published.
15
+
16
+ This source tree lives in the canonical `ZPE-IMC` repo so the public kernel
17
+ lane is not trapped in a duplicate local workspace.
18
+
19
+ ## Local Build
20
+
21
+ ```bash
22
+ python -m pip install --upgrade pip maturin
23
+ python -m maturin build --release --manifest-path Cargo.toml --interpreter python
24
+ ```
25
+
26
+ Install the resulting wheel and verify from the repo root:
27
+
28
+ ```bash
29
+ python -m pip install target/wheels/zpe_imc_kernel-*.whl
30
+ python -m pip install -e ".[native]"
31
+ python -m pytest code/tests/test_imc_rust_kernel_native.py -q
32
+ ```
33
+
34
+ ## Publication Boundary
35
+
36
+ The presence of this source tree does not mean the package is already live on
37
+ PyPI. Publication still requires running the kernel publish workflow from the
38
+ canonical repo with valid PyPI credentials.
@@ -0,0 +1,40 @@
1
+ use std::env;
2
+ use std::fs;
3
+ use std::fs::File;
4
+ use std::io::Write;
5
+ use std::path::PathBuf;
6
+
7
+ fn main() {
8
+ let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").expect("missing manifest dir"));
9
+ let mapping_path = manifest_dir.join("../../zpe_multimodal/data/mapping_v1.json");
10
+ println!("cargo:rerun-if-changed={}", mapping_path.display());
11
+
12
+ let raw = fs::read_to_string(&mapping_path).expect("failed to read mapping_v1.json");
13
+ let mut entries: Vec<(u32, u32)> =
14
+ serde_json::from_str::<serde_json::Map<String, serde_json::Value>>(&raw)
15
+ .expect("failed to parse mapping_v1.json")
16
+ .into_iter()
17
+ .map(|(codepoint, word)| {
18
+ (
19
+ codepoint.parse::<u32>().expect("invalid codepoint key"),
20
+ word.as_u64().expect("word must be u64") as u32,
21
+ )
22
+ })
23
+ .collect();
24
+ entries.sort_unstable_by_key(|(codepoint, _)| *codepoint);
25
+
26
+ let out_dir = PathBuf::from(env::var("OUT_DIR").expect("missing OUT_DIR"));
27
+ let dest_path = out_dir.join("generated_text_map.rs");
28
+ let mut file = File::create(&dest_path).expect("failed to create generated_text_map.rs");
29
+
30
+ writeln!(
31
+ &mut file,
32
+ "static CHAR_TO_WORD: phf::Map<u32, u32> = phf::phf_map! {{"
33
+ )
34
+ .expect("failed to write text map header");
35
+ for (codepoint, word) in entries {
36
+ writeln!(&mut file, " {codepoint}u32 => {word}u32,")
37
+ .expect("failed to write text map entry");
38
+ }
39
+ writeln!(&mut file, "}};").expect("failed to write text map footer");
40
+ }
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5
+ REPO_ROOT="$(cd "${ROOT_DIR}/../../.." && pwd)"
6
+ DEFAULT_PYTHON="${REPO_ROOT}/.venv/bin/python"
7
+ PYTHON_BIN="${PYTHON_BIN:-${DEFAULT_PYTHON}}"
8
+
9
+ if [[ ! -x "${PYTHON_BIN}" ]]; then
10
+ PYTHON_BIN="$(command -v python3)"
11
+ fi
12
+
13
+ PY_PLATFORM="$("${PYTHON_BIN}" - <<'PY'
14
+ import sysconfig
15
+ print(sysconfig.get_platform())
16
+ PY
17
+ )"
18
+
19
+ case "${PY_PLATFORM}" in
20
+ linux-x86_64)
21
+ TARGET_TRIPLE="x86_64-unknown-linux-gnu"
22
+ ;;
23
+ linux-aarch64)
24
+ TARGET_TRIPLE="aarch64-unknown-linux-gnu"
25
+ ;;
26
+ *x86_64*)
27
+ TARGET_TRIPLE="x86_64-apple-darwin"
28
+ ;;
29
+ *arm64*)
30
+ TARGET_TRIPLE="aarch64-apple-darwin"
31
+ ;;
32
+ *)
33
+ echo "unsupported python platform: ${PY_PLATFORM}" >&2
34
+ exit 1
35
+ ;;
36
+ esac
37
+
38
+ WHEEL_DIR="${ROOT_DIR}/target/wheels/${TARGET_TRIPLE}"
39
+ mkdir -p "${WHEEL_DIR}"
40
+
41
+ "${PYTHON_BIN}" -m pip install --disable-pip-version-check --quiet maturin
42
+ rustup target add "${TARGET_TRIPLE}" >/dev/null 2>&1 || true
43
+ "${PYTHON_BIN}" -m maturin build --release --manifest-path "${ROOT_DIR}/Cargo.toml" --interpreter "${PYTHON_BIN}" --target "${TARGET_TRIPLE}" --out "${WHEEL_DIR}"
44
+ WHEEL_PATH="$(ls -1t "${WHEEL_DIR}"/zpe_imc_kernel-*.whl | head -n 1)"
45
+ "${PYTHON_BIN}" -m pip install --force-reinstall --no-deps "${WHEEL_PATH}"