betaquant 0.5.9__tar.gz → 0.6.2__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.
Files changed (81) hide show
  1. {betaquant-0.5.9 → betaquant-0.6.2}/Cargo.lock +311 -1
  2. {betaquant-0.5.9 → betaquant-0.6.2}/Cargo.toml +6 -1
  3. {betaquant-0.5.9 → betaquant-0.6.2}/PKG-INFO +59 -1
  4. {betaquant-0.5.9 → betaquant-0.6.2}/README.md +58 -0
  5. {betaquant-0.5.9 → betaquant-0.6.2}/build.rs +7 -0
  6. betaquant-0.6.2/python/betaquant/algo/__init__.py +14 -0
  7. {betaquant-0.5.9 → betaquant-0.6.2}/src/lib.rs +84 -0
  8. betaquant-0.6.2/src/license/public_key.bin +1 -0
  9. betaquant-0.6.2/src/license.rs +387 -0
  10. betaquant-0.5.9/python/betaquant/algo/__init__.py +0 -6
  11. {betaquant-0.5.9 → betaquant-0.6.2}/.gitea/builder/Dockerfile +0 -0
  12. {betaquant-0.5.9 → betaquant-0.6.2}/.gitea/builder/README.md +0 -0
  13. {betaquant-0.5.9 → betaquant-0.6.2}/.gitea/workflows/publish.yml +0 -0
  14. {betaquant-0.5.9 → betaquant-0.6.2}/.gitignore +0 -0
  15. {betaquant-0.5.9 → betaquant-0.6.2}/CHANGELOG.md +0 -0
  16. {betaquant-0.5.9 → betaquant-0.6.2}/LICENSE +0 -0
  17. {betaquant-0.5.9 → betaquant-0.6.2}/examples/gtja191/al/__init__.py +0 -0
  18. {betaquant-0.5.9 → betaquant-0.6.2}/examples/gtja191/al/alpha191.py +0 -0
  19. {betaquant-0.5.9 → betaquant-0.6.2}/examples/gtja191/al/alpha191_context.py +0 -0
  20. {betaquant-0.5.9 → betaquant-0.6.2}/examples/gtja191/alpha191.txt +0 -0
  21. {betaquant-0.5.9 → betaquant-0.6.2}/examples/gtja191/main.py +0 -0
  22. {betaquant-0.5.9 → betaquant-0.6.2}/examples/quickstart/full_demo.py +0 -0
  23. {betaquant-0.5.9 → betaquant-0.6.2}/examples/quickstart/rank.py +0 -0
  24. {betaquant-0.5.9 → betaquant-0.6.2}/examples/quickstart/usage.py +0 -0
  25. {betaquant-0.5.9 → betaquant-0.6.2}/examples/quickstart/verify_sumif.py +0 -0
  26. {betaquant-0.5.9 → betaquant-0.6.2}/examples/wq101/al/__init__.py +0 -0
  27. {betaquant-0.5.9 → betaquant-0.6.2}/examples/wq101/al/alpha101.py +0 -0
  28. {betaquant-0.5.9 → betaquant-0.6.2}/examples/wq101/al/alpha101_context.py +0 -0
  29. {betaquant-0.5.9 → betaquant-0.6.2}/examples/wq101/alpha101.txt +0 -0
  30. {betaquant-0.5.9 → betaquant-0.6.2}/examples/wq101/main.py +0 -0
  31. {betaquant-0.5.9 → betaquant-0.6.2}/pyproject.toml +0 -0
  32. {betaquant-0.5.9 → betaquant-0.6.2}/python/betaquant/__init__.py +0 -0
  33. {betaquant-0.5.9 → betaquant-0.6.2}/python/betaquant/algo/algo_gen.py +0 -0
  34. {betaquant-0.5.9 → betaquant-0.6.2}/python/betaquant/algo/manual.py +0 -0
  35. {betaquant-0.5.9 → betaquant-0.6.2}/python/betaquant/algo.md +0 -0
  36. {betaquant-0.5.9 → betaquant-0.6.2}/python/betaquant/context.py +0 -0
  37. {betaquant-0.5.9 → betaquant-0.6.2}/python/betaquant/lang/__init__.py +0 -0
  38. {betaquant-0.5.9 → betaquant-0.6.2}/python/betaquant/lang/__main__.py +0 -0
  39. {betaquant-0.5.9 → betaquant-0.6.2}/python/betaquant/lang/alpha.lark +0 -0
  40. {betaquant-0.5.9 → betaquant-0.6.2}/python/betaquant/lang/parser.py +0 -0
  41. {betaquant-0.5.9 → betaquant-0.6.2}/python/betaquant/lang/to_python.py +0 -0
  42. {betaquant-0.5.9 → betaquant-0.6.2}/python/betaquant/perf.py +0 -0
  43. {betaquant-0.5.9 → betaquant-0.6.2}/python/betaquant/transforms.py +0 -0
  44. {betaquant-0.5.9 → betaquant-0.6.2}/python/tests/test_grammar.py +0 -0
  45. {betaquant-0.5.9 → betaquant-0.6.2}/python/tests/test_rank.py +0 -0
  46. {betaquant-0.5.9 → betaquant-0.6.2}/python/tests/test_to_python.py +0 -0
  47. {betaquant-0.5.9 → betaquant-0.6.2}/rustfmt.toml +0 -0
  48. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/alpha.rs +0 -0
  49. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/backfill.rs +0 -0
  50. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/context.rs +0 -0
  51. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/cross.rs +0 -0
  52. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/cut.rs +0 -0
  53. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/drawdown.rs +0 -0
  54. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/ema.rs +0 -0
  55. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/entropy.rs +0 -0
  56. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/error.rs +0 -0
  57. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/extremum.rs +0 -0
  58. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/group.rs +0 -0
  59. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/internal.rs +0 -0
  60. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/ma.rs +0 -0
  61. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/misc.rs +0 -0
  62. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/mod.rs +0 -0
  63. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/moments.rs +0 -0
  64. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/neutralize.rs +0 -0
  65. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/quantile.rs +0 -0
  66. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/rank.rs +0 -0
  67. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/returns.rs +0 -0
  68. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/rolling.rs +0 -0
  69. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/series.rs +0 -0
  70. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/sharpe.rs +0 -0
  71. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/slope.rs +0 -0
  72. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/spec.rs +0 -0
  73. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/split.rs +0 -0
  74. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/stats.rs +0 -0
  75. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/stddev.rs +0 -0
  76. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/sum.rs +0 -0
  77. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/topk.rs +0 -0
  78. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/wsum.rs +0 -0
  79. {betaquant-0.5.9 → betaquant-0.6.2}/src/algo/zscore.rs +0 -0
  80. {betaquant-0.5.9 → betaquant-0.6.2}/src//347/256/227/345/255/220/350/247/204/345/210/231/345/277/205/350/257/273.md" +0 -0
  81. {betaquant-0.5.9 → betaquant-0.6.2}/tag_release.py +0 -0
