pymetadata-core 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.
Files changed (67) hide show
  1. pymetadata_core-0.1.0/Cargo.lock +345 -0
  2. pymetadata_core-0.1.0/Cargo.toml +41 -0
  3. pymetadata_core-0.1.0/LICENSE +7 -0
  4. pymetadata_core-0.1.0/PKG-INFO +49 -0
  5. pymetadata_core-0.1.0/crates/core/Cargo.toml +26 -0
  6. pymetadata_core-0.1.0/crates/core/README.md +68 -0
  7. pymetadata_core-0.1.0/crates/core/examples/omex_timing.rs +320 -0
  8. pymetadata_core-0.1.0/crates/core/src/archive.rs +481 -0
  9. pymetadata_core-0.1.0/crates/core/src/error.rs +21 -0
  10. pymetadata_core-0.1.0/crates/core/src/formats.rs +38 -0
  11. pymetadata_core-0.1.0/crates/core/src/formats_table.rs +638 -0
  12. pymetadata_core-0.1.0/crates/core/src/lib.rs +16 -0
  13. pymetadata_core-0.1.0/crates/core/src/location.rs +148 -0
  14. pymetadata_core-0.1.0/crates/core/src/manifest.rs +518 -0
  15. pymetadata_core-0.1.0/crates/core/src/wire.rs +163 -0
  16. pymetadata_core-0.1.0/crates/core/src/zip/central.rs +247 -0
  17. pymetadata_core-0.1.0/crates/core/src/zip/crypto.rs +140 -0
  18. pymetadata_core-0.1.0/crates/core/src/zip/eocd.rs +182 -0
  19. pymetadata_core-0.1.0/crates/core/src/zip/local.rs +29 -0
  20. pymetadata_core-0.1.0/crates/core/src/zip/mod.rs +117 -0
  21. pymetadata_core-0.1.0/crates/core/src/zip/reader.rs +424 -0
  22. pymetadata_core-0.1.0/crates/core/src/zip/spec.rs +76 -0
  23. pymetadata_core-0.1.0/crates/core/src/zip/writer.rs +759 -0
  24. pymetadata_core-0.1.0/crates/core/tests/archive.rs +358 -0
  25. pymetadata_core-0.1.0/crates/core/tests/data/formats.json +240 -0
  26. pymetadata_core-0.1.0/crates/core/tests/data/manifests/BIOMD0000000001.xml +16 -0
  27. pymetadata_core-0.1.0/crates/core/tests/data/manifests/CombineArchiveShowCase.xml +25 -0
  28. pymetadata_core-0.1.0/crates/core/tests/data/manifests/CompModels.xml +9 -0
  29. pymetadata_core-0.1.0/crates/core/tests/data/manifests/iCGB21FR.xml +11 -0
  30. pymetadata_core-0.1.0/crates/core/tests/data/manifests.json +255 -0
  31. pymetadata_core-0.1.0/crates/core/tests/data/members.json +514 -0
  32. pymetadata_core-0.1.0/crates/core/tests/data/omex/BIOMD0000000001.omex +0 -0
  33. pymetadata_core-0.1.0/crates/core/tests/data/omex/CombineArchiveShowCase.omex +0 -0
  34. pymetadata_core-0.1.0/crates/core/tests/data/omex/CompModels.omex +0 -0
  35. pymetadata_core-0.1.0/crates/core/tests/data/omex/iCGB21FR.omex +0 -0
  36. pymetadata_core-0.1.0/crates/core/tests/data/zip/aes.zip +0 -0
  37. pymetadata_core-0.1.0/crates/core/tests/data/zip/bad_crc.zip +0 -0
  38. pymetadata_core-0.1.0/crates/core/tests/data/zip/bad_offset.zip +0 -0
  39. pymetadata_core-0.1.0/crates/core/tests/data/zip/bzip2.zip +0 -0
  40. pymetadata_core-0.1.0/crates/core/tests/data/zip/descriptors.zip +0 -0
  41. pymetadata_core-0.1.0/crates/core/tests/data/zip/empty_deflate.zip +0 -0
  42. pymetadata_core-0.1.0/crates/core/tests/data/zip/encrypted.zip +0 -0
  43. pymetadata_core-0.1.0/crates/core/tests/data/zip/encrypted_descriptor.zip +0 -0
  44. pymetadata_core-0.1.0/crates/core/tests/data/zip/encrypted_omex.zip +0 -0
  45. pymetadata_core-0.1.0/crates/core/tests/data/zip/encrypted_stored.zip +0 -0
  46. pymetadata_core-0.1.0/crates/core/tests/data/zip/oversized.zip +0 -0
  47. pymetadata_core-0.1.0/crates/core/tests/data/zip/prepended.zip +0 -0
  48. pymetadata_core-0.1.0/crates/core/tests/data/zip/prepended_zip64.zip +0 -0
  49. pymetadata_core-0.1.0/crates/core/tests/data/zip/stored.zip +0 -0
  50. pymetadata_core-0.1.0/crates/core/tests/data/zip/truncated.zip +0 -0
  51. pymetadata_core-0.1.0/crates/core/tests/data/zip/understated.zip +0 -0
  52. pymetadata_core-0.1.0/crates/core/tests/data/zip/zip64.zip +0 -0
  53. pymetadata_core-0.1.0/crates/core/tests/formats_parity.rs +97 -0
  54. pymetadata_core-0.1.0/crates/core/tests/manifest_parity.rs +44 -0
  55. pymetadata_core-0.1.0/crates/core/tests/write.rs +860 -0
  56. pymetadata_core-0.1.0/crates/core/tests/zip_crypto.rs +171 -0
  57. pymetadata_core-0.1.0/crates/core/tests/zip_reader.rs +417 -0
  58. pymetadata_core-0.1.0/crates/python/Cargo.toml +31 -0
  59. pymetadata_core-0.1.0/crates/python/README.md +22 -0
  60. pymetadata_core-0.1.0/crates/python/src/archive.rs +192 -0
  61. pymetadata_core-0.1.0/crates/python/src/errors.rs +28 -0
  62. pymetadata_core-0.1.0/crates/python/src/lib.rs +22 -0
  63. pymetadata_core-0.1.0/pyproject.toml +60 -0
  64. pymetadata_core-0.1.0/python/README.md +22 -0
  65. pymetadata_core-0.1.0/python/pymetadata_core/__init__.py +21 -0
  66. pymetadata_core-0.1.0/python/pymetadata_core/_core.pyi +176 -0
  67. pymetadata_core-0.1.0/python/pymetadata_core/py.typed +0 -0
@@ -0,0 +1,345 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "block-buffer"
7
+ version = "0.10.4"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
10
+ dependencies = [
11
+ "generic-array",
12
+ ]
13
+
14
+ [[package]]
15
+ name = "cfg-if"
16
+ version = "1.0.5"
17
+ source = "registry+https://github.com/rust-lang/crates.io-index"
18
+ checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
19
+
20
+ [[package]]
21
+ name = "cpufeatures"
22
+ version = "0.2.17"
23
+ source = "registry+https://github.com/rust-lang/crates.io-index"
24
+ checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"
25
+ dependencies = [
26
+ "libc",
27
+ ]
28
+
29
+ [[package]]
30
+ name = "crc32fast"
31
+ version = "1.5.5"
32
+ source = "registry+https://github.com/rust-lang/crates.io-index"
33
+ checksum = "2b929dd2a135771f40afabd1073f85eed59c800b7c61901e5c254270497dad64"
34
+ dependencies = [
35
+ "cfg-if",
36
+ ]
37
+
38
+ [[package]]
39
+ name = "crypto-common"
40
+ version = "0.1.7"
41
+ source = "registry+https://github.com/rust-lang/crates.io-index"
42
+ checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"
43
+ dependencies = [
44
+ "generic-array",
45
+ "typenum",
46
+ ]
47
+
48
+ [[package]]
49
+ name = "digest"
50
+ version = "0.10.7"
51
+ source = "registry+https://github.com/rust-lang/crates.io-index"
52
+ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
53
+ dependencies = [
54
+ "block-buffer",
55
+ "crypto-common",
56
+ ]
57
+
58
+ [[package]]
59
+ name = "flate2"
60
+ version = "1.1.11"
61
+ source = "registry+https://github.com/rust-lang/crates.io-index"
62
+ checksum = "626d4928326b646e70f65ed36fc7cf9f206bdb68a0019ee7c6b4709da4e084c4"
63
+ dependencies = [
64
+ "zlib-rs",
65
+ ]
66
+
67
+ [[package]]
68
+ name = "generic-array"
69
+ version = "0.14.7"
70
+ source = "registry+https://github.com/rust-lang/crates.io-index"
71
+ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
72
+ dependencies = [
73
+ "typenum",
74
+ "version_check",
75
+ ]
76
+
77
+ [[package]]
78
+ name = "heck"
79
+ version = "0.5.0"
80
+ source = "registry+https://github.com/rust-lang/crates.io-index"
81
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
82
+
83
+ [[package]]
84
+ name = "itoa"
85
+ version = "1.0.19"
86
+ source = "registry+https://github.com/rust-lang/crates.io-index"
87
+ checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4"
88
+
89
+ [[package]]
90
+ name = "libc"
91
+ version = "0.2.191"
92
+ source = "registry+https://github.com/rust-lang/crates.io-index"
93
+ checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
94
+
95
+ [[package]]
96
+ name = "memchr"
97
+ version = "2.8.3"
98
+ source = "registry+https://github.com/rust-lang/crates.io-index"
99
+ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
100
+
101
+ [[package]]
102
+ name = "once_cell"
103
+ version = "1.21.4"
104
+ source = "registry+https://github.com/rust-lang/crates.io-index"
105
+ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
106
+
107
+ [[package]]
108
+ name = "portable-atomic"
109
+ version = "1.15.0"
110
+ source = "registry+https://github.com/rust-lang/crates.io-index"
111
+ checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
112
+
113
+ [[package]]
114
+ name = "proc-macro2"
115
+ version = "1.0.107"
116
+ source = "registry+https://github.com/rust-lang/crates.io-index"
117
+ checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
118
+ dependencies = [
119
+ "unicode-ident",
120
+ ]
121
+
122
+ [[package]]
123
+ name = "pymetadata-core"
124
+ version = "0.1.0"
125
+ dependencies = [
126
+ "crc32fast",
127
+ "flate2",
128
+ "roxmltree",
129
+ "serde",
130
+ "serde_json",
131
+ "sha2",
132
+ "thiserror",
133
+ ]
134
+
135
+ [[package]]
136
+ name = "pymetadata-python"
137
+ version = "0.1.0"
138
+ dependencies = [
139
+ "pymetadata-core",
140
+ "pyo3",
141
+ ]
142
+
143
+ [[package]]
144
+ name = "pymetadata-wasm"
145
+ version = "0.1.0"
146
+ dependencies = [
147
+ "pymetadata-core",
148
+ "serde_json",
149
+ ]
150
+
151
+ [[package]]
152
+ name = "pyo3"
153
+ version = "0.30.1"
154
+ source = "registry+https://github.com/rust-lang/crates.io-index"
155
+ checksum = "229ca13b8a15bb0d1487b81ab975bfcd97513416499a8312011b6036e42e0de4"
156
+ dependencies = [
157
+ "libc",
158
+ "once_cell",
159
+ "portable-atomic",
160
+ "pyo3-build-config",
161
+ "pyo3-ffi",
162
+ "pyo3-macros",
163
+ ]
164
+
165
+ [[package]]
166
+ name = "pyo3-build-config"
167
+ version = "0.30.1"
168
+ source = "registry+https://github.com/rust-lang/crates.io-index"
169
+ checksum = "70130e2b6dd1ee589a8788026a429561ca5c40fa7a2fa7914c2282eddae24700"
170
+ dependencies = [
171
+ "target-lexicon",
172
+ ]
173
+
174
+ [[package]]
175
+ name = "pyo3-ffi"
176
+ version = "0.30.1"
177
+ source = "registry+https://github.com/rust-lang/crates.io-index"
178
+ checksum = "5e7ff73c555c286d212d4ce7e5fbda845a973c4f61bd5f160f5f2c3c2a04d1c4"
179
+ dependencies = [
180
+ "libc",
181
+ "pyo3-build-config",
182
+ ]
183
+
184
+ [[package]]
185
+ name = "pyo3-macros"
186
+ version = "0.30.1"
187
+ source = "registry+https://github.com/rust-lang/crates.io-index"
188
+ checksum = "c46d2e5862c7bb8207e3b639f713dda3c499933444784154c11d013c5a691b60"
189
+ dependencies = [
190
+ "proc-macro2",
191
+ "pyo3-macros-backend",
192
+ "quote",
193
+ "syn",
194
+ ]
195
+
196
+ [[package]]
197
+ name = "pyo3-macros-backend"
198
+ version = "0.30.1"
199
+ source = "registry+https://github.com/rust-lang/crates.io-index"
200
+ checksum = "38b89f066f2ae72a2aef52d1537ca2fcd104440ebfadee06e97aa90738a25b9b"
201
+ dependencies = [
202
+ "heck",
203
+ "proc-macro2",
204
+ "quote",
205
+ "syn",
206
+ ]
207
+
208
+ [[package]]
209
+ name = "quote"
210
+ version = "1.0.47"
211
+ source = "registry+https://github.com/rust-lang/crates.io-index"
212
+ checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
213
+ dependencies = [
214
+ "proc-macro2",
215
+ ]
216
+
217
+ [[package]]
218
+ name = "roxmltree"
219
+ version = "0.21.2"
220
+ source = "registry+https://github.com/rust-lang/crates.io-index"
221
+ checksum = "9da7f59328b09405b181fee1018925fad50f157afb43c0c0f5c522c256dd5907"
222
+ dependencies = [
223
+ "memchr",
224
+ ]
225
+
226
+ [[package]]
227
+ name = "serde"
228
+ version = "1.0.229"
229
+ source = "registry+https://github.com/rust-lang/crates.io-index"
230
+ checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
231
+ dependencies = [
232
+ "serde_core",
233
+ "serde_derive",
234
+ ]
235
+
236
+ [[package]]
237
+ name = "serde_core"
238
+ version = "1.0.229"
239
+ source = "registry+https://github.com/rust-lang/crates.io-index"
240
+ checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
241
+ dependencies = [
242
+ "serde_derive",
243
+ ]
244
+
245
+ [[package]]
246
+ name = "serde_derive"
247
+ version = "1.0.229"
248
+ source = "registry+https://github.com/rust-lang/crates.io-index"
249
+ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
250
+ dependencies = [
251
+ "proc-macro2",
252
+ "quote",
253
+ "syn",
254
+ ]
255
+
256
+ [[package]]
257
+ name = "serde_json"
258
+ version = "1.0.154"
259
+ source = "registry+https://github.com/rust-lang/crates.io-index"
260
+ checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6"
261
+ dependencies = [
262
+ "itoa",
263
+ "memchr",
264
+ "serde",
265
+ "serde_core",
266
+ "zmij",
267
+ ]
268
+
269
+ [[package]]
270
+ name = "sha2"
271
+ version = "0.10.9"
272
+ source = "registry+https://github.com/rust-lang/crates.io-index"
273
+ checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
274
+ dependencies = [
275
+ "cfg-if",
276
+ "cpufeatures",
277
+ "digest",
278
+ ]
279
+
280
+ [[package]]
281
+ name = "syn"
282
+ version = "3.0.10"
283
+ source = "registry+https://github.com/rust-lang/crates.io-index"
284
+ checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79"
285
+ dependencies = [
286
+ "proc-macro2",
287
+ "quote",
288
+ "unicode-ident",
289
+ ]
290
+
291
+ [[package]]
292
+ name = "target-lexicon"
293
+ version = "0.13.6"
294
+ source = "registry+https://github.com/rust-lang/crates.io-index"
295
+ checksum = "8c447be3a2abfa84b2d91680c56600bd6b2873866de27b36ec911be705e291da"
296
+
297
+ [[package]]
298
+ name = "thiserror"
299
+ version = "2.0.21"
300
+ source = "registry+https://github.com/rust-lang/crates.io-index"
301
+ checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e"
302
+ dependencies = [
303
+ "thiserror-impl",
304
+ ]
305
+
306
+ [[package]]
307
+ name = "thiserror-impl"
308
+ version = "2.0.21"
309
+ source = "registry+https://github.com/rust-lang/crates.io-index"
310
+ checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524"
311
+ dependencies = [
312
+ "proc-macro2",
313
+ "quote",
314
+ "syn",
315
+ ]
316
+
317
+ [[package]]
318
+ name = "typenum"
319
+ version = "1.20.1"
320
+ source = "registry+https://github.com/rust-lang/crates.io-index"
321
+ checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"
322
+
323
+ [[package]]
324
+ name = "unicode-ident"
325
+ version = "1.0.27"
326
+ source = "registry+https://github.com/rust-lang/crates.io-index"
327
+ checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
328
+
329
+ [[package]]
330
+ name = "version_check"
331
+ version = "0.9.5"
332
+ source = "registry+https://github.com/rust-lang/crates.io-index"
333
+ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
334
+
335
+ [[package]]
336
+ name = "zlib-rs"
337
+ version = "0.6.8"
338
+ source = "registry+https://github.com/rust-lang/crates.io-index"
339
+ checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112"
340
+
341
+ [[package]]
342
+ name = "zmij"
343
+ version = "1.0.23"
344
+ source = "registry+https://github.com/rust-lang/crates.io-index"
345
+ checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
@@ -0,0 +1,41 @@
1
+ [workspace]
2
+ resolver = "2"
3
+ members = ["crates/core", "crates/python"]
4
+ # the throwaway package of the spike sits at the repository root and is not a member
5
+ exclude = ["spike"]
6
+
7
+ [workspace.package]
8
+ version = "0.1.0"
9
+ edition = "2024"
10
+ rust-version = "1.100"
11
+ license = "MIT"
12
+ authors = ["Matthias König"]
13
+ repository = "https://github.com/matthiaskoenig/pymetadata-core"
14
+ readme = "README.md"
15
+ keywords = ["combine", "omex", "sbml", "sedml", "wasm"]
16
+ categories = ["science", "wasm"]
17
+
18
+ # every public item carries a doc comment, as a gate rather than a convention
19
+ [workspace.lints.rust]
20
+ missing_docs = "warn"
21
+
22
+ # Size of the wasm module, which a browser downloads: link time optimization across the crates
23
+ # and no symbols. `panic = "abort"` is deliberately not set: pyo3 turns a Rust panic into a
24
+ # python exception, and aborting would kill the interpreter instead.
25
+ [profile.release]
26
+ lto = true
27
+ codegen-units = 1
28
+ strip = true
29
+
30
+ [workspace.dependencies]
31
+ thiserror = "2"
32
+ serde_json = "1"
33
+ roxmltree = { version = "0.21", default-features = false, features = ["std"] }
34
+ serde = { version = "1", features = ["derive"] }
35
+ flate2 = { version = "1", default-features = false, features = ["zlib-rs"] }
36
+ crc32fast = { version = "1", default-features = false }
37
+ # the python binding, abi3 with the floor of `pymetadata` (python 3.11)
38
+ pyo3 = { version = "0.30", features = ["abi3-py311"] }
39
+ # a development dependency only: the tests compare the inflated bytes against the digests which
40
+ # `scripts/members_oracle.py` takes with python's `zipfile`
41
+ sha2 = { version = "0.10", default-features = false }
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2026 Matthias König
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,49 @@
1
+ Metadata-Version: 2.4
2
+ Name: pymetadata-core
3
+ Version: 0.1.0
4
+ Classifier: Development Status :: 4 - Beta
5
+ Classifier: Intended Audience :: Science/Research
6
+ Classifier: Operating System :: MacOS
7
+ Classifier: Operating System :: Microsoft :: Windows
8
+ Classifier: Operating System :: POSIX :: Linux
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3 :: Only
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Programming Language :: Python :: 3.14
15
+ Classifier: Programming Language :: Rust
16
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
17
+ Classifier: Typing :: Typed
18
+ License-File: LICENSE
19
+ Summary: Lazy reading and writing of COMBINE archives (OMEX), a Rust core for pymetadata
20
+ Keywords: COMBINE,OMEX,SBML,SED-ML,systems biology
21
+ Author: Matthias König
22
+ License-Expression: MIT
23
+ Requires-Python: >=3.11
24
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
25
+ Project-URL: Repository, https://github.com/matthiaskoenig/pymetadata-core
26
+
27
+ # pymetadata-core
28
+
29
+ Lazy reading and writing of COMBINE archives (OMEX, a zip with a `manifest.xml`), as a Rust core with a python binding. Opening an archive reads the manifest and nothing else, an entry is inflated when it is asked for, and writing copies every untouched entry as the compressed blob it already is.
30
+
31
+ ```python
32
+ from pymetadata_core import Archive, lookup_format
33
+
34
+ with open("model.omex", "rb") as f:
35
+ archive = Archive.from_bytes(f.read())
36
+
37
+ print(archive.entries) # [(location, format, master), ...]
38
+ sbml = archive.entry_bytes("./model.xml")
39
+
40
+ archive.set_entry("data/notes.txt", lookup_format("txt"), False, b"hello")
41
+ data = archive.to_bytes() # only the new entry is deflated
42
+ ```
43
+
44
+ Errors are raised as `pymetadata_core.OmexError`, a subclass of `ValueError`.
45
+
46
+ Inflating an entry, `set_entry` and writing the archive run without the GIL, so another thread can work meanwhile. An `Archive` is in use by one call at a time: a second thread which uses it meanwhile gets `pymetadata_core.ArchiveBusyError`, a `RuntimeError`. Use one `Archive` per thread.
47
+
48
+ The design is in [`docs/design/omex-core.md`](https://github.com/matthiaskoenig/pymetadata-core/blob/develop/docs/design/omex-core.md).
49
+
@@ -0,0 +1,26 @@
1
+ [package]
2
+ name = "pymetadata-core"
3
+ version.workspace = true
4
+ edition.workspace = true
5
+ rust-version.workspace = true
6
+ license.workspace = true
7
+ authors.workspace = true
8
+ description = "Lazy reading and writing of COMBINE archives (OMEX)"
9
+ repository.workspace = true
10
+ readme = "README.md"
11
+ keywords.workspace = true
12
+ categories.workspace = true
13
+
14
+ [dependencies]
15
+ crc32fast.workspace = true
16
+ flate2.workspace = true
17
+ roxmltree.workspace = true
18
+ serde.workspace = true
19
+ thiserror.workspace = true
20
+
21
+ [dev-dependencies]
22
+ serde_json.workspace = true
23
+ sha2.workspace = true
24
+
25
+ [lints]
26
+ workspace = true
@@ -0,0 +1,68 @@
1
+ # pymetadata-core
2
+
3
+ A Rust core which reads and writes COMBINE archives (OMEX, a zip with a `manifest.xml`) lazily. It replaces the hot paths of the python library [pymetadata](https://github.com/matthiaskoenig/pymetadata) and ships as a python wheel and as a wasm module without imports. The design is in `docs/design/omex-core.md`.
4
+
5
+ ## Crates
6
+
7
+ | crate | package | what it is |
8
+ | --- | --- | --- |
9
+ | `crates/core` | `pymetadata-core` | the archive, the manifest, the formats, the zip container |
10
+ | `crates/python` | `pymetadata-python` | the pyo3 binding, built into the python wheel `pymetadata-core` (module `pymetadata_core`), see `python/README.md` |
11
+ | `crates/wasm` | `pymetadata-wasm` | the raw C ABI host of the wasm module, which imports nothing |
12
+
13
+ ## Checks
14
+
15
+ What continuous integration runs, so `--locked` here as well: the committed `Cargo.lock` is what is checked. `missing_docs` is a workspace lint, so every public item carries a doc comment and `clippy -D warnings` fails on an undocumented one.
16
+
17
+ The release build of the wasm module comes first, and not because `cargo test` needs it to compile: `crates/wasm/tests/imports.rs` reads the built module and asserts that it imports nothing, which is the property the hand-rolled zip container of this workspace exists for. The test fails when the module is missing, or older than a source, a manifest or the lock it was built from, rather than skipping, so a checkout which never built it has no passing `cargo test` to read as an answer. `cargo test` does not build another target by itself, which is why the line is here. The `cargo doc` line is a gate as well: a broken intra-doc link passes every other command of this list and fails there.
18
+
19
+ ```bash
20
+ cargo fmt --check
21
+ cargo clippy --locked --all-targets -- -D warnings
22
+ cargo build -p pymetadata-wasm --release --locked --target wasm32-unknown-unknown
23
+ cargo test --locked
24
+ RUSTDOCFLAGS="-D warnings" cargo doc --locked --no-deps
25
+ cargo check --locked --workspace --exclude pymetadata-python --target wasm32-unknown-unknown
26
+ cargo check --locked --workspace --exclude pymetadata-python --target wasm32-wasip1
27
+ ```
28
+
29
+ The JavaScript package under `js/` has its own gates. `node js/build.mjs` comes before the tests, because the module and the fixture archive are built, not committed, and a fresh checkout fails the tests without them. One test builds a second module with the `panic-probe` feature, so it needs `cargo` and the `wasm32-unknown-unknown` target:
30
+
31
+ ```bash
32
+ cargo build -p pymetadata-wasm --release --locked --target wasm32-unknown-unknown
33
+ cargo test -p pymetadata-wasm --locked
34
+ cargo clippy -p pymetadata-wasm --all-targets --locked -- -D warnings
35
+ node js/build.mjs
36
+ (cd js && npm test && node prepack.mjs && npm pack --dry-run)
37
+ ```
38
+
39
+ The python binding is not a default member of the workspace, so it has gates of its own. `uv.lock` pins the development environment, as it does in `pymetadata`: `uv sync --locked` creates it from the lock (and fails instead of re-resolving when the lock no longer matches `pyproject.toml`), builds the extension into it and installs `pytest`, `pymetadata` (the tests cross-check against it) and `ruff`. `uv lock --check` verifies the lock alone. The compiled extension lands in `python/pymetadata_core/` and is gitignored.
40
+
41
+ ```bash
42
+ cargo clippy -p pymetadata-python --locked --all-targets -- -D warnings
43
+ cargo test -p pymetadata-python --locked
44
+ uv sync --locked
45
+ uv run --no-sync ruff check
46
+ uv run --no-sync ruff format --check
47
+ uvx ty@0.0.108 check
48
+ uv run --no-sync pytest python/tests -q
49
+ ```
50
+
51
+ The wheel which ships is a different job: it is built with maturin from the locked sources, installed over the development build and tested as installed; `--no-sync` keeps `uv run` from rebuilding the package into the environment:
52
+
53
+ ```bash
54
+ uv run --with 'maturin>=1.16,<2' maturin build --release --locked -o dist
55
+ uv pip install --force-reinstall dist/*.whl
56
+ uv run --no-sync pytest python/tests -q
57
+ uv run --no-sync --with 'maturin>=1.16,<2' maturin build --release --sdist -o target/sdist
58
+ ```
59
+
60
+ The last line builds the source distribution of the release; it takes no `--locked`, since the workspace of an sdist is not the one `Cargo.lock` was resolved for.
61
+
62
+ Continuous integration (`.github/workflows/ci.yml`) runs exactly these lists as the jobs `checks`, `wasm`, `js`, `python`, `ruff` and `ty`, which are the required checks of `.github/rulesets/develop.json`. How a release is made is in `docs/release.md`.
63
+
64
+ `crates/core/src/formats_table.rs` and `crates/core/tests/data/formats.json` are generated from `pymetadata.omex` by `scripts/formats_table.py`; run it from a pymetadata checkout with `uv run python`. `crates/core/src/formats.rs` is the hand-written logic over that table.
65
+
66
+ ## License
67
+
68
+ MIT