admina-core 0.10.0__tar.gz → 0.11.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.
@@ -4,7 +4,7 @@ version = 4
4
4
 
5
5
  [[package]]
6
6
  name = "admina_core"
7
- version = "0.10.0"
7
+ version = "0.11.0"
8
8
  dependencies = [
9
9
  "chrono",
10
10
  "hex",
@@ -170,15 +170,6 @@ dependencies = [
170
170
  "cc",
171
171
  ]
172
172
 
173
- [[package]]
174
- name = "indoc"
175
- version = "2.0.7"
176
- source = "registry+https://github.com/rust-lang/crates.io-index"
177
- checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
178
- dependencies = [
179
- "rustversion",
180
- ]
181
-
182
173
  [[package]]
183
174
  name = "itoa"
184
175
  version = "1.0.17"
@@ -213,15 +204,6 @@ version = "2.8.0"
213
204
  source = "registry+https://github.com/rust-lang/crates.io-index"
214
205
  checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
215
206
 
216
- [[package]]
217
- name = "memoffset"
218
- version = "0.9.1"
219
- source = "registry+https://github.com/rust-lang/crates.io-index"
220
- checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
221
- dependencies = [
222
- "autocfg",
223
- ]
224
-
225
207
  [[package]]
226
208
  name = "num-traits"
227
209
  version = "0.2.19"
@@ -254,37 +236,32 @@ dependencies = [
254
236
 
255
237
  [[package]]
256
238
  name = "pyo3"
257
- version = "0.24.2"
239
+ version = "0.29.0"
258
240
  source = "registry+https://github.com/rust-lang/crates.io-index"
259
- checksum = "e5203598f366b11a02b13aa20cab591229ff0a89fd121a308a5df751d5fc9219"
241
+ checksum = "cd274650b21d4bfc26a0a47587962c1edb425f69287324355cd040c3ea66071c"
260
242
  dependencies = [
261
- "cfg-if",
262
- "indoc",
263
243
  "libc",
264
- "memoffset",
265
244
  "once_cell",
266
245
  "portable-atomic",
267
246
  "pyo3-build-config",
268
247
  "pyo3-ffi",
269
248
  "pyo3-macros",
270
- "unindent",
271
249
  ]
272
250
 
273
251
  [[package]]
274
252
  name = "pyo3-build-config"
275
- version = "0.24.2"
253
+ version = "0.29.0"
276
254
  source = "registry+https://github.com/rust-lang/crates.io-index"
277
- checksum = "99636d423fa2ca130fa5acde3059308006d46f98caac629418e53f7ebb1e9999"
255
+ checksum = "c5e2a7d2f0d013342f295c048ad19237add5154a55b1c5a254c0ec93d4109078"
278
256
  dependencies = [
279
- "once_cell",
280
257
  "target-lexicon",
281
258
  ]
282
259
 
283
260
  [[package]]
284
261
  name = "pyo3-ffi"
285
- version = "0.24.2"
262
+ version = "0.29.0"
286
263
  source = "registry+https://github.com/rust-lang/crates.io-index"
287
- checksum = "78f9cf92ba9c409279bc3305b5409d90db2d2c22392d443a87df3a1adad59e33"
264
+ checksum = "ca85c467da1bbc8d866eea5deff9cf29ea5f7785054a17da36e65bda9c05845b"
288
265
  dependencies = [
289
266
  "libc",
290
267
  "pyo3-build-config",
@@ -292,9 +269,9 @@ dependencies = [
292
269
 
293
270
  [[package]]
294
271
  name = "pyo3-macros"
295
- version = "0.24.2"
272
+ version = "0.29.0"
296
273
  source = "registry+https://github.com/rust-lang/crates.io-index"
297
- checksum = "0b999cb1a6ce21f9a6b147dcf1be9ffedf02e0043aec74dc390f3007047cecd9"
274
+ checksum = "9ac53762fd065daa3194dd09337a38bd793a188100fd1a9304c4ab312d901771"
298
275
  dependencies = [
299
276
  "proc-macro2",
300
277
  "pyo3-macros-backend",
@@ -304,13 +281,12 @@ dependencies = [
304
281
 
305
282
  [[package]]
306
283
  name = "pyo3-macros-backend"
307
- version = "0.24.2"
284
+ version = "0.29.0"
308
285
  source = "registry+https://github.com/rust-lang/crates.io-index"
309
- checksum = "822ece1c7e1012745607d5cf0bcb2874769f0f7cb34c4cde03b9358eb9ef911a"
286
+ checksum = "4ca3a1557399783172dc5bf39cfca835157732532cba56b71d2292161e53b362"
310
287
  dependencies = [
311
288
  "heck",
312
289
  "proc-macro2",
313
- "pyo3-build-config",
314
290
  "quote",
315
291
  "syn",
316
292
  ]
@@ -326,9 +302,9 @@ dependencies = [
326
302
 
327
303
  [[package]]
328
304
  name = "regex"
329
- version = "1.12.4"
305
+ version = "1.13.0"
330
306
  source = "registry+https://github.com/rust-lang/crates.io-index"
331
- checksum = "f1292b7759ae1cb9ec195452d1390a074f0cd8541ab7a5a8c31cd6db45d4a6ba"
307
+ checksum = "2a0e75113e14dc5acb068cd0786884f214f1312650a3d36d269f5c4f3cdee8a2"
332
308
  dependencies = [
333
309
  "aho-corasick",
334
310
  "memchr",
@@ -448,12 +424,6 @@ version = "1.0.24"
448
424
  source = "registry+https://github.com/rust-lang/crates.io-index"
449
425
  checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
450
426
 
451
- [[package]]
452
- name = "unindent"
453
- version = "0.2.4"
454
- source = "registry+https://github.com/rust-lang/crates.io-index"
455
- checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
456
-
457
427
  [[package]]
458
428
  name = "version_check"
459
429
  version = "0.9.5"
@@ -15,7 +15,7 @@
15
15
 
16
16
  [package]
17
17
  name = "admina_core"
18
- version = "0.10.0"
18
+ version = "0.11.0"
19
19
  edition = "2021"
20
20
  description = "Admina governance engines — Rust core with Python bindings"
21
21
  license = "Apache-2.0"
@@ -32,7 +32,7 @@ crate-type = ["cdylib", "rlib"]
32
32
  # pulling in whichever Python framework the build environment had (e.g.
33
33
  # Homebrew Python 3.14), causing a Fatal Python error at import time on
34
34
  # Python 3.11/3.12 runtimes.
35
- pyo3 = { version = "0.24", features = ["extension-module", "abi3-py311"] }
35
+ pyo3 = { version = "0.29", features = ["extension-module", "abi3-py311"] }
36
36
  regex = "1.10"
37
37
  sha2 = "0.10"
38
38
  hex = "0.4"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: admina-core
3
- Version: 0.10.0
3
+ Version: 0.11.0
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: Operating System :: POSIX :: Linux
@@ -19,7 +19,7 @@ build-backend = "maturin"
19
19
 
20
20
  [project]
21
21
  name = "admina-core"
22
- version = "0.10.0"
22
+ version = "0.11.0"
23
23
  description = "Admina governance engines — Rust core with Python bindings (firewall, PII, loop breaker, hash chain)"
24
24
  readme = "README.md"
25
25
  requires-python = ">=3.11"
@@ -221,7 +221,7 @@ fn heuristic_score(text: &str) -> (f64, Vec<String>) {
221
221
  }
222
222
 
223
223
  /// Result of a firewall check.
224
- #[pyclass]
224
+ #[pyclass(from_py_object)]
225
225
  #[derive(Clone)]
226
226
  pub struct FirewallResult {
227
227
  #[pyo3(get)]
@@ -238,8 +238,8 @@ pub struct FirewallResult {
238
238
 
239
239
  #[pymethods]
240
240
  impl FirewallResult {
241
- fn to_dict(&self) -> PyResult<PyObject> {
242
- Python::with_gil(|py| {
241
+ fn to_dict(&self) -> PyResult<Py<PyAny>> {
242
+ Python::attach(|py| {
243
243
  let dict = pyo3::types::PyDict::new(py);
244
244
  dict.set_item("is_injection", self.is_injection)?;
245
245
  dict.set_item("risk_level", &self.risk_level)?;
@@ -338,8 +338,8 @@ impl RustFirewall {
338
338
  }
339
339
  }
340
340
 
341
- fn get_stats(&self) -> PyResult<PyObject> {
342
- Python::with_gil(|py| {
341
+ fn get_stats(&self) -> PyResult<Py<PyAny>> {
342
+ Python::attach(|py| {
343
343
  let dict = pyo3::types::PyDict::new(py);
344
344
  dict.set_item("checks_total", self.checks_total)?;
345
345
  dict.set_item("injections_detected", self.injections_detected)?;
@@ -37,7 +37,7 @@ impl RustHashChain {
37
37
 
38
38
  /// Create a new hash-chained record.
39
39
  /// Returns dict with hash, previous_hash, sequence, timestamp.
40
- fn record(&mut self, event_id: &str, data: &str) -> PyResult<PyObject> {
40
+ fn record(&mut self, event_id: &str, data: &str) -> PyResult<Py<PyAny>> {
41
41
  self.sequence += 1;
42
42
  self.total_records += 1;
43
43
  let now = Utc::now();
@@ -57,7 +57,7 @@ impl RustHashChain {
57
57
  let prev = self.previous_hash.clone();
58
58
  self.previous_hash = hash.clone();
59
59
 
60
- Python::with_gil(|py| {
60
+ Python::attach(|py| {
61
61
  let dict = pyo3::types::PyDict::new(py);
62
62
  dict.set_item("hash", &hash)?;
63
63
  dict.set_item("previous_hash", &prev)?;
@@ -72,14 +72,14 @@ impl RustHashChain {
72
72
 
73
73
  /// Verify a chain of records.
74
74
  /// Takes a list of (hash, previous_hash) tuples, returns (valid, broken_at).
75
- fn verify_chain(&self, chain: Vec<(String, String)>) -> PyResult<PyObject> {
76
- Python::with_gil(|py| {
75
+ fn verify_chain(&self, chain: Vec<(String, String)>) -> PyResult<Py<PyAny>> {
76
+ Python::attach(|py| {
77
77
  let dict = pyo3::types::PyDict::new(py);
78
78
 
79
79
  if chain.is_empty() {
80
80
  dict.set_item("valid", true)?;
81
81
  dict.set_item("length", 0)?;
82
- return Ok(dict.into());
82
+ return Ok(dict.unbind().into());
83
83
  }
84
84
 
85
85
  for i in 1..chain.len() {
@@ -88,7 +88,7 @@ impl RustHashChain {
88
88
  dict.set_item("broken_at", i)?;
89
89
  dict.set_item("expected", &chain[i - 1].0)?;
90
90
  dict.set_item("found", &chain[i].1)?;
91
- return Ok(dict.into());
91
+ return Ok(dict.unbind().into());
92
92
  }
93
93
  }
94
94
 
@@ -106,8 +106,8 @@ impl RustHashChain {
106
106
  hex::encode(hasher.finalize())
107
107
  }
108
108
 
109
- fn get_stats(&self) -> PyResult<PyObject> {
110
- Python::with_gil(|py| {
109
+ fn get_stats(&self) -> PyResult<Py<PyAny>> {
110
+ Python::attach(|py| {
111
111
  let dict = pyo3::types::PyDict::new(py);
112
112
  dict.set_item("total_records", self.total_records)?;
113
113
  dict.set_item("current_sequence", self.sequence)?;
@@ -28,8 +28,8 @@ fn version() -> &'static str {
28
28
 
29
29
  /// Returns engine info for diagnostics.
30
30
  #[pyfunction]
31
- fn engine_info() -> PyResult<PyObject> {
32
- Python::with_gil(|py| {
31
+ fn engine_info() -> PyResult<Py<PyAny>> {
32
+ Python::attach(|py| {
33
33
  let dict = pyo3::types::PyDict::new(py);
34
34
  dict.set_item("engine", "rust")?;
35
35
  dict.set_item("version", env!("CARGO_PKG_VERSION"))?;
@@ -104,7 +104,7 @@ impl RustLoopBreaker {
104
104
 
105
105
  /// Check if a request is part of a reasoning loop.
106
106
  /// Returns dict with is_loop, similarity, consecutive_count.
107
- fn check(&mut self, session_id: &str, content: &str) -> PyResult<PyObject> {
107
+ fn check(&mut self, session_id: &str, content: &str) -> PyResult<Py<PyAny>> {
108
108
  self.total_checks += 1;
109
109
  let tf = term_frequencies(content);
110
110
 
@@ -144,7 +144,7 @@ impl RustLoopBreaker {
144
144
  session.vectors.remove(0);
145
145
  }
146
146
 
147
- Python::with_gil(|py| {
147
+ Python::attach(|py| {
148
148
  let dict = pyo3::types::PyDict::new(py);
149
149
  dict.set_item("is_loop", is_loop)?;
150
150
  dict.set_item("similarity", max_sim)?;
@@ -160,8 +160,8 @@ impl RustLoopBreaker {
160
160
  self.sessions.remove(session_id);
161
161
  }
162
162
 
163
- fn get_stats(&self) -> PyResult<PyObject> {
164
- Python::with_gil(|py| {
163
+ fn get_stats(&self) -> PyResult<Py<PyAny>> {
164
+ Python::attach(|py| {
165
165
  let dict = pyo3::types::PyDict::new(py);
166
166
  dict.set_item("total_checks", self.total_checks)?;
167
167
  dict.set_item("loops_detected", self.loops_detected)?;
@@ -62,7 +62,7 @@ fn get_pii_patterns() -> &'static Vec<PiiPattern> {
62
62
  }
63
63
 
64
64
  /// Result of PII scanning.
65
- #[pyclass]
65
+ #[pyclass(from_py_object)]
66
66
  #[derive(Clone)]
67
67
  pub struct PiiResult {
68
68
  #[pyo3(get)]
@@ -77,8 +77,8 @@ pub struct PiiResult {
77
77
 
78
78
  #[pymethods]
79
79
  impl PiiResult {
80
- fn to_dict(&self) -> PyResult<PyObject> {
81
- Python::with_gil(|py| {
80
+ fn to_dict(&self) -> PyResult<Py<PyAny>> {
81
+ Python::attach(|py| {
82
82
  let dict = pyo3::types::PyDict::new(py);
83
83
  dict.set_item("redacted_text", &self.redacted_text)?;
84
84
  dict.set_item("count", self.count)?;
@@ -161,8 +161,8 @@ impl RustPiiScanner {
161
161
  }
162
162
  }
163
163
 
164
- fn get_stats(&self) -> PyResult<PyObject> {
165
- Python::with_gil(|py| {
164
+ fn get_stats(&self) -> PyResult<Py<PyAny>> {
165
+ Python::attach(|py| {
166
166
  let dict = pyo3::types::PyDict::new(py);
167
167
  dict.set_item("total_scans", self.total_scans)?;
168
168
  dict.set_item("total_redactions", self.total_redactions)?;
@@ -4,5 +4,5 @@ requires-python = ">=3.11"
4
4
 
5
5
  [[package]]
6
6
  name = "admina-core"
7
- version = "0.10.0"
7
+ version = "0.11.0"
8
8
  source = { editable = "." }
File without changes