@@ -23,20 +23,46 @@ version = "1.5.0"
23
23
  source = "registry+https://github.com/rust-lang/crates.io-index"
24
24
  checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
25
25
 
26
+ [[package]]
27
+ name = "base64"
28
+ version = "0.22.1"
29
+ source = "registry+https://github.com/rust-lang/crates.io-index"
30
+ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
31
+
32
+ [[package]]
33
+ name = "base64ct"
34
+ version = "1.8.3"
35
+ source = "registry+https://github.com/rust-lang/crates.io-index"
36
+ checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06"
37
+
26
38
  [[package]]
27
39
  name = "betaquant"
28
- version = "0.5.9"
40
+ version = "0.6.2"
29
41
  dependencies = [
30
42
  "anyhow",
43
+ "base64",
44
+ "ed25519-dalek",
31
45
  "log",
32
46
  "num-traits",
33
47
  "numpy",
34
48
  "pyo3",
35
49
  "pyo3-log",
36
50
  "rayon",
51
+ "serde",
52
+ "serde_json",
53
+ "sha2",
37
54
  "thiserror",
38
55
  ]
39
56
 
57
+ [[package]]
58
+ name = "block-buffer"
59
+ version = "0.10.4"
60
+ source = "registry+https://github.com/rust-lang/crates.io-index"
61
+ checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
62
+ dependencies = [
63
+ "generic-array",
64
+ ]
65
+
40
66
  [[package]]
41
67
  name = "cc"
42
68
  version = "1.2.62"
@@ -47,6 +73,27 @@ dependencies = [
47
73
  "shlex",
48
74
  ]
49
75
 
76
+ [[package]]
77
+ name = "cfg-if"
78
+ version = "1.0.4"
79
+ source = "registry+https://github.com/rust-lang/crates.io-index"
80
+ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
81
+
82
+ [[package]]
83
+ name = "const-oid"
84
+ version = "0.9.6"
85
+ source = "registry+https://github.com/rust-lang/crates.io-index"
86
+ checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"
87
+
88
+ [[package]]
89
+ name = "cpufeatures"
90
+ version = "0.2.17"
91
+ source = "registry+https://github.com/rust-lang/crates.io-index"
92
+ checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"
93
+ dependencies = [
94
+ "libc",
95
+ ]
96
+
50
97
  [[package]]
51
98
  name = "crossbeam-deque"
52
99
  version = "0.8.6"
@@ -72,24 +119,138 @@ version = "0.8.21"
72
119
  source = "registry+https://github.com/rust-lang/crates.io-index"
73
120
  checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
74
121
 
122
+ [[package]]
123
+ name = "crypto-common"
124
+ version = "0.1.7"
125
+ source = "registry+https://github.com/rust-lang/crates.io-index"
126
+ checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"
127
+ dependencies = [
128
+ "generic-array",
129
+ "typenum",
130
+ ]
131
+
132
+ [[package]]
133
+ name = "curve25519-dalek"
134
+ version = "4.1.3"
135
+ source = "registry+https://github.com/rust-lang/crates.io-index"
136
+ checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be"
137
+ dependencies = [
138
+ "cfg-if",
139
+ "cpufeatures",
140
+ "curve25519-dalek-derive",
141
+ "digest",
142
+ "fiat-crypto",
143
+ "rustc_version",
144
+ "subtle",
145
+ "zeroize",
146
+ ]
147
+
148
+ [[package]]
149
+ name = "curve25519-dalek-derive"
150
+ version = "0.1.1"
151
+ source = "registry+https://github.com/rust-lang/crates.io-index"
152
+ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3"
153
+ dependencies = [
154
+ "proc-macro2",
155
+ "quote",
156
+ "syn",
157
+ ]
158
+
159
+ [[package]]
160
+ name = "der"
161
+ version = "0.7.10"
162
+ source = "registry+https://github.com/rust-lang/crates.io-index"
163
+ checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb"
164
+ dependencies = [
165
+ "const-oid",
166
+ "zeroize",
167
+ ]
168
+
169
+ [[package]]
170
+ name = "digest"
171
+ version = "0.10.7"
172
+ source = "registry+https://github.com/rust-lang/crates.io-index"
173
+ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
174
+ dependencies = [
175
+ "block-buffer",
176
+ "crypto-common",
177
+ ]
178
+
179
+ [[package]]
180
+ name = "ed25519"
181
+ version = "2.2.3"
182
+ source = "registry+https://github.com/rust-lang/crates.io-index"
183
+ checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53"
184
+ dependencies = [
185
+ "pkcs8",
186
+ "signature",
187
+ ]
188
+
189
+ [[package]]
190
+ name = "ed25519-dalek"
191
+ version = "2.2.0"
192
+ source = "registry+https://github.com/rust-lang/crates.io-index"
193
+ checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9"
194
+ dependencies = [
195
+ "curve25519-dalek",
196
+ "ed25519",
197
+ "serde",
198
+ "sha2",
199
+ "subtle",
200
+ "zeroize",
201
+ ]
202
+
75
203
  [[package]]
76
204
  name = "either"
77
205
  version = "1.15.0"
78
206
  source = "registry+https://github.com/rust-lang/crates.io-index"
79
207
  checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
80
208
 
209
+ [[package]]
210
+ name = "fiat-crypto"
211
+ version = "0.2.9"
212
+ source = "registry+https://github.com/rust-lang/crates.io-index"
213
+ checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d"
214
+
81
215
  [[package]]
82
216
  name = "find-msvc-tools"
83
217
  version = "0.1.9"
84
218
  source = "registry+https://github.com/rust-lang/crates.io-index"
85
219
  checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
86
220
 
221
+ [[package]]
222
+ name = "generic-array"
223
+ version = "0.14.7"
224
+ source = "registry+https://github.com/rust-lang/crates.io-index"
225
+ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
226
+ dependencies = [
227
+ "typenum",
228
+ "version_check",
229
+ ]
230
+
231
+ [[package]]
232
+ name = "getrandom"
233
+ version = "0.2.17"
234
+ source = "registry+https://github.com/rust-lang/crates.io-index"
235
+ checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
236
+ dependencies = [
237
+ "cfg-if",
238
+ "libc",
239
+ "wasi",
240
+ ]
241
+
87
242
  [[package]]
88
243
  name = "heck"
89
244
  version = "0.5.0"
90
245
  source = "registry+https://github.com/rust-lang/crates.io-index"
91
246
  checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
92
247
 
248
+ [[package]]
249
+ name = "itoa"
250
+ version = "1.0.18"
251
+ source = "registry+https://github.com/rust-lang/crates.io-index"
252
+ checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
253
+
93
254
  [[package]]
94
255
  name = "libc"
95
256
  version = "0.2.180"
@@ -112,6 +273,12 @@ dependencies = [
112
273
  "rawpointer",
113
274
  ]
114
275
 
276
+ [[package]]
277
+ name = "memchr"
278
+ version = "2.8.1"
279
+ source = "registry+https://github.com/rust-lang/crates.io-index"
280
+ checksum = "6b947ae49db0d222b1dbc6b113ce7248a3fc3a6ca21b696717bfc000ba4484d8"
281
+
115
282
  [[package]]
116
283
  name = "ndarray"
117
284
  version = "0.17.2"
@@ -176,6 +343,16 @@ version = "1.21.3"
176
343
  source = "registry+https://github.com/rust-lang/crates.io-index"
177
344
  checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
178
345
 
346
+ [[package]]
347
+ name = "pkcs8"
348
+ version = "0.10.2"
349
+ source = "registry+https://github.com/rust-lang/crates.io-index"
350
+ checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7"
351
+ dependencies = [
352
+ "der",
353
+ "spki",
354
+ ]
355
+
179
356
  [[package]]
180
357
  name = "portable-atomic"
181
358
  version = "1.13.1"
@@ -288,6 +465,15 @@ dependencies = [
288
465
  "proc-macro2",
289
466
  ]
290
467
 
468
+ [[package]]
469
+ name = "rand_core"
470
+ version = "0.6.4"
471
+ source = "registry+https://github.com/rust-lang/crates.io-index"
472
+ checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
473
+ dependencies = [
474
+ "getrandom",
475
+ ]
476
+
291
477
  [[package]]
292
478
  name = "rawpointer"
293
479
  version = "0.2.1"
@@ -320,18 +506,112 @@ version = "2.1.1"
320
506
  source = "registry+https://github.com/rust-lang/crates.io-index"
321
507
  checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
322
508
 
509
+ [[package]]
510
+ name = "rustc_version"
511
+ version = "0.4.1"
512
+ source = "registry+https://github.com/rust-lang/crates.io-index"
513
+ checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
514
+ dependencies = [
515
+ "semver",
516
+ ]
517
+
323
518
  [[package]]
324
519
  name = "rustversion"
325
520
  version = "1.0.22"
326
521
  source = "registry+https://github.com/rust-lang/crates.io-index"
327
522
  checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
328
523
 
524
+ [[package]]
525
+ name = "semver"
526
+ version = "1.0.28"
527
+ source = "registry+https://github.com/rust-lang/crates.io-index"
528
+ checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"
529
+
530
+ [[package]]
531
+ name = "serde"
532
+ version = "1.0.228"
533
+ source = "registry+https://github.com/rust-lang/crates.io-index"
534
+ checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
535
+ dependencies = [
536
+ "serde_core",
537
+ "serde_derive",
538
+ ]
539
+
540
+ [[package]]
541
+ name = "serde_core"
542
+ version = "1.0.228"
543
+ source = "registry+https://github.com/rust-lang/crates.io-index"
544
+ checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
545
+ dependencies = [
546
+ "serde_derive",
547
+ ]
548
+
549
+ [[package]]
550
+ name = "serde_derive"
551
+ version = "1.0.228"
552
+ source = "registry+https://github.com/rust-lang/crates.io-index"
553
+ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
554
+ dependencies = [
555
+ "proc-macro2",
556
+ "quote",
557
+ "syn",
558
+ ]
559
+
560
+ [[package]]
561
+ name = "serde_json"
562
+ version = "1.0.150"
563
+ source = "registry+https://github.com/rust-lang/crates.io-index"
564
+ checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9"
565
+ dependencies = [
566
+ "itoa",
567
+ "memchr",
568
+ "serde",
569
+ "serde_core",
570
+ "zmij",
571
+ ]
572
+
573
+ [[package]]
574
+ name = "sha2"
575
+ version = "0.10.9"
576
+ source = "registry+https://github.com/rust-lang/crates.io-index"
577
+ checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
578
+ dependencies = [
579
+ "cfg-if",
580
+ "cpufeatures",
581
+ "digest",
582
+ ]
583
+
329
584
  [[package]]
330
585
  name = "shlex"
331
586
  version = "1.3.0"
332
587
  source = "registry+https://github.com/rust-lang/crates.io-index"
333
588
  checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
334
589
 
590
+ [[package]]
591
+ name = "signature"
592
+ version = "2.2.0"
593
+ source = "registry+https://github.com/rust-lang/crates.io-index"
594
+ checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de"
595
+ dependencies = [
596
+ "rand_core",
597
+ ]
598
+
599
+ [[package]]
600
+ name = "spki"
601
+ version = "0.7.3"
602
+ source = "registry+https://github.com/rust-lang/crates.io-index"
603
+ checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d"
604
+ dependencies = [
605
+ "base64ct",
606
+ "der",
607
+ ]
608
+
609
+ [[package]]
610
+ name = "subtle"
611
+ version = "2.6.1"
612
+ source = "registry+https://github.com/rust-lang/crates.io-index"
613
+ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
614
+
335
615
  [[package]]
336
616
  name = "syn"
337
617
  version = "2.0.114"
@@ -369,8 +649,38 @@ dependencies = [
369
649
  "syn",
370
650
  ]
371
651
 
652
+ [[package]]
653
+ name = "typenum"
654
+ version = "1.20.1"
655
+ source = "registry+https://github.com/rust-lang/crates.io-index"
656
+ checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"
657
+
372
658
  [[package]]
373
659
  name = "unicode-ident"
374
660
  version = "1.0.22"
375
661
  source = "registry+https://github.com/rust-lang/crates.io-index"
376
662
  checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"
663
+
664
+ [[package]]
665
+ name = "version_check"
666
+ version = "0.9.5"
667
+ source = "registry+https://github.com/rust-lang/crates.io-index"
668
+ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
669
+
670
+ [[package]]
671
+ name = "wasi"
672
+ version = "0.11.1+wasi-snapshot-preview1"
673
+ source = "registry+https://github.com/rust-lang/crates.io-index"
674
+ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
675
+
676
+ [[package]]
677
+ name = "zeroize"
678
+ version = "1.8.2"
679
+ source = "registry+https://github.com/rust-lang/crates.io-index"
680
+ checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0"
681
+
682
+ [[package]]
683
+ name = "zmij"
684
+ version = "1.0.21"
685
+ source = "registry+https://github.com/rust-lang/crates.io-index"
686
+ checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa"
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "betaquant"
3
- version = "0.5.9"
3
+ version = "0.6.2"
4
4
  edition = "2024"
5
5
  authors = ["ZhaoJun"]
6
6
  readme = "README.md"
@@ -19,6 +19,11 @@ numpy = "0.28"
19
19
  num-traits = "0.2"
20
20
  rayon = "1.11"
21
21
  log = "0.4"
22
+ ed25519-dalek = "2"
23
+ base64 = "0.22"
24
+ serde = { version = "1", features = ["derive"] }
25
+ serde_json = "1"
26
+ sha2 = "0.10"
22
27
 
23
28
 
24
29
  [build-dependencies]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: betaquant
3
- Version: 0.5.9
3
+ Version: 0.6.2
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -28,6 +28,64 @@ Project-URL: repository, https://home.zhaojun.com
28
28
  pip install betaquant
29
29
  ```
30
30
 
31
+ ## 授权(License Token)
32
+
33
+ betaquant 的算子受许可证(license)保护,**使用前需持有有效的 license token**。
34
+
35
+
36
+ ### 取得机器指纹(机器绑定用)
37
+
38
+ ```python
39
+ import betaquant
40
+
41
+ machine = betaquant.machine_fingerprint() # 跨 Linux/Windows,机器绑定以它为准
42
+ print(machine)
43
+ ```
44
+
45
+ 把该指纹提交给签发方,换取绑定到本机的 token。
46
+
47
+ ### 启用 token:算子入口自动鉴权(推荐)
48
+
49
+ 调用 `set_license_token` 把 token 设入进程级状态后,**每个算子入口都会自动鉴权**:
50
+ 未授权 / 过期 / 未设 token 时算子直接抛 `ValueError`,无需在每次调用前手写判断。
51
+
52
+
53
+ ```python
54
+ import betaquant
55
+
56
+ token = "<从签发方取得的 license key>"
57
+ betaquant.set_license_token(token) # 启动时一次
58
+
59
+ result = betaquant.ts_ma(data, 3) # 已授权 → 正常计算
60
+ # 若 token 未设置 / 过期 / 该算子不在 allow,betaquant.ts_ma(...) 直接抛 ValueError
61
+ ```
62
+
63
+ > 不调用 `set_license_token` 而直接调算子会抛 `ValueError`。这是与早期版本的关键区别:
64
+ > 鉴权不再依赖调用方自觉判断,而是内嵌在每个算子入口。
65
+
66
+ ### 手动校验(可选)
67
+
68
+ 也可显式验签或单独判断某算子是否授权(不改变进程级 token 状态):
69
+
70
+ ```python
71
+ # 验签 + 校验(失败 / 过期 / 机器不符抛 ValueError),返回声明 dict
72
+ claims = betaquant.verify_license(token, machine=machine)
73
+
74
+ # 判断某算子是否被授权(token 无效 / 过期直接返回 False)
75
+ if betaquant.license_allows(token, "ts_ma", machine=machine):
76
+ ...
77
+ ```
78
+
79
+ 授权语义(**默认拒绝**):算子必须显式出现在 `allow`(或 `allow` 含 `"*"`)才放行;
80
+ `deny` 优先级高于 `allow`。`allow=[]` 表示全部拒绝,并非不限制。
81
+
82
+ > 过期判定使用本机系统时间,离线方案对“改系统时间”无法根治,属已知限制:用短有效期
83
+ > + 定期换发缓解。
84
+
85
+ 更完整的端到端示例(签发 → 启用 token → 算子硬门禁 → 过期续期 → 机器绑定)见
86
+ `encryptor/license/examples/demo.py`。签发方封装见 `encryptor/license`
87
+ (`LicenseService`)。
88
+
31
89
  ## 使用
32
90
 
33
91
  ### 上下文设置
@@ -12,6 +12,64 @@
12
12
  pip install betaquant
13
13
  ```
14
14
 
15
+ ## 授权(License Token)
16
+
17
+ betaquant 的算子受许可证(license)保护,**使用前需持有有效的 license token**。
18
+
19
+
20
+ ### 取得机器指纹(机器绑定用)
21
+
22
+ ```python
23
+ import betaquant
24
+
25
+ machine = betaquant.machine_fingerprint() # 跨 Linux/Windows,机器绑定以它为准
26
+ print(machine)
27
+ ```
28
+
29
+ 把该指纹提交给签发方,换取绑定到本机的 token。
30
+
31
+ ### 启用 token:算子入口自动鉴权(推荐)
32
+
33
+ 调用 `set_license_token` 把 token 设入进程级状态后,**每个算子入口都会自动鉴权**:
34
+ 未授权 / 过期 / 未设 token 时算子直接抛 `ValueError`,无需在每次调用前手写判断。
35
+
36
+
37
+ ```python
38
+ import betaquant
39
+
40
+ token = "<从签发方取得的 license key>"
41
+ betaquant.set_license_token(token) # 启动时一次
42
+
43
+ result = betaquant.ts_ma(data, 3) # 已授权 → 正常计算
44
+ # 若 token 未设置 / 过期 / 该算子不在 allow,betaquant.ts_ma(...) 直接抛 ValueError
45
+ ```
46
+
47
+ > 不调用 `set_license_token` 而直接调算子会抛 `ValueError`。这是与早期版本的关键区别:
48
+ > 鉴权不再依赖调用方自觉判断,而是内嵌在每个算子入口。
49
+
50
+ ### 手动校验(可选)
51
+
52
+ 也可显式验签或单独判断某算子是否授权(不改变进程级 token 状态):
53
+
54
+ ```python
55
+ # 验签 + 校验(失败 / 过期 / 机器不符抛 ValueError),返回声明 dict
56
+ claims = betaquant.verify_license(token, machine=machine)
57
+
58
+ # 判断某算子是否被授权(token 无效 / 过期直接返回 False)
59
+ if betaquant.license_allows(token, "ts_ma", machine=machine):
60
+ ...
61
+ ```
62
+
63
+ 授权语义(**默认拒绝**):算子必须显式出现在 `allow`(或 `allow` 含 `"*"`)才放行;
64
+ `deny` 优先级高于 `allow`。`allow=[]` 表示全部拒绝,并非不限制。
65
+
66
+ > 过期判定使用本机系统时间,离线方案对“改系统时间”无法根治,属已知限制:用短有效期
67
+ > + 定期换发缓解。
68
+
69
+ 更完整的端到端示例(签发 → 启用 token → 算子硬门禁 → 过期续期 → 机器绑定)见
70
+ `encryptor/license/examples/demo.py`。签发方封装见 `encryptor/license`
71
+ (`LicenseService`)。
72
+
15
73
  ## 使用
16
74
 
17
75
  ### 上下文设置
@@ -218,6 +218,13 @@ fn build_py_bindings(functions: &[TaFunc]) -> Result<()> {
218
218
  write!(code, "{}", py_args)?;
219
219
  writeln!(code, " ) -> PyResult<()> {{")?;
220
220
 
221
+ // license 硬门禁:算子入口先做鉴权,未授权 / 过期 / 未设置 token 直接抛 ValueError。
222
+ writeln!(
223
+ code,
224
+ " crate::license::require_for(\"{}\").map_err(|e| PyValueError::new_err(e.to_string()))?;",
225
+ py_func_name
226
+ )?;
227
+
221
228
  writeln!(code, " let ctx = ctx(py);")?;
222
229
 
223
230
  let arrays: Vec<(&String, &TaType)> = func
@@ -0,0 +1,14 @@
1
+ # Copyright 2026 MSD-RS Project LiJia
2
+ # SPDX-License-Identifier: BSD-2-Clause
3
+
4
+ from .manual import ts_ema
5
+ from .algo_gen import *
6
+ from ._algo import (
7
+ set_ctx,
8
+ reset_ctx,
9
+ verify_license,
10
+ license_allows,
11
+ machine_fingerprint,
12
+ set_license_token,
13
+ clear_license_token,
14
+ )