seqpro 0.15.2__tar.gz → 0.16.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.
Files changed (116) hide show
  1. seqpro-0.16.0/.github/workflows/bench.yaml +60 -0
  2. {seqpro-0.15.2 → seqpro-0.16.0}/CHANGELOG.md +6 -0
  3. {seqpro-0.15.2 → seqpro-0.16.0}/Cargo.lock +221 -36
  4. {seqpro-0.15.2 → seqpro-0.16.0}/Cargo.toml +1 -1
  5. {seqpro-0.15.2 → seqpro-0.16.0}/PKG-INFO +1 -1
  6. {seqpro-0.15.2 → seqpro-0.16.0}/README.md +1 -0
  7. {seqpro-0.15.2 → seqpro-0.16.0}/pyproject.toml +1 -1
  8. {seqpro-0.15.2 → seqpro-0.16.0}/python/seqpro/_encoders.py +33 -8
  9. {seqpro-0.15.2 → seqpro-0.16.0}/skills/seqpro/SKILL.md +1 -1
  10. {seqpro-0.15.2 → seqpro-0.16.0}/tests/test_tokenize.py +50 -0
  11. seqpro-0.15.2/.github/workflows/bench.yaml +0 -31
  12. {seqpro-0.15.2 → seqpro-0.16.0}/.claude/skills/zensical/SKILL.md +0 -0
  13. {seqpro-0.15.2 → seqpro-0.16.0}/.gitattributes +0 -0
  14. {seqpro-0.15.2 → seqpro-0.16.0}/.github/workflows/bump.yaml +0 -0
  15. {seqpro-0.15.2 → seqpro-0.16.0}/.github/workflows/docs.yml +0 -0
  16. {seqpro-0.15.2 → seqpro-0.16.0}/.github/workflows/lint.yaml +0 -0
  17. {seqpro-0.15.2 → seqpro-0.16.0}/.github/workflows/merge.yaml +0 -0
  18. {seqpro-0.15.2 → seqpro-0.16.0}/.github/workflows/publish.yaml +0 -0
  19. {seqpro-0.15.2 → seqpro-0.16.0}/.github/workflows/release-pipeline.yaml +0 -0
  20. {seqpro-0.15.2 → seqpro-0.16.0}/.github/workflows/release.yaml +0 -0
  21. {seqpro-0.15.2 → seqpro-0.16.0}/.github/workflows/test.yaml +0 -0
  22. {seqpro-0.15.2 → seqpro-0.16.0}/.gitignore +0 -0
  23. {seqpro-0.15.2 → seqpro-0.16.0}/.pre-commit-config.yaml +0 -0
  24. {seqpro-0.15.2 → seqpro-0.16.0}/CLAUDE.md +0 -0
  25. {seqpro-0.15.2 → seqpro-0.16.0}/LICENSE +0 -0
  26. {seqpro-0.15.2 → seqpro-0.16.0}/benches/kshuffle.rs +0 -0
  27. {seqpro-0.15.2 → seqpro-0.16.0}/benchmarks/bench_to_packed.py +0 -0
  28. {seqpro-0.15.2 → seqpro-0.16.0}/docs/api/alphabets.md +0 -0
  29. {seqpro-0.15.2 → seqpro-0.16.0}/docs/api/bed.md +0 -0
  30. {seqpro-0.15.2 → seqpro-0.16.0}/docs/api/gtf.md +0 -0
  31. {seqpro-0.15.2 → seqpro-0.16.0}/docs/api/index.md +0 -0
  32. {seqpro-0.15.2 → seqpro-0.16.0}/docs/api/ragged.md +0 -0
  33. {seqpro-0.15.2 → seqpro-0.16.0}/docs/api/types.md +0 -0
  34. {seqpro-0.15.2 → seqpro-0.16.0}/docs/index.md +0 -0
  35. {seqpro-0.15.2 → seqpro-0.16.0}/docs/ragged.md +0 -0
  36. {seqpro-0.15.2 → seqpro-0.16.0}/docs/superpowers/plans/2026-05-04-ragged-record-array.md +0 -0
  37. {seqpro-0.15.2 → seqpro-0.16.0}/docs/superpowers/plans/2026-05-05-documentation-site.md +0 -0
  38. {seqpro-0.15.2 → seqpro-0.16.0}/docs/superpowers/plans/2026-05-05-narwhals-coord-schema.md +0 -0
  39. {seqpro-0.15.2 → seqpro-0.16.0}/docs/superpowers/plans/2026-05-05-ragged-zip-and-record-introspection.md +0 -0
  40. {seqpro-0.15.2 → seqpro-0.16.0}/docs/superpowers/plans/2026-05-20-kshuffle-optimization.md +0 -0
  41. {seqpro-0.15.2 → seqpro-0.16.0}/docs/superpowers/plans/2026-05-20-kshuffle-pooled-buffers-and-k2-fast-path.md +0 -0
  42. {seqpro-0.15.2 → seqpro-0.16.0}/docs/superpowers/plans/2026-05-20-kshuffle-wilson-single-pass.md +0 -0
  43. {seqpro-0.15.2 → seqpro-0.16.0}/docs/superpowers/plans/2026-05-20-release-pipeline.md +0 -0
  44. {seqpro-0.15.2 → seqpro-0.16.0}/docs/superpowers/plans/2026-05-28-translate-lut-validation.md +0 -0
  45. {seqpro-0.15.2 → seqpro-0.16.0}/docs/superpowers/plans/2026-05-31-flat-buffer-to-padded.md +0 -0
  46. {seqpro-0.15.2 → seqpro-0.16.0}/docs/superpowers/plans/2026-05-31-rag-to-packed.md +0 -0
  47. {seqpro-0.15.2 → seqpro-0.16.0}/docs/superpowers/plans/2026-06-05-translate-unknown-codon-policy.md +0 -0
  48. {seqpro-0.15.2 → seqpro-0.16.0}/docs/superpowers/plans/2026-06-12-tokenize-lut-codspeed.md +0 -0
  49. {seqpro-0.15.2 → seqpro-0.16.0}/docs/superpowers/specs/2026-05-04-ragged-record-array-design.md +0 -0
  50. {seqpro-0.15.2 → seqpro-0.16.0}/docs/superpowers/specs/2026-05-05-documentation-site-design.md +0 -0
  51. {seqpro-0.15.2 → seqpro-0.16.0}/docs/superpowers/specs/2026-05-05-narwhals-coord-schema-design.md +0 -0
  52. {seqpro-0.15.2 → seqpro-0.16.0}/docs/superpowers/specs/2026-05-05-ragged-zip-and-record-introspection-design.md +0 -0
  53. {seqpro-0.15.2 → seqpro-0.16.0}/docs/superpowers/specs/2026-05-20-kshuffle-optimization-design.md +0 -0
  54. {seqpro-0.15.2 → seqpro-0.16.0}/docs/superpowers/specs/2026-05-20-kshuffle-pooled-buffers-and-k2-fast-path-design.md +0 -0
  55. {seqpro-0.15.2 → seqpro-0.16.0}/docs/superpowers/specs/2026-05-20-kshuffle-wilson-single-pass-design.md +0 -0
  56. {seqpro-0.15.2 → seqpro-0.16.0}/docs/superpowers/specs/2026-05-20-release-pipeline-design.md +0 -0
  57. {seqpro-0.15.2 → seqpro-0.16.0}/docs/superpowers/specs/2026-05-28-translate-lut-and-validation-design.md +0 -0
  58. {seqpro-0.15.2 → seqpro-0.16.0}/docs/superpowers/specs/2026-05-31-flat-buffer-to-padded-design.md +0 -0
  59. {seqpro-0.15.2 → seqpro-0.16.0}/docs/superpowers/specs/2026-05-31-rag-to-packed-design.md +0 -0
  60. {seqpro-0.15.2 → seqpro-0.16.0}/docs/superpowers/specs/2026-06-05-translate-unknown-codon-policy-design.md +0 -0
  61. {seqpro-0.15.2 → seqpro-0.16.0}/docs/superpowers/specs/2026-06-12-tokenize-lut-codspeed-design.md +0 -0
  62. {seqpro-0.15.2 → seqpro-0.16.0}/meta.yaml +0 -0
  63. {seqpro-0.15.2 → seqpro-0.16.0}/pixi.lock +0 -0
  64. {seqpro-0.15.2 → seqpro-0.16.0}/pixi.toml +0 -0
  65. {seqpro-0.15.2 → seqpro-0.16.0}/python/seqpro/__init__.py +0 -0
  66. {seqpro-0.15.2 → seqpro-0.16.0}/python/seqpro/_analyzers.py +0 -0
  67. {seqpro-0.15.2 → seqpro-0.16.0}/python/seqpro/_cleaners.py +0 -0
  68. {seqpro-0.15.2 → seqpro-0.16.0}/python/seqpro/_coords.py +0 -0
  69. {seqpro-0.15.2 → seqpro-0.16.0}/python/seqpro/_modifiers.py +0 -0
  70. {seqpro-0.15.2 → seqpro-0.16.0}/python/seqpro/_numba.py +0 -0
  71. {seqpro-0.15.2 → seqpro-0.16.0}/python/seqpro/_types.py +0 -0
  72. {seqpro-0.15.2 → seqpro-0.16.0}/python/seqpro/_utils.py +0 -0
  73. {seqpro-0.15.2 → seqpro-0.16.0}/python/seqpro/alphabets/__init__.py +0 -0
  74. {seqpro-0.15.2 → seqpro-0.16.0}/python/seqpro/alphabets/_alphabets.py +0 -0
  75. {seqpro-0.15.2 → seqpro-0.16.0}/python/seqpro/bed.py +0 -0
  76. {seqpro-0.15.2 → seqpro-0.16.0}/python/seqpro/experimental/_experimental.py +0 -0
  77. {seqpro-0.15.2 → seqpro-0.16.0}/python/seqpro/experimental/_visualizers.py +0 -0
  78. {seqpro-0.15.2 → seqpro-0.16.0}/python/seqpro/gtf.py +0 -0
  79. {seqpro-0.15.2 → seqpro-0.16.0}/python/seqpro/py.typed +0 -0
  80. {seqpro-0.15.2 → seqpro-0.16.0}/python/seqpro/rag/__init__.py +0 -0
  81. {seqpro-0.15.2 → seqpro-0.16.0}/python/seqpro/rag/_array.py +0 -0
  82. {seqpro-0.15.2 → seqpro-0.16.0}/python/seqpro/rag/_gufuncs.py +0 -0
  83. {seqpro-0.15.2 → seqpro-0.16.0}/python/seqpro/rag/_ops.py +0 -0
  84. {seqpro-0.15.2 → seqpro-0.16.0}/python/seqpro/rag/_types.py +0 -0
  85. {seqpro-0.15.2 → seqpro-0.16.0}/python/seqpro/rag/_utils.py +0 -0
  86. {seqpro-0.15.2 → seqpro-0.16.0}/python/seqpro/transforms/__init__.py +0 -0
  87. {seqpro-0.15.2 → seqpro-0.16.0}/python/seqpro/transforms/augmentation.py +0 -0
  88. {seqpro-0.15.2 → seqpro-0.16.0}/python/seqpro/transforms/tmm.py +0 -0
  89. {seqpro-0.15.2 → seqpro-0.16.0}/python/seqpro/xr/__init__.py +0 -0
  90. {seqpro-0.15.2 → seqpro-0.16.0}/scratch_bench_rc.py +0 -0
  91. {seqpro-0.15.2 → seqpro-0.16.0}/scratch_bench_to_padded.py +0 -0
  92. {seqpro-0.15.2 → seqpro-0.16.0}/src/kmer_encode.rs +0 -0
  93. {seqpro-0.15.2 → seqpro-0.16.0}/src/kshuffle.rs +0 -0
  94. {seqpro-0.15.2 → seqpro-0.16.0}/src/kshuffle_ref.rs +0 -0
  95. {seqpro-0.15.2 → seqpro-0.16.0}/src/lib.rs +0 -0
  96. {seqpro-0.15.2 → seqpro-0.16.0}/tests/_shape_fixtures.py +0 -0
  97. {seqpro-0.15.2 → seqpro-0.16.0}/tests/bed/test_pyranges.py +0 -0
  98. {seqpro-0.15.2 → seqpro-0.16.0}/tests/bed/test_read.py +0 -0
  99. {seqpro-0.15.2 → seqpro-0.16.0}/tests/bed/test_sort.py +0 -0
  100. {seqpro-0.15.2 → seqpro-0.16.0}/tests/bed/test_with_length.py +0 -0
  101. {seqpro-0.15.2 → seqpro-0.16.0}/tests/bench_translate_lut.py +0 -0
  102. {seqpro-0.15.2 → seqpro-0.16.0}/tests/conftest.py +0 -0
  103. {seqpro-0.15.2 → seqpro-0.16.0}/tests/test_analyzers.py +0 -0
  104. {seqpro-0.15.2 → seqpro-0.16.0}/tests/test_bench_tokenize.py +0 -0
  105. {seqpro-0.15.2 → seqpro-0.16.0}/tests/test_coords.py +0 -0
  106. {seqpro-0.15.2 → seqpro-0.16.0}/tests/test_encoders.py +0 -0
  107. {seqpro-0.15.2 → seqpro-0.16.0}/tests/test_modifiers.py +0 -0
  108. {seqpro-0.15.2 → seqpro-0.16.0}/tests/test_ohe.py +0 -0
  109. {seqpro-0.15.2 → seqpro-0.16.0}/tests/test_rag_to_packed.py +0 -0
  110. {seqpro-0.15.2 → seqpro-0.16.0}/tests/test_ragged.py +0 -0
  111. {seqpro-0.15.2 → seqpro-0.16.0}/tests/test_ragged_rc.py +0 -0
  112. {seqpro-0.15.2 → seqpro-0.16.0}/tests/test_ragged_to_padded.py +0 -0
  113. {seqpro-0.15.2 → seqpro-0.16.0}/tests/test_shape_matrix.py +0 -0
  114. {seqpro-0.15.2 → seqpro-0.16.0}/tests/test_transforms.py +0 -0
  115. {seqpro-0.15.2 → seqpro-0.16.0}/tests/test_translate.py +0 -0
  116. {seqpro-0.15.2 → seqpro-0.16.0}/zensical.toml +0 -0
@@ -0,0 +1,60 @@
1
+ name: Benchmarks
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ branches:
9
+ - main
10
+ workflow_dispatch:
11
+
12
+ permissions:
13
+ contents: read
14
+ id-token: write # for OpenID Connect authentication with CodSpeed
15
+
16
+ jobs:
17
+ python-benchmarks:
18
+ runs-on: ubuntu-latest
19
+ name: "Run Python CodSpeed benchmarks"
20
+ steps:
21
+ - name: Check out
22
+ uses: actions/checkout@v4
23
+ with:
24
+ fetch-depth: 0
25
+ - name: Setup pixi
26
+ uses: prefix-dev/setup-pixi@v0.9.5
27
+ with:
28
+ pixi-version: v0.67.2
29
+ cache: true
30
+ environments: bench
31
+ locked: false
32
+ - name: Build extension
33
+ run: pixi run -e bench maturin develop
34
+ - name: Run benchmarks
35
+ uses: CodSpeedHQ/action@v4
36
+ with:
37
+ mode: simulation
38
+ run: pixi run -e bench bench
39
+
40
+ rust-benchmarks:
41
+ runs-on: ubuntu-latest
42
+ name: "Run Rust CodSpeed benchmarks"
43
+ steps:
44
+ - name: Check out
45
+ uses: actions/checkout@v4
46
+ with:
47
+ fetch-depth: 0
48
+ - name: Setup rust toolchain, cache and cargo-codspeed binary
49
+ uses: moonrepo/setup-rust@v0
50
+ with:
51
+ channel: stable
52
+ cache-target: release
53
+ bins: cargo-codspeed
54
+ - name: Build the benchmark target(s)
55
+ run: cargo codspeed build
56
+ - name: Run benchmarks
57
+ uses: CodSpeedHQ/action@v4
58
+ with:
59
+ mode: simulation
60
+ run: cargo codspeed run
@@ -1,3 +1,9 @@
1
+ ## 0.16.0 (2026-06-14)
2
+
3
+ ### Feat
4
+
5
+ - **tokenize**: add parallel escape hatch overriding the size heuristic
6
+
1
7
  ## 0.15.2 (2026-06-13)
2
8
 
3
9
  ### Fix
@@ -29,6 +29,15 @@ version = "1.0.99"
29
29
  source = "registry+https://github.com/rust-lang/crates.io-index"
30
30
  checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100"
31
31
 
32
+ [[package]]
33
+ name = "approx"
34
+ version = "0.5.1"
35
+ source = "registry+https://github.com/rust-lang/crates.io-index"
36
+ checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6"
37
+ dependencies = [
38
+ "num-traits",
39
+ ]
40
+
32
41
  [[package]]
33
42
  name = "autocfg"
34
43
  version = "1.5.0"
@@ -64,9 +73,9 @@ checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3"
64
73
 
65
74
  [[package]]
66
75
  name = "bumpalo"
67
- version = "3.20.2"
76
+ version = "3.20.3"
68
77
  source = "registry+https://github.com/rust-lang/crates.io-index"
69
- checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb"
78
+ checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649"
70
79
 
71
80
  [[package]]
72
81
  name = "cast"
@@ -74,12 +83,28 @@ version = "0.3.0"
74
83
  source = "registry+https://github.com/rust-lang/crates.io-index"
75
84
  checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
76
85
 
86
+ [[package]]
87
+ name = "cc"
88
+ version = "1.2.64"
89
+ source = "registry+https://github.com/rust-lang/crates.io-index"
90
+ checksum = "dad887fd958be91b5098c0248def011f4523ab786cd411be668777e55063501f"
91
+ dependencies = [
92
+ "find-msvc-tools",
93
+ "shlex",
94
+ ]
95
+
77
96
  [[package]]
78
97
  name = "cfg-if"
79
98
  version = "1.0.3"
80
99
  source = "registry+https://github.com/rust-lang/crates.io-index"
81
100
  checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9"
82
101
 
102
+ [[package]]
103
+ name = "cfg_aliases"
104
+ version = "0.2.1"
105
+ source = "registry+https://github.com/rust-lang/crates.io-index"
106
+ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
107
+
83
108
  [[package]]
84
109
  name = "ciborium"
85
110
  version = "0.2.2"
@@ -133,15 +158,47 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
133
158
  checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9"
134
159
 
135
160
  [[package]]
136
- name = "criterion"
137
- version = "0.5.1"
161
+ name = "codspeed"
162
+ version = "4.7.0"
163
+ source = "registry+https://github.com/rust-lang/crates.io-index"
164
+ checksum = "57af92d1db7f6871b7e82c79cd87f2501db66f36b0eab924be6ea83dd6b2f3f3"
165
+ dependencies = [
166
+ "anyhow",
167
+ "cc",
168
+ "colored",
169
+ "getrandom 0.2.11",
170
+ "glob",
171
+ "libc",
172
+ "nix",
173
+ "serde",
174
+ "serde_json",
175
+ "statrs",
176
+ ]
177
+
178
+ [[package]]
179
+ name = "codspeed-criterion-compat"
180
+ version = "4.7.0"
138
181
  source = "registry+https://github.com/rust-lang/crates.io-index"
139
- checksum = "f2b12d017a929603d80db1831cd3a24082f8137ce19c69e6447f54f5fc8d692f"
182
+ checksum = "1d31ae2e9ab23c29fa13bdfa06d012524176f5c0f4e25ec262cd829d947ebc5e"
183
+ dependencies = [
184
+ "clap",
185
+ "codspeed",
186
+ "codspeed-criterion-compat-walltime",
187
+ "colored",
188
+ "regex",
189
+ ]
190
+
191
+ [[package]]
192
+ name = "codspeed-criterion-compat-walltime"
193
+ version = "4.7.0"
194
+ source = "registry+https://github.com/rust-lang/crates.io-index"
195
+ checksum = "cc8605e40bab5114dcb0f76268e18880082b5798dec10757b5b58d2c3bbc7a1c"
140
196
  dependencies = [
141
197
  "anes",
142
198
  "cast",
143
199
  "ciborium",
144
200
  "clap",
201
+ "codspeed",
145
202
  "criterion-plot",
146
203
  "is-terminal",
147
204
  "itertools",
@@ -158,6 +215,16 @@ dependencies = [
158
215
  "walkdir",
159
216
  ]
160
217
 
218
+ [[package]]
219
+ name = "colored"
220
+ version = "2.2.0"
221
+ source = "registry+https://github.com/rust-lang/crates.io-index"
222
+ checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c"
223
+ dependencies = [
224
+ "lazy_static",
225
+ "windows-sys 0.59.0",
226
+ ]
227
+
161
228
  [[package]]
162
229
  name = "criterion-plot"
163
230
  version = "0.5.0"
@@ -284,7 +351,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
284
351
  checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
285
352
  dependencies = [
286
353
  "libc",
287
- "windows-sys",
354
+ "windows-sys 0.61.2",
288
355
  ]
289
356
 
290
357
  [[package]]
@@ -293,6 +360,12 @@ version = "2.4.1"
293
360
  source = "registry+https://github.com/rust-lang/crates.io-index"
294
361
  checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6"
295
362
 
363
+ [[package]]
364
+ name = "find-msvc-tools"
365
+ version = "0.1.9"
366
+ source = "registry+https://github.com/rust-lang/crates.io-index"
367
+ checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
368
+
296
369
  [[package]]
297
370
  name = "fnv"
298
371
  version = "1.0.7"
@@ -365,6 +438,12 @@ dependencies = [
365
438
  "wasip3",
366
439
  ]
367
440
 
441
+ [[package]]
442
+ name = "glob"
443
+ version = "0.3.3"
444
+ source = "registry+https://github.com/rust-lang/crates.io-index"
445
+ checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"
446
+
368
447
  [[package]]
369
448
  name = "half"
370
449
  version = "2.7.1"
@@ -447,7 +526,7 @@ checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46"
447
526
  dependencies = [
448
527
  "hermit-abi",
449
528
  "libc",
450
- "windows-sys",
529
+ "windows-sys 0.61.2",
451
530
  ]
452
531
 
453
532
  [[package]]
@@ -467,16 +546,21 @@ checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
467
546
 
468
547
  [[package]]
469
548
  name = "js-sys"
470
- version = "0.3.98"
549
+ version = "0.3.102"
471
550
  source = "registry+https://github.com/rust-lang/crates.io-index"
472
- checksum = "67df7112613f8bfd9150013a0314e196f4800d3201ae742489d999db2f979f08"
551
+ checksum = "03d04c30968dffe80775bd4d7fb676131cd04a1fb46d2686dbffbaec2d9dfd31"
473
552
  dependencies = [
474
553
  "cfg-if",
475
554
  "futures-util",
476
- "once_cell",
477
555
  "wasm-bindgen",
478
556
  ]
479
557
 
558
+ [[package]]
559
+ name = "lazy_static"
560
+ version = "1.5.0"
561
+ source = "registry+https://github.com/rust-lang/crates.io-index"
562
+ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
563
+
480
564
  [[package]]
481
565
  name = "leb128fmt"
482
566
  version = "0.1.0"
@@ -550,6 +634,18 @@ dependencies = [
550
634
  "rayon",
551
635
  ]
552
636
 
637
+ [[package]]
638
+ name = "nix"
639
+ version = "0.31.3"
640
+ source = "registry+https://github.com/rust-lang/crates.io-index"
641
+ checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d"
642
+ dependencies = [
643
+ "bitflags 2.11.1",
644
+ "cfg-if",
645
+ "cfg_aliases",
646
+ "libc",
647
+ ]
648
+
553
649
  [[package]]
554
650
  name = "num-complex"
555
651
  version = "0.4.4"
@@ -625,7 +721,7 @@ dependencies = [
625
721
  "libc",
626
722
  "redox_syscall",
627
723
  "smallvec",
628
- "windows-targets",
724
+ "windows-targets 0.48.5",
629
725
  ]
630
726
 
631
727
  [[package]]
@@ -942,7 +1038,7 @@ dependencies = [
942
1038
  "errno",
943
1039
  "libc",
944
1040
  "linux-raw-sys",
945
- "windows-sys",
1041
+ "windows-sys 0.61.2",
946
1042
  ]
947
1043
 
948
1044
  [[package]]
@@ -989,7 +1085,7 @@ name = "seqpro"
989
1085
  version = "0.1.0"
990
1086
  dependencies = [
991
1087
  "anyhow",
992
- "criterion",
1088
+ "codspeed-criterion-compat",
993
1089
  "derive_builder",
994
1090
  "ndarray",
995
1091
  "numpy",
@@ -1044,6 +1140,12 @@ dependencies = [
1044
1140
  "zmij",
1045
1141
  ]
1046
1142
 
1143
+ [[package]]
1144
+ name = "shlex"
1145
+ version = "2.0.1"
1146
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1147
+ checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
1148
+
1047
1149
  [[package]]
1048
1150
  name = "slab"
1049
1151
  version = "0.4.12"
@@ -1056,6 +1158,16 @@ version = "1.11.2"
1056
1158
  source = "registry+https://github.com/rust-lang/crates.io-index"
1057
1159
  checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970"
1058
1160
 
1161
+ [[package]]
1162
+ name = "statrs"
1163
+ version = "0.18.0"
1164
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1165
+ checksum = "2a3fe7c28c6512e766b0874335db33c94ad7b8f9054228ae1c2abd47ce7d335e"
1166
+ dependencies = [
1167
+ "approx",
1168
+ "num-traits",
1169
+ ]
1170
+
1059
1171
  [[package]]
1060
1172
  name = "strsim"
1061
1173
  version = "0.10.0"
@@ -1100,7 +1212,7 @@ dependencies = [
1100
1212
  "getrandom 0.4.2",
1101
1213
  "once_cell",
1102
1214
  "rustix",
1103
- "windows-sys",
1215
+ "windows-sys 0.61.2",
1104
1216
  ]
1105
1217
 
1106
1218
  [[package]]
@@ -1202,9 +1314,9 @@ dependencies = [
1202
1314
 
1203
1315
  [[package]]
1204
1316
  name = "wasm-bindgen"
1205
- version = "0.2.121"
1317
+ version = "0.2.125"
1206
1318
  source = "registry+https://github.com/rust-lang/crates.io-index"
1207
- checksum = "49ace1d07c165b0864824eee619580c4689389afa9dc9ed3a4c75040d82e6790"
1319
+ checksum = "8ddb3f79143bced6de84270411622a2699cee572fc0875aeaf1e7867cf9fca1a"
1208
1320
  dependencies = [
1209
1321
  "cfg-if",
1210
1322
  "once_cell",
@@ -1215,9 +1327,9 @@ dependencies = [
1215
1327
 
1216
1328
  [[package]]
1217
1329
  name = "wasm-bindgen-macro"
1218
- version = "0.2.121"
1330
+ version = "0.2.125"
1219
1331
  source = "registry+https://github.com/rust-lang/crates.io-index"
1220
- checksum = "8e68e6f4afd367a562002c05637acb8578ff2dea1943df76afb9e83d177c8578"
1332
+ checksum = "4e21a184b13fb19e157296e2c46056aec9092264fab83e4ba59e68c61b323c3d"
1221
1333
  dependencies = [
1222
1334
  "quote",
1223
1335
  "wasm-bindgen-macro-support",
@@ -1225,9 +1337,9 @@ dependencies = [
1225
1337
 
1226
1338
  [[package]]
1227
1339
  name = "wasm-bindgen-macro-support"
1228
- version = "0.2.121"
1340
+ version = "0.2.125"
1229
1341
  source = "registry+https://github.com/rust-lang/crates.io-index"
1230
- checksum = "d95a9ec35c64b2a7cb35d3fead40c4238d0940c86d107136999567a4703259f2"
1342
+ checksum = "fecefd9c35bd935a20fc3fc344b5f29138961e4f47fb03297d88f2587afb5ebd"
1231
1343
  dependencies = [
1232
1344
  "bumpalo",
1233
1345
  "proc-macro2",
@@ -1238,9 +1350,9 @@ dependencies = [
1238
1350
 
1239
1351
  [[package]]
1240
1352
  name = "wasm-bindgen-shared"
1241
- version = "0.2.121"
1353
+ version = "0.2.125"
1242
1354
  source = "registry+https://github.com/rust-lang/crates.io-index"
1243
- checksum = "c4e0100b01e9f0d03189a92b96772a1fb998639d981193d7dbab487302513441"
1355
+ checksum = "23939e44bb9a5d7576fa2b563dc2e136628f1224e88a8deed09e04858b77871f"
1244
1356
  dependencies = [
1245
1357
  "unicode-ident",
1246
1358
  ]
@@ -1281,9 +1393,9 @@ dependencies = [
1281
1393
 
1282
1394
  [[package]]
1283
1395
  name = "web-sys"
1284
- version = "0.3.98"
1396
+ version = "0.3.102"
1285
1397
  source = "registry+https://github.com/rust-lang/crates.io-index"
1286
- checksum = "4b572dff8bcf38bad0fa19729c89bb5748b2b9b1d8be70cf90df697e3a8f32aa"
1398
+ checksum = "a6430a72df5eb332242960fe84b3002a241163998241eb596d4f739b9757061d"
1287
1399
  dependencies = [
1288
1400
  "js-sys",
1289
1401
  "wasm-bindgen",
@@ -1295,7 +1407,7 @@ version = "0.1.11"
1295
1407
  source = "registry+https://github.com/rust-lang/crates.io-index"
1296
1408
  checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
1297
1409
  dependencies = [
1298
- "windows-sys",
1410
+ "windows-sys 0.61.2",
1299
1411
  ]
1300
1412
 
1301
1413
  [[package]]
@@ -1304,6 +1416,15 @@ version = "0.2.1"
1304
1416
  source = "registry+https://github.com/rust-lang/crates.io-index"
1305
1417
  checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
1306
1418
 
1419
+ [[package]]
1420
+ name = "windows-sys"
1421
+ version = "0.59.0"
1422
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1423
+ checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
1424
+ dependencies = [
1425
+ "windows-targets 0.52.6",
1426
+ ]
1427
+
1307
1428
  [[package]]
1308
1429
  name = "windows-sys"
1309
1430
  version = "0.61.2"
@@ -1319,13 +1440,29 @@ version = "0.48.5"
1319
1440
  source = "registry+https://github.com/rust-lang/crates.io-index"
1320
1441
  checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
1321
1442
  dependencies = [
1322
- "windows_aarch64_gnullvm",
1323
- "windows_aarch64_msvc",
1324
- "windows_i686_gnu",
1325
- "windows_i686_msvc",
1326
- "windows_x86_64_gnu",
1327
- "windows_x86_64_gnullvm",
1328
- "windows_x86_64_msvc",
1443
+ "windows_aarch64_gnullvm 0.48.5",
1444
+ "windows_aarch64_msvc 0.48.5",
1445
+ "windows_i686_gnu 0.48.5",
1446
+ "windows_i686_msvc 0.48.5",
1447
+ "windows_x86_64_gnu 0.48.5",
1448
+ "windows_x86_64_gnullvm 0.48.5",
1449
+ "windows_x86_64_msvc 0.48.5",
1450
+ ]
1451
+
1452
+ [[package]]
1453
+ name = "windows-targets"
1454
+ version = "0.52.6"
1455
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1456
+ checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
1457
+ dependencies = [
1458
+ "windows_aarch64_gnullvm 0.52.6",
1459
+ "windows_aarch64_msvc 0.52.6",
1460
+ "windows_i686_gnu 0.52.6",
1461
+ "windows_i686_gnullvm",
1462
+ "windows_i686_msvc 0.52.6",
1463
+ "windows_x86_64_gnu 0.52.6",
1464
+ "windows_x86_64_gnullvm 0.52.6",
1465
+ "windows_x86_64_msvc 0.52.6",
1329
1466
  ]
1330
1467
 
1331
1468
  [[package]]
@@ -1334,42 +1471,90 @@ version = "0.48.5"
1334
1471
  source = "registry+https://github.com/rust-lang/crates.io-index"
1335
1472
  checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
1336
1473
 
1474
+ [[package]]
1475
+ name = "windows_aarch64_gnullvm"
1476
+ version = "0.52.6"
1477
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1478
+ checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
1479
+
1337
1480
  [[package]]
1338
1481
  name = "windows_aarch64_msvc"
1339
1482
  version = "0.48.5"
1340
1483
  source = "registry+https://github.com/rust-lang/crates.io-index"
1341
1484
  checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
1342
1485
 
1486
+ [[package]]
1487
+ name = "windows_aarch64_msvc"
1488
+ version = "0.52.6"
1489
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1490
+ checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
1491
+
1343
1492
  [[package]]
1344
1493
  name = "windows_i686_gnu"
1345
1494
  version = "0.48.5"
1346
1495
  source = "registry+https://github.com/rust-lang/crates.io-index"
1347
1496
  checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
1348
1497
 
1498
+ [[package]]
1499
+ name = "windows_i686_gnu"
1500
+ version = "0.52.6"
1501
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1502
+ checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
1503
+
1504
+ [[package]]
1505
+ name = "windows_i686_gnullvm"
1506
+ version = "0.52.6"
1507
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1508
+ checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
1509
+
1349
1510
  [[package]]
1350
1511
  name = "windows_i686_msvc"
1351
1512
  version = "0.48.5"
1352
1513
  source = "registry+https://github.com/rust-lang/crates.io-index"
1353
1514
  checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
1354
1515
 
1516
+ [[package]]
1517
+ name = "windows_i686_msvc"
1518
+ version = "0.52.6"
1519
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1520
+ checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
1521
+
1355
1522
  [[package]]
1356
1523
  name = "windows_x86_64_gnu"
1357
1524
  version = "0.48.5"
1358
1525
  source = "registry+https://github.com/rust-lang/crates.io-index"
1359
1526
  checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
1360
1527
 
1528
+ [[package]]
1529
+ name = "windows_x86_64_gnu"
1530
+ version = "0.52.6"
1531
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1532
+ checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
1533
+
1361
1534
  [[package]]
1362
1535
  name = "windows_x86_64_gnullvm"
1363
1536
  version = "0.48.5"
1364
1537
  source = "registry+https://github.com/rust-lang/crates.io-index"
1365
1538
  checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
1366
1539
 
1540
+ [[package]]
1541
+ name = "windows_x86_64_gnullvm"
1542
+ version = "0.52.6"
1543
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1544
+ checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
1545
+
1367
1546
  [[package]]
1368
1547
  name = "windows_x86_64_msvc"
1369
1548
  version = "0.48.5"
1370
1549
  source = "registry+https://github.com/rust-lang/crates.io-index"
1371
1550
  checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
1372
1551
 
1552
+ [[package]]
1553
+ name = "windows_x86_64_msvc"
1554
+ version = "0.52.6"
1555
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1556
+ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
1557
+
1373
1558
  [[package]]
1374
1559
  name = "wit-bindgen"
1375
1560
  version = "0.51.0"
@@ -1472,18 +1657,18 @@ checksum = "fdd20c5420375476fbd4394763288da7eb0cc0b8c11deed431a91562af7335d3"
1472
1657
 
1473
1658
  [[package]]
1474
1659
  name = "zerocopy"
1475
- version = "0.8.48"
1660
+ version = "0.8.52"
1476
1661
  source = "registry+https://github.com/rust-lang/crates.io-index"
1477
- checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9"
1662
+ checksum = "ce1022995ff5ff5d841ad7d994facc23098cd40152f2c1d11cd607c6f530653f"
1478
1663
  dependencies = [
1479
1664
  "zerocopy-derive",
1480
1665
  ]
1481
1666
 
1482
1667
  [[package]]
1483
1668
  name = "zerocopy-derive"
1484
- version = "0.8.48"
1669
+ version = "0.8.52"
1485
1670
  source = "registry+https://github.com/rust-lang/crates.io-index"
1486
- checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4"
1671
+ checksum = "1ae7f38b72ec2a254e2b87ef277cf2cd4fb97cbebf944faa6f33354da0867930"
1487
1672
  dependencies = [
1488
1673
  "proc-macro2",
1489
1674
  "quote",
@@ -24,7 +24,7 @@ version = "0.20"
24
24
  features = ["abi3-py39"]
25
25
 
26
26
  [dev-dependencies]
27
- criterion = { version = "0.5", features = ["html_reports"] }
27
+ criterion = { version = "4.7.0", package = "codspeed-criterion-compat" }
28
28
  derive_builder = "0.13.1"
29
29
  proptest = "1.4"
30
30
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: seqpro
3
- Version: 0.15.2
3
+ Version: 0.16.0
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -1,5 +1,6 @@
1
1
  ![PyPI - Downloads](https://img.shields.io/pypi/dm/seqpro)
2
2
  ![GitHub stars](https://img.shields.io/github/stars/ML4GLand/SeqPro)
3
+ [![CodSpeed](https://img.shields.io/endpoint?url=https://codspeed.io/badge.json)](https://app.codspeed.io/ML4GLand/SeqPro?utm_source=badge)
3
4
 
4
5
  # SeqPro (Sequence processing toolkit)
5
6
  ```python
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "seqpro"
3
- version = "0.15.2"
3
+ version = "0.16.0"
4
4
  authors = [
5
5
  { name = "David Laub", email = "dlaub@ucsd.edu" },
6
6
  { name = "Adam Klie", email = "aklie@ucsd.edu" },
@@ -234,6 +234,8 @@ def tokenize(
234
234
  token_map: dict[str, int],
235
235
  unknown_token: int,
236
236
  out: NDArray[np.int32] | None = None,
237
+ *,
238
+ parallel: bool | None = None,
237
239
  ) -> NDArray[np.int32]: ...
238
240
  @overload
239
241
  def tokenize(
@@ -241,12 +243,16 @@ def tokenize(
241
243
  token_map: dict[str, int],
242
244
  unknown_token: int,
243
245
  out: None = None,
246
+ *,
247
+ parallel: bool | None = None,
244
248
  ) -> Ragged[np.int32]: ...
245
249
  def tokenize(
246
250
  seqs: StrSeqType | Ragged[np.bytes_],
247
251
  token_map: dict[str, int],
248
252
  unknown_token: int,
249
253
  out: NDArray[np.int32] | None = None,
254
+ *,
255
+ parallel: bool | None = None,
250
256
  ) -> NDArray[np.int32] | Ragged[np.int32]:
251
257
  """Tokenize sequences. Maps each character to its integer token.
252
258
  Characters absent from token_map are replaced with unknown_token.
@@ -262,6 +268,13 @@ def tokenize(
262
268
  out
263
269
  Output array to store the result in. Only valid for non-Ragged input.
264
270
  Must have dtype ``np.int32``; any other dtype raises ``TypeError``.
271
+ parallel
272
+ Escape hatch overriding the size-based heuristic for choosing between the
273
+ single-threaded ``np.take`` and the parallel Numba LUT gather. ``None``
274
+ (default) uses the heuristic (parallel past
275
+ ``_TOKENIZE_PARALLEL_THRESHOLD`` elements); ``True`` forces the parallel
276
+ kernel; ``False`` forces single-threaded. ``parallel=True`` is
277
+ incompatible with a non-C-contiguous ``out`` and raises ``ValueError``.
265
278
 
266
279
  Returns
267
280
  -------
@@ -283,20 +296,32 @@ def tokenize(
283
296
  n = len(seqs.lengths.ravel())
284
297
  trailing = seqs.data.shape[1:]
285
298
  u8 = seqs.data.view(np.uint8)
286
- if u8.size < _TOKENIZE_PARALLEL_THRESHOLD:
287
- flat = np.take(lut, u8)
288
- else:
299
+ use_parallel = (
300
+ u8.size >= _TOKENIZE_PARALLEL_THRESHOLD if parallel is None else parallel
301
+ )
302
+ if use_parallel:
289
303
  flat = np.empty(u8.shape, dtype=np.int32)
290
304
  lut_gather(np.ascontiguousarray(u8).reshape(-1), lut, flat.reshape(-1))
305
+ else:
306
+ flat = np.take(lut, u8)
291
307
  return Ragged.from_offsets(flat, (n, None, *trailing), seqs.offsets)
292
308
 
293
309
  _seqs = cast_seqs(seqs)
294
310
  u8 = _seqs.view(np.uint8)
295
- # A strided out= can't be flattened to a writable view, so it takes the
296
- # np.take path (which handles arbitrary strides) regardless of size.
297
- if u8.size < _TOKENIZE_PARALLEL_THRESHOLD or (
298
- out is not None and not out.flags.c_contiguous
299
- ):
311
+ # A strided out= can't be flattened to a writable view, so the parallel
312
+ # kernel can't write through it; such out= always takes the np.take path
313
+ # (which handles arbitrary strides). parallel=True can't honor it -> error.
314
+ out_blocks_parallel = out is not None and not out.flags.c_contiguous
315
+ if parallel is True and out_blocks_parallel:
316
+ raise ValueError(
317
+ "parallel=True requires a C-contiguous out array, got a "
318
+ "non-contiguous out. Use parallel=None/False or a contiguous out."
319
+ )
320
+ if parallel is None:
321
+ use_parallel = u8.size >= _TOKENIZE_PARALLEL_THRESHOLD
322
+ else:
323
+ use_parallel = parallel
324
+ if not use_parallel or out_blocks_parallel:
300
325
  return np.take(lut, u8, out=out)
301
326
  result = out if out is not None else np.empty(u8.shape, dtype=np.int32)
302
327
  lut_gather(np.ascontiguousarray(u8).reshape(-1), lut, result.reshape(-1))
@@ -33,7 +33,7 @@ Python/Rust package for fast biological-sequence processing. Python+NumPy+Numba
33
33
  | Normalize input | `sp.cast_seqs(x)` | → `|S1` bytes, or passthrough for OHE |
34
34
  | One-hot encode | `sp.ohe(x, alphabet, length_axis=-1)` | last axis added for OHE dim |
35
35
  | Decode OHE | `sp.decode_ohe(x, alphabet, ohe_axis=-1)` | |
36
- | Tokenize / detokenize | `sp.tokenize` / `sp.decode_tokens` | integer ids |
36
+ | Tokenize / detokenize | `sp.tokenize` / `sp.decode_tokens` | integer ids; `parallel=True/False` forces/disables the parallel kernel (default `None` = size heuristic) |
37
37
  | Pad | `sp.pad_seqs(x, pad_val, length=...)` | |
38
38
  | Reverse complement | `sp.reverse_complement(x, alphabet, length_axis=-1)` | works on str/bytes/OHE |
39
39
  | K-mer shuffle | `sp.k_shuffle(x, k, length_axis=-1, seed=...)` | calls Rust `_k_shuffle` |
@@ -260,3 +260,53 @@ def test_tokenize_parallel_branch_matches_reference():
260
260
  rag = Ragged.from_lengths(data, lengths)
261
261
  rag_got = sp.tokenize(rag, token_map, unknown_token=4)
262
262
  np.testing.assert_array_equal(rag_got.data, ref(data.view(np.uint8)))
263
+
264
+
265
+ def test_tokenize_parallel_override_forces_path(monkeypatch):
266
+ """parallel= overrides the size heuristic in both directions, while staying
267
+ correct. Spying on the parallel kernel reveals which branch ran."""
268
+ import seqpro._encoders as enc
269
+ from seqpro._encoders import _TOKENIZE_PARALLEL_THRESHOLD as THRESH
270
+
271
+ token_map = {"A": 0, "C": 1, "G": 2, "T": 3}
272
+ bases = np.frombuffer(b"ACGT", dtype="S1")
273
+
274
+ calls = {"n": 0}
275
+ real_lut = enc.lut_gather
276
+
277
+ def spy(*args, **kwargs):
278
+ calls["n"] += 1
279
+ return real_lut(*args, **kwargs)
280
+
281
+ monkeypatch.setattr(enc, "lut_gather", spy)
282
+
283
+ # small input, parallel=True -> parallel kernel used despite being below thresh
284
+ small = bases[np.zeros(8, dtype=int)]
285
+ assert small.size < THRESH
286
+ res = sp.tokenize(small, token_map, unknown_token=-1, parallel=True)
287
+ assert calls["n"] == 1
288
+ np.testing.assert_array_equal(res, np.zeros(8, dtype=np.int32))
289
+
290
+ # large input, parallel=False -> single-threaded np.take, kernel not used
291
+ calls["n"] = 0
292
+ large = bases[np.zeros(THRESH + 1000, dtype=int)]
293
+ res = sp.tokenize(large, token_map, unknown_token=-1, parallel=False)
294
+ assert calls["n"] == 0
295
+ np.testing.assert_array_equal(res, np.zeros(THRESH + 1000, dtype=np.int32))
296
+
297
+ # ragged honors the override too: small ragged forced parallel
298
+ calls["n"] = 0
299
+ data = bases[np.zeros(8, dtype=int)]
300
+ rag = Ragged.from_lengths(data, np.array([4, 4]))
301
+ sp.tokenize(rag, token_map, unknown_token=-1, parallel=True)
302
+ assert calls["n"] == 1
303
+
304
+
305
+ def test_tokenize_parallel_true_rejects_noncontiguous_out():
306
+ """parallel=True cannot honor a non-C-contiguous out= buffer, so it raises."""
307
+ token_map = {"A": 0, "C": 1, "G": 2, "T": 3}
308
+ flat = np.frombuffer(b"ACGT" * 4, dtype="S1")
309
+ strided = np.empty((flat.size, 2), dtype=np.int32)[:, 0]
310
+ assert not strided.flags.c_contiguous
311
+ with pytest.raises(ValueError):
312
+ sp.tokenize(flat, token_map, unknown_token=-1, out=strided, parallel=True)
@@ -1,31 +0,0 @@
1
- name: Benchmarks
2
-
3
- on:
4
- pull_request:
5
- branches:
6
- - main
7
- workflow_dispatch:
8
-
9
- jobs:
10
- benchmarks:
11
- runs-on: ubuntu-latest
12
- name: "Run CodSpeed microbenchmarks"
13
- steps:
14
- - name: Check out
15
- uses: actions/checkout@v4
16
- with:
17
- fetch-depth: 0
18
- - name: Setup pixi
19
- uses: prefix-dev/setup-pixi@v0.9.5
20
- with:
21
- pixi-version: v0.67.2
22
- cache: true
23
- environments: bench
24
- locked: false
25
- - name: Build extension
26
- run: pixi run -e bench maturin develop
27
- - name: Run benchmarks
28
- uses: CodSpeedHQ/action@v3
29
- with:
30
- token: ${{ secrets.CODSPEED_TOKEN }}
31
- run: pixi run -e bench bench
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes