grimp 3.5__tar.gz → 3.6__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 (57) hide show
  1. {grimp-3.5 → grimp-3.6}/PKG-INFO +3 -3
  2. {grimp-3.5 → grimp-3.6}/pyproject.toml +1 -1
  3. grimp-3.6/rust/Cargo.lock +439 -0
  4. grimp-3.6/rust/Cargo.toml +32 -0
  5. grimp-3.6/rust/src/errors.rs +29 -0
  6. grimp-3.6/rust/src/exceptions.rs +4 -0
  7. grimp-3.6/rust/src/graph/direct_import_queries.rs +57 -0
  8. grimp-3.6/rust/src/graph/graph_manipulation.rs +195 -0
  9. grimp-3.6/rust/src/graph/hierarchy_queries.rs +50 -0
  10. grimp-3.6/rust/src/graph/higher_order_queries.rs +210 -0
  11. grimp-3.6/rust/src/graph/import_chain_queries.rs +123 -0
  12. grimp-3.6/rust/src/graph/mod.rs +137 -0
  13. grimp-3.6/rust/src/graph/pathfinding.rs +125 -0
  14. grimp-3.6/rust/src/lib.rs +572 -0
  15. grimp-3.6/rust/tests/large.rs +52 -0
  16. {grimp-3.5 → grimp-3.6}/src/grimp/__init__.py +1 -1
  17. grimp-3.6/src/grimp/adaptors/graph.py +201 -0
  18. grimp-3.5/rust/Cargo.lock +0 -292
  19. grimp-3.5/rust/Cargo.toml +0 -21
  20. grimp-3.5/rust/src/containers.rs +0 -14
  21. grimp-3.5/rust/src/dependencies.rs +0 -13
  22. grimp-3.5/rust/src/importgraph.rs +0 -435
  23. grimp-3.5/rust/src/layers.rs +0 -699
  24. grimp-3.5/rust/src/lib.rs +0 -261
  25. grimp-3.5/rust/tests/large.rs +0 -47
  26. grimp-3.5/src/grimp/adaptors/_layers.py +0 -172
  27. grimp-3.5/src/grimp/adaptors/graph.py +0 -472
  28. {grimp-3.5 → grimp-3.6}/README.rst +0 -0
  29. /grimp-3.5/rust/.cargo/config → /grimp-3.6/rust/.cargo/config.toml +0 -0
  30. {grimp-3.5 → grimp-3.6}/rust/tests/large_graph.json +0 -0
  31. {grimp-3.5 → grimp-3.6}/src/grimp/adaptors/__init__.py +0 -0
  32. {grimp-3.5 → grimp-3.6}/src/grimp/adaptors/caching.py +0 -0
  33. {grimp-3.5 → grimp-3.6}/src/grimp/adaptors/filesystem.py +0 -0
  34. {grimp-3.5 → grimp-3.6}/src/grimp/adaptors/importscanner.py +0 -0
  35. {grimp-3.5 → grimp-3.6}/src/grimp/adaptors/modulefinder.py +0 -0
  36. {grimp-3.5 → grimp-3.6}/src/grimp/adaptors/packagefinder.py +0 -0
  37. {grimp-3.5 → grimp-3.6}/src/grimp/adaptors/timing.py +0 -0
  38. {grimp-3.5 → grimp-3.6}/src/grimp/algorithms/__init__.py +0 -0
  39. {grimp-3.5 → grimp-3.6}/src/grimp/algorithms/shortest_path.py +0 -0
  40. {grimp-3.5 → grimp-3.6}/src/grimp/application/__init__.py +0 -0
  41. {grimp-3.5 → grimp-3.6}/src/grimp/application/config.py +0 -0
  42. {grimp-3.5 → grimp-3.6}/src/grimp/application/ports/__init__.py +0 -0
  43. {grimp-3.5 → grimp-3.6}/src/grimp/application/ports/caching.py +0 -0
  44. {grimp-3.5 → grimp-3.6}/src/grimp/application/ports/filesystem.py +0 -0
  45. {grimp-3.5 → grimp-3.6}/src/grimp/application/ports/graph.py +0 -0
  46. {grimp-3.5 → grimp-3.6}/src/grimp/application/ports/importscanner.py +0 -0
  47. {grimp-3.5 → grimp-3.6}/src/grimp/application/ports/modulefinder.py +0 -0
  48. {grimp-3.5 → grimp-3.6}/src/grimp/application/ports/packagefinder.py +0 -0
  49. {grimp-3.5 → grimp-3.6}/src/grimp/application/ports/timing.py +0 -0
  50. {grimp-3.5 → grimp-3.6}/src/grimp/application/usecases.py +0 -0
  51. {grimp-3.5 → grimp-3.6}/src/grimp/domain/__init__.py +0 -0
  52. {grimp-3.5 → grimp-3.6}/src/grimp/domain/analysis.py +0 -0
  53. {grimp-3.5 → grimp-3.6}/src/grimp/domain/valueobjects.py +0 -0
  54. {grimp-3.5 → grimp-3.6}/src/grimp/exceptions.py +0 -0
  55. {grimp-3.5 → grimp-3.6}/src/grimp/helpers.py +0 -0
  56. {grimp-3.5 → grimp-3.6}/src/grimp/main.py +0 -0
  57. {grimp-3.5 → grimp-3.6}/src/grimp/py.typed +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: grimp
3
- Version: 3.5
3
+ Version: 3.6
4
4
  Classifier: Development Status :: 5 - Production/Stable
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: License :: OSI Approved :: BSD License
@@ -16,7 +16,7 @@ Classifier: Programming Language :: Python :: 3.13
16
16
  Classifier: Programming Language :: Python :: Implementation :: CPython
17
17
  Classifier: Programming Language :: Rust
18
18
  Classifier: Topic :: Utilities
19
- Requires-Dist: typing-extensions >=3.10.0.0
19
+ Requires-Dist: typing-extensions>=3.10.0.0
20
20
  License-File: LICENSE
21
21
  License-File: AUTHORS.rst
22
22
  Summary: Builds a queryable graph of the imports within one or more Python packages.
@@ -8,7 +8,7 @@ module-name = "grimp._rustgrimp"
8
8
 
9
9
  [project]
10
10
  name = "grimp"
11
- version = "3.5"
11
+ version = "3.6"
12
12
  license = {text = "BSD 2-Clause License"}
13
13
  description = "Builds a queryable graph of the imports within one or more Python packages."
14
14
  authors = [
@@ -0,0 +1,439 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "_rustgrimp"
7
+ version = "0.1.0"
8
+ dependencies = [
9
+ "bimap",
10
+ "derive-new",
11
+ "getset",
12
+ "indexmap",
13
+ "itertools",
14
+ "lazy_static",
15
+ "pyo3",
16
+ "rayon",
17
+ "rustc-hash",
18
+ "serde_json",
19
+ "slotmap",
20
+ "string-interner",
21
+ "tap",
22
+ "thiserror",
23
+ ]
24
+
25
+ [[package]]
26
+ name = "autocfg"
27
+ version = "1.4.0"
28
+ source = "registry+https://github.com/rust-lang/crates.io-index"
29
+ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
30
+
31
+ [[package]]
32
+ name = "bimap"
33
+ version = "0.6.3"
34
+ source = "registry+https://github.com/rust-lang/crates.io-index"
35
+ checksum = "230c5f1ca6a325a32553f8640d31ac9b49f2411e901e427570154868b46da4f7"
36
+
37
+ [[package]]
38
+ name = "cfg-if"
39
+ version = "1.0.0"
40
+ source = "registry+https://github.com/rust-lang/crates.io-index"
41
+ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
42
+
43
+ [[package]]
44
+ name = "crossbeam-deque"
45
+ version = "0.8.6"
46
+ source = "registry+https://github.com/rust-lang/crates.io-index"
47
+ checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51"
48
+ dependencies = [
49
+ "crossbeam-epoch",
50
+ "crossbeam-utils",
51
+ ]
52
+
53
+ [[package]]
54
+ name = "crossbeam-epoch"
55
+ version = "0.9.18"
56
+ source = "registry+https://github.com/rust-lang/crates.io-index"
57
+ checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
58
+ dependencies = [
59
+ "crossbeam-utils",
60
+ ]
61
+
62
+ [[package]]
63
+ name = "crossbeam-utils"
64
+ version = "0.8.21"
65
+ source = "registry+https://github.com/rust-lang/crates.io-index"
66
+ checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
67
+
68
+ [[package]]
69
+ name = "derive-new"
70
+ version = "0.7.0"
71
+ source = "registry+https://github.com/rust-lang/crates.io-index"
72
+ checksum = "2cdc8d50f426189eef89dac62fabfa0abb27d5cc008f25bf4156a0203325becc"
73
+ dependencies = [
74
+ "proc-macro2",
75
+ "quote",
76
+ "syn",
77
+ ]
78
+
79
+ [[package]]
80
+ name = "either"
81
+ version = "1.13.0"
82
+ source = "registry+https://github.com/rust-lang/crates.io-index"
83
+ checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
84
+
85
+ [[package]]
86
+ name = "equivalent"
87
+ version = "1.0.1"
88
+ source = "registry+https://github.com/rust-lang/crates.io-index"
89
+ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
90
+
91
+ [[package]]
92
+ name = "foldhash"
93
+ version = "0.1.4"
94
+ source = "registry+https://github.com/rust-lang/crates.io-index"
95
+ checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f"
96
+
97
+ [[package]]
98
+ name = "getset"
99
+ version = "0.1.3"
100
+ source = "registry+https://github.com/rust-lang/crates.io-index"
101
+ checksum = "f636605b743120a8d32ed92fc27b6cde1a769f8f936c065151eb66f88ded513c"
102
+ dependencies = [
103
+ "proc-macro-error2",
104
+ "proc-macro2",
105
+ "quote",
106
+ "syn",
107
+ ]
108
+
109
+ [[package]]
110
+ name = "hashbrown"
111
+ version = "0.15.2"
112
+ source = "registry+https://github.com/rust-lang/crates.io-index"
113
+ checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289"
114
+ dependencies = [
115
+ "foldhash",
116
+ ]
117
+
118
+ [[package]]
119
+ name = "heck"
120
+ version = "0.5.0"
121
+ source = "registry+https://github.com/rust-lang/crates.io-index"
122
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
123
+
124
+ [[package]]
125
+ name = "indexmap"
126
+ version = "2.7.1"
127
+ source = "registry+https://github.com/rust-lang/crates.io-index"
128
+ checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652"
129
+ dependencies = [
130
+ "equivalent",
131
+ "hashbrown",
132
+ ]
133
+
134
+ [[package]]
135
+ name = "indoc"
136
+ version = "2.0.5"
137
+ source = "registry+https://github.com/rust-lang/crates.io-index"
138
+ checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
139
+
140
+ [[package]]
141
+ name = "itertools"
142
+ version = "0.14.0"
143
+ source = "registry+https://github.com/rust-lang/crates.io-index"
144
+ checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
145
+ dependencies = [
146
+ "either",
147
+ ]
148
+
149
+ [[package]]
150
+ name = "itoa"
151
+ version = "1.0.14"
152
+ source = "registry+https://github.com/rust-lang/crates.io-index"
153
+ checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674"
154
+
155
+ [[package]]
156
+ name = "lazy_static"
157
+ version = "1.5.0"
158
+ source = "registry+https://github.com/rust-lang/crates.io-index"
159
+ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
160
+
161
+ [[package]]
162
+ name = "libc"
163
+ version = "0.2.169"
164
+ source = "registry+https://github.com/rust-lang/crates.io-index"
165
+ checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
166
+
167
+ [[package]]
168
+ name = "memchr"
169
+ version = "2.7.4"
170
+ source = "registry+https://github.com/rust-lang/crates.io-index"
171
+ checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
172
+
173
+ [[package]]
174
+ name = "memoffset"
175
+ version = "0.9.1"
176
+ source = "registry+https://github.com/rust-lang/crates.io-index"
177
+ checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
178
+ dependencies = [
179
+ "autocfg",
180
+ ]
181
+
182
+ [[package]]
183
+ name = "once_cell"
184
+ version = "1.20.2"
185
+ source = "registry+https://github.com/rust-lang/crates.io-index"
186
+ checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
187
+
188
+ [[package]]
189
+ name = "portable-atomic"
190
+ version = "1.10.0"
191
+ source = "registry+https://github.com/rust-lang/crates.io-index"
192
+ checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6"
193
+
194
+ [[package]]
195
+ name = "proc-macro-error-attr2"
196
+ version = "2.0.0"
197
+ source = "registry+https://github.com/rust-lang/crates.io-index"
198
+ checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5"
199
+ dependencies = [
200
+ "proc-macro2",
201
+ "quote",
202
+ ]
203
+
204
+ [[package]]
205
+ name = "proc-macro-error2"
206
+ version = "2.0.1"
207
+ source = "registry+https://github.com/rust-lang/crates.io-index"
208
+ checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802"
209
+ dependencies = [
210
+ "proc-macro-error-attr2",
211
+ "proc-macro2",
212
+ "quote",
213
+ "syn",
214
+ ]
215
+
216
+ [[package]]
217
+ name = "proc-macro2"
218
+ version = "1.0.93"
219
+ source = "registry+https://github.com/rust-lang/crates.io-index"
220
+ checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99"
221
+ dependencies = [
222
+ "unicode-ident",
223
+ ]
224
+
225
+ [[package]]
226
+ name = "pyo3"
227
+ version = "0.23.4"
228
+ source = "registry+https://github.com/rust-lang/crates.io-index"
229
+ checksum = "57fe09249128b3173d092de9523eaa75136bf7ba85e0d69eca241c7939c933cc"
230
+ dependencies = [
231
+ "cfg-if",
232
+ "indoc",
233
+ "libc",
234
+ "memoffset",
235
+ "once_cell",
236
+ "portable-atomic",
237
+ "pyo3-build-config",
238
+ "pyo3-ffi",
239
+ "pyo3-macros",
240
+ "unindent",
241
+ ]
242
+
243
+ [[package]]
244
+ name = "pyo3-build-config"
245
+ version = "0.23.4"
246
+ source = "registry+https://github.com/rust-lang/crates.io-index"
247
+ checksum = "1cd3927b5a78757a0d71aa9dff669f903b1eb64b54142a9bd9f757f8fde65fd7"
248
+ dependencies = [
249
+ "once_cell",
250
+ "target-lexicon",
251
+ ]
252
+
253
+ [[package]]
254
+ name = "pyo3-ffi"
255
+ version = "0.23.4"
256
+ source = "registry+https://github.com/rust-lang/crates.io-index"
257
+ checksum = "dab6bb2102bd8f991e7749f130a70d05dd557613e39ed2deeee8e9ca0c4d548d"
258
+ dependencies = [
259
+ "libc",
260
+ "pyo3-build-config",
261
+ ]
262
+
263
+ [[package]]
264
+ name = "pyo3-macros"
265
+ version = "0.23.4"
266
+ source = "registry+https://github.com/rust-lang/crates.io-index"
267
+ checksum = "91871864b353fd5ffcb3f91f2f703a22a9797c91b9ab497b1acac7b07ae509c7"
268
+ dependencies = [
269
+ "proc-macro2",
270
+ "pyo3-macros-backend",
271
+ "quote",
272
+ "syn",
273
+ ]
274
+
275
+ [[package]]
276
+ name = "pyo3-macros-backend"
277
+ version = "0.23.4"
278
+ source = "registry+https://github.com/rust-lang/crates.io-index"
279
+ checksum = "43abc3b80bc20f3facd86cd3c60beed58c3e2aa26213f3cda368de39c60a27e4"
280
+ dependencies = [
281
+ "heck",
282
+ "proc-macro2",
283
+ "pyo3-build-config",
284
+ "quote",
285
+ "syn",
286
+ ]
287
+
288
+ [[package]]
289
+ name = "quote"
290
+ version = "1.0.38"
291
+ source = "registry+https://github.com/rust-lang/crates.io-index"
292
+ checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
293
+ dependencies = [
294
+ "proc-macro2",
295
+ ]
296
+
297
+ [[package]]
298
+ name = "rayon"
299
+ version = "1.10.0"
300
+ source = "registry+https://github.com/rust-lang/crates.io-index"
301
+ checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa"
302
+ dependencies = [
303
+ "either",
304
+ "rayon-core",
305
+ ]
306
+
307
+ [[package]]
308
+ name = "rayon-core"
309
+ version = "1.12.1"
310
+ source = "registry+https://github.com/rust-lang/crates.io-index"
311
+ checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2"
312
+ dependencies = [
313
+ "crossbeam-deque",
314
+ "crossbeam-utils",
315
+ ]
316
+
317
+ [[package]]
318
+ name = "rustc-hash"
319
+ version = "2.1.0"
320
+ source = "registry+https://github.com/rust-lang/crates.io-index"
321
+ checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497"
322
+
323
+ [[package]]
324
+ name = "ryu"
325
+ version = "1.0.18"
326
+ source = "registry+https://github.com/rust-lang/crates.io-index"
327
+ checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
328
+
329
+ [[package]]
330
+ name = "serde"
331
+ version = "1.0.217"
332
+ source = "registry+https://github.com/rust-lang/crates.io-index"
333
+ checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70"
334
+ dependencies = [
335
+ "serde_derive",
336
+ ]
337
+
338
+ [[package]]
339
+ name = "serde_derive"
340
+ version = "1.0.217"
341
+ source = "registry+https://github.com/rust-lang/crates.io-index"
342
+ checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0"
343
+ dependencies = [
344
+ "proc-macro2",
345
+ "quote",
346
+ "syn",
347
+ ]
348
+
349
+ [[package]]
350
+ name = "serde_json"
351
+ version = "1.0.137"
352
+ source = "registry+https://github.com/rust-lang/crates.io-index"
353
+ checksum = "930cfb6e6abf99298aaad7d29abbef7a9999a9a8806a40088f55f0dcec03146b"
354
+ dependencies = [
355
+ "itoa",
356
+ "memchr",
357
+ "ryu",
358
+ "serde",
359
+ ]
360
+
361
+ [[package]]
362
+ name = "slotmap"
363
+ version = "1.0.7"
364
+ source = "registry+https://github.com/rust-lang/crates.io-index"
365
+ checksum = "dbff4acf519f630b3a3ddcfaea6c06b42174d9a44bc70c620e9ed1649d58b82a"
366
+ dependencies = [
367
+ "version_check",
368
+ ]
369
+
370
+ [[package]]
371
+ name = "string-interner"
372
+ version = "0.18.0"
373
+ source = "registry+https://github.com/rust-lang/crates.io-index"
374
+ checksum = "1a3275464d7a9f2d4cac57c89c2ef96a8524dba2864c8d6f82e3980baf136f9b"
375
+ dependencies = [
376
+ "hashbrown",
377
+ "serde",
378
+ ]
379
+
380
+ [[package]]
381
+ name = "syn"
382
+ version = "2.0.96"
383
+ source = "registry+https://github.com/rust-lang/crates.io-index"
384
+ checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80"
385
+ dependencies = [
386
+ "proc-macro2",
387
+ "quote",
388
+ "unicode-ident",
389
+ ]
390
+
391
+ [[package]]
392
+ name = "tap"
393
+ version = "1.0.1"
394
+ source = "registry+https://github.com/rust-lang/crates.io-index"
395
+ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
396
+
397
+ [[package]]
398
+ name = "target-lexicon"
399
+ version = "0.12.16"
400
+ source = "registry+https://github.com/rust-lang/crates.io-index"
401
+ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
402
+
403
+ [[package]]
404
+ name = "thiserror"
405
+ version = "2.0.11"
406
+ source = "registry+https://github.com/rust-lang/crates.io-index"
407
+ checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc"
408
+ dependencies = [
409
+ "thiserror-impl",
410
+ ]
411
+
412
+ [[package]]
413
+ name = "thiserror-impl"
414
+ version = "2.0.11"
415
+ source = "registry+https://github.com/rust-lang/crates.io-index"
416
+ checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2"
417
+ dependencies = [
418
+ "proc-macro2",
419
+ "quote",
420
+ "syn",
421
+ ]
422
+
423
+ [[package]]
424
+ name = "unicode-ident"
425
+ version = "1.0.14"
426
+ source = "registry+https://github.com/rust-lang/crates.io-index"
427
+ checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83"
428
+
429
+ [[package]]
430
+ name = "unindent"
431
+ version = "0.2.3"
432
+ source = "registry+https://github.com/rust-lang/crates.io-index"
433
+ checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce"
434
+
435
+ [[package]]
436
+ name = "version_check"
437
+ version = "0.9.5"
438
+ source = "registry+https://github.com/rust-lang/crates.io-index"
439
+ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
@@ -0,0 +1,32 @@
1
+ [package]
2
+ name = "_rustgrimp"
3
+ version = "0.1.0"
4
+ edition = "2021"
5
+
6
+ [lib]
7
+ name = "_rustgrimp"
8
+ crate-type = ["cdylib", "rlib"]
9
+
10
+ [dependencies]
11
+ rayon = "1.10"
12
+ bimap = "0.6.3"
13
+ slotmap = "1.0.7"
14
+ getset = "0.1.3"
15
+ derive-new = "0.7.0"
16
+ lazy_static = "1.5.0"
17
+ string-interner = "0.18.0"
18
+ thiserror = "2.0.11"
19
+ itertools = "0.14.0"
20
+ tap = "1.0.1"
21
+ rustc-hash = "2.1.0"
22
+ indexmap = "2.7.1"
23
+
24
+ [dependencies.pyo3]
25
+ version = "0.23.4"
26
+
27
+ [features]
28
+ extension-module = ["pyo3/extension-module"]
29
+ default = ["extension-module"]
30
+
31
+ [dev-dependencies]
32
+ serde_json = "1.0.137"
@@ -0,0 +1,29 @@
1
+ use crate::exceptions::{ModuleNotPresent, NoSuchContainer};
2
+ use pyo3::exceptions::PyValueError;
3
+ use pyo3::PyErr;
4
+ use thiserror::Error;
5
+
6
+ #[derive(Debug, Error)]
7
+ pub enum GrimpError {
8
+ #[error("Module {0} is not present in the graph.")]
9
+ ModuleNotPresent(String),
10
+
11
+ #[error("Container {0} does not exist.")]
12
+ NoSuchContainer(String),
13
+
14
+ #[error("Modules have shared descendants.")]
15
+ SharedDescendants,
16
+ }
17
+
18
+ pub type GrimpResult<T> = Result<T, GrimpError>;
19
+
20
+ impl From<GrimpError> for PyErr {
21
+ fn from(value: GrimpError) -> Self {
22
+ // A default mapping from `GrimpError`s to python exceptions.
23
+ match value {
24
+ GrimpError::ModuleNotPresent(_) => ModuleNotPresent::new_err(value.to_string()),
25
+ GrimpError::NoSuchContainer(_) => NoSuchContainer::new_err(value.to_string()),
26
+ GrimpError::SharedDescendants => PyValueError::new_err(value.to_string()),
27
+ }
28
+ }
29
+ }
@@ -0,0 +1,4 @@
1
+ use pyo3::create_exception;
2
+
3
+ create_exception!(_rustgrimp, ModuleNotPresent, pyo3::exceptions::PyException);
4
+ create_exception!(_rustgrimp, NoSuchContainer, pyo3::exceptions::PyException);
@@ -0,0 +1,57 @@
1
+ use crate::errors::{GrimpError, GrimpResult};
2
+ use crate::graph::{
3
+ ExtendWithDescendants, Graph, ImportDetails, ModuleToken, EMPTY_IMPORT_DETAILS,
4
+ EMPTY_MODULE_TOKENS,
5
+ };
6
+ use rustc_hash::FxHashSet;
7
+
8
+ impl Graph {
9
+ pub fn count_imports(&self) -> usize {
10
+ self.imports.values().map(|imports| imports.len()).sum()
11
+ }
12
+
13
+ pub fn direct_import_exists(
14
+ &self,
15
+ importer: ModuleToken,
16
+ imported: ModuleToken,
17
+ as_packages: bool,
18
+ ) -> GrimpResult<bool> {
19
+ let mut importer: FxHashSet<_> = importer.into();
20
+ let mut imported: FxHashSet<_> = imported.into();
21
+ if as_packages {
22
+ importer.extend_with_descendants(self);
23
+ imported.extend_with_descendants(self);
24
+ if !(&importer & &imported).is_empty() {
25
+ return Err(GrimpError::SharedDescendants);
26
+ }
27
+ }
28
+
29
+ let direct_imports = importer
30
+ .iter()
31
+ .flat_map(|module| self.imports.get(*module).unwrap().iter().cloned())
32
+ .collect::<FxHashSet<ModuleToken>>();
33
+
34
+ Ok(!(&direct_imports & &imported).is_empty())
35
+ }
36
+
37
+ pub fn modules_directly_imported_by(&self, importer: ModuleToken) -> &FxHashSet<ModuleToken> {
38
+ self.imports.get(importer).unwrap_or(&EMPTY_MODULE_TOKENS)
39
+ }
40
+
41
+ pub fn modules_that_directly_import(&self, imported: ModuleToken) -> &FxHashSet<ModuleToken> {
42
+ self.reverse_imports
43
+ .get(imported)
44
+ .unwrap_or(&EMPTY_MODULE_TOKENS)
45
+ }
46
+
47
+ pub fn get_import_details(
48
+ &self,
49
+ importer: ModuleToken,
50
+ imported: ModuleToken,
51
+ ) -> &FxHashSet<ImportDetails> {
52
+ match self.import_details.get(&(importer, imported)) {
53
+ Some(import_details) => import_details,
54
+ None => &EMPTY_IMPORT_DETAILS,
55
+ }
56
+ }
57
+ }