pygjson 0.0.2__tar.gz → 0.0.3__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.
@@ -0,0 +1,38 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ jobs:
8
+ test:
9
+ name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
10
+ runs-on: ${{ matrix.os }}
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ os: [ubuntu-latest, macos-latest, windows-latest]
15
+ python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
16
+
17
+ steps:
18
+ - uses: actions/checkout@v6
19
+
20
+ - name: Set up Python ${{ matrix.python-version }}
21
+ uses: actions/setup-python@v6
22
+ with:
23
+ python-version: ${{ matrix.python-version }}
24
+
25
+ - name: Build wheel
26
+ uses: PyO3/maturin-action@v1
27
+ with:
28
+ command: build
29
+ args: --out dist
30
+ env:
31
+ PYO3_USE_ABI3_FORWARD_COMPATIBILITY: 1
32
+
33
+ - name: Install wheel and pytest
34
+ shell: bash
35
+ run: pip install dist/*.whl pytest
36
+
37
+ - name: Run tests
38
+ run: pytest tests/ -v
@@ -2,12 +2,6 @@
2
2
  # It is not intended for manual editing.
3
3
  version = 4
4
4
 
5
- [[package]]
6
- name = "autocfg"
7
- version = "1.5.0"
8
- source = "registry+https://github.com/rust-lang/crates.io-index"
9
- checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
10
-
11
5
  [[package]]
12
6
  name = "cc"
13
7
  version = "1.2.60"
@@ -18,12 +12,6 @@ dependencies = [
18
12
  "shlex",
19
13
  ]
20
14
 
21
- [[package]]
22
- name = "cfg-if"
23
- version = "1.0.4"
24
- source = "registry+https://github.com/rust-lang/crates.io-index"
25
- checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
26
-
27
15
  [[package]]
28
16
  name = "find-msvc-tools"
29
17
  version = "0.1.9"
@@ -42,29 +30,11 @@ version = "0.5.0"
42
30
  source = "registry+https://github.com/rust-lang/crates.io-index"
43
31
  checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
44
32
 
45
- [[package]]
46
- name = "indoc"
47
- version = "2.0.7"
48
- source = "registry+https://github.com/rust-lang/crates.io-index"
49
- checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
50
- dependencies = [
51
- "rustversion",
52
- ]
53
-
54
33
  [[package]]
55
34
  name = "libc"
56
- version = "0.2.184"
35
+ version = "0.2.185"
57
36
  source = "registry+https://github.com/rust-lang/crates.io-index"
58
- checksum = "48f5d2a454e16a5ea0f4ced81bd44e4cfc7bd3a507b61887c99fd3538b28e4af"
59
-
60
- [[package]]
61
- name = "memoffset"
62
- version = "0.9.1"
63
- source = "registry+https://github.com/rust-lang/crates.io-index"
64
- checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
65
- dependencies = [
66
- "autocfg",
67
- ]
37
+ checksum = "52ff2c0fe9bc6cb6b14a0592c2ff4fa9ceb83eea9db979b0487cd054946a2b8f"
68
38
 
69
39
  [[package]]
70
40
  name = "once_cell"
@@ -89,7 +59,7 @@ dependencies = [
89
59
 
90
60
  [[package]]
91
61
  name = "pygjson"
92
- version = "0.0.2"
62
+ version = "0.0.3"
93
63
  dependencies = [
94
64
  "gjson",
95
65
  "pyo3",
@@ -97,38 +67,33 @@ dependencies = [
97
67
 
98
68
  [[package]]
99
69
  name = "pyo3"
100
- version = "0.22.6"
70
+ version = "0.28.3"
101
71
  source = "registry+https://github.com/rust-lang/crates.io-index"
102
- checksum = "f402062616ab18202ae8319da13fa4279883a2b8a9d9f83f20dbade813ce1884"
72
+ checksum = "91fd8e38a3b50ed1167fb981cd6fd60147e091784c427b8f7183a7ee32c31c12"
103
73
  dependencies = [
104
- "cfg-if",
105
- "indoc",
106
74
  "libc",
107
- "memoffset",
108
75
  "once_cell",
109
76
  "portable-atomic",
110
77
  "pyo3-build-config",
111
78
  "pyo3-ffi",
112
79
  "pyo3-macros",
113
- "unindent",
114
80
  ]
115
81
 
116
82
  [[package]]
117
83
  name = "pyo3-build-config"
118
- version = "0.22.6"
84
+ version = "0.28.3"
119
85
  source = "registry+https://github.com/rust-lang/crates.io-index"
120
- checksum = "b14b5775b5ff446dd1056212d778012cbe8a0fbffd368029fd9e25b514479c38"
86
+ checksum = "e368e7ddfdeb98c9bca7f8383be1648fd84ab466bf2bc015e94008db6d35611e"
121
87
  dependencies = [
122
- "once_cell",
123
88
  "python3-dll-a",
124
89
  "target-lexicon",
125
90
  ]
126
91
 
127
92
  [[package]]
128
93
  name = "pyo3-ffi"
129
- version = "0.22.6"
94
+ version = "0.28.3"
130
95
  source = "registry+https://github.com/rust-lang/crates.io-index"
131
- checksum = "9ab5bcf04a2cdcbb50c7d6105de943f543f9ed92af55818fd17b660390fc8636"
96
+ checksum = "7f29e10af80b1f7ccaf7f69eace800a03ecd13e883acfacc1e5d0988605f651e"
132
97
  dependencies = [
133
98
  "libc",
134
99
  "pyo3-build-config",
@@ -136,9 +101,9 @@ dependencies = [
136
101
 
137
102
  [[package]]
138
103
  name = "pyo3-macros"
139
- version = "0.22.6"
104
+ version = "0.28.3"
140
105
  source = "registry+https://github.com/rust-lang/crates.io-index"
141
- checksum = "0fd24d897903a9e6d80b968368a34e1525aeb719d568dba8b3d4bfa5dc67d453"
106
+ checksum = "df6e520eff47c45997d2fc7dd8214b25dd1310918bbb2642156ef66a67f29813"
142
107
  dependencies = [
143
108
  "proc-macro2",
144
109
  "pyo3-macros-backend",
@@ -148,9 +113,9 @@ dependencies = [
148
113
 
149
114
  [[package]]
150
115
  name = "pyo3-macros-backend"
151
- version = "0.22.6"
116
+ version = "0.28.3"
152
117
  source = "registry+https://github.com/rust-lang/crates.io-index"
153
- checksum = "36c011a03ba1e50152b4b394b479826cad97e7a21eb52df179cd91ac411cbfbe"
118
+ checksum = "c4cdc218d835738f81c2338f822078af45b4afdf8b2e33cbb5916f108b813acb"
154
119
  dependencies = [
155
120
  "heck",
156
121
  "proc-macro2",
@@ -177,12 +142,6 @@ dependencies = [
177
142
  "proc-macro2",
178
143
  ]
179
144
 
180
- [[package]]
181
- name = "rustversion"
182
- version = "1.0.22"
183
- source = "registry+https://github.com/rust-lang/crates.io-index"
184
- checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
185
-
186
145
  [[package]]
187
146
  name = "shlex"
188
147
  version = "1.3.0"
@@ -202,18 +161,12 @@ dependencies = [
202
161
 
203
162
  [[package]]
204
163
  name = "target-lexicon"
205
- version = "0.12.16"
164
+ version = "0.13.5"
206
165
  source = "registry+https://github.com/rust-lang/crates.io-index"
207
- checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
166
+ checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
208
167
 
209
168
  [[package]]
210
169
  name = "unicode-ident"
211
170
  version = "1.0.24"
212
171
  source = "registry+https://github.com/rust-lang/crates.io-index"
213
172
  checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
214
-
215
- [[package]]
216
- name = "unindent"
217
- version = "0.2.4"
218
- source = "registry+https://github.com/rust-lang/crates.io-index"
219
- checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "pygjson"
3
- version = "0.0.2"
3
+ version = "0.0.3"
4
4
  edition = "2021"
5
5
  readme = "README.md"
6
6
 
@@ -9,5 +9,5 @@ name = "_pygjson"
9
9
  crate-type = ["cdylib"]
10
10
 
11
11
  [dependencies]
12
- pyo3 = { version = "0.22", features = ["extension-module", "abi3-py310", "generate-import-lib"] }
12
+ pyo3 = { version = "0.28.3", features = ["extension-module", "abi3-py310", "generate-import-lib"] }
13
13
  gjson = "0.8"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pygjson
3
- Version: 0.0.2
3
+ Version: 0.0.3
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  License-File: LICENSE
@@ -4,7 +4,7 @@ build-backend = "maturin"
4
4
 
5
5
  [project]
6
6
  name = "pygjson"
7
- version = "0.0.2"
7
+ version = "0.0.3"
8
8
  description = "Python bindings for gjson.rs - fast JSON path queries"
9
9
  requires-python = ">=3.10"
10
10
  license = { file = "LICENSE" }
@@ -4,7 +4,7 @@ use pyo3::types::{PyDict, PyTuple};
4
4
  use std::sync::Arc;
5
5
 
6
6
  /// Mirror of `gjson::Kind`, exposed to Python as a class with constant attributes.
7
- #[pyclass(module = "pygjson._pygjson", eq, eq_int)]
7
+ #[pyclass(module = "pygjson._pygjson", eq, eq_int, skip_from_py_object)]
8
8
  #[derive(Clone, Copy, Debug, PartialEq, Eq)]
9
9
  pub enum Kind {
10
10
  Null,
@@ -123,13 +123,13 @@ impl Value {
123
123
  }
124
124
 
125
125
  /// Signed integer value (`i64`).
126
- fn to_int(&self, py: Python<'_>) -> PyObject {
127
- self.parsed().i64().into_py(py)
126
+ fn to_int(&self, py: Python<'_>) -> PyResult<Py<PyAny>> {
127
+ Ok(self.parsed().i64().into_pyobject(py)?.into_any().unbind())
128
128
  }
129
129
 
130
130
  /// Unsigned integer value (`u64`).
131
- fn to_uint(&self, py: Python<'_>) -> PyObject {
132
- self.parsed().u64().into_py(py)
131
+ fn to_uint(&self, py: Python<'_>) -> PyResult<Py<PyAny>> {
132
+ Ok(self.parsed().u64().into_pyobject(py)?.into_any().unbind())
133
133
  }
134
134
 
135
135
  /// Floating point value.
@@ -157,7 +157,7 @@ impl Value {
157
157
  py: Python<'_>,
158
158
  path: &str,
159
159
  args: &Bound<'_, pyo3::types::PyTuple>,
160
- ) -> PyResult<PyObject> {
160
+ ) -> PyResult<Py<PyAny>> {
161
161
  if args.len() > 1 {
162
162
  return Err(pyo3::exceptions::PyTypeError::new_err(
163
163
  "get() takes at most 2 positional arguments",
@@ -166,9 +166,9 @@ impl Value {
166
166
  let parsed = self.parsed();
167
167
  let val = Value::child(&self.raw, parsed.get(path));
168
168
  if !val.exists && !args.is_empty() {
169
- return Ok(args.get_item(0)?.into_py(py));
169
+ return Ok(args.get_item(0)?.unbind());
170
170
  }
171
- Ok(val.into_py(py))
171
+ Ok(Py::new(py, val)?.into_any())
172
172
  }
173
173
 
174
174
  /// Return the value as a list of `Value` objects (empty for non-arrays).
@@ -184,7 +184,7 @@ impl Value {
184
184
 
185
185
  /// Return the value as a `dict[str, Value]` (empty for non-objects).
186
186
  fn to_dict<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyDict>> {
187
- let dict = PyDict::new_bound(py);
187
+ let dict = PyDict::new(py);
188
188
  // Only iterate as a map for objects; arrays would yield empty keys.
189
189
  if matches!(self.kind, Kind::Object) {
190
190
  let parsed = self.parsed();
@@ -192,7 +192,7 @@ impl Value {
192
192
  parsed.each(|k, v| {
193
193
  let key = k.str().to_string();
194
194
  let child = Value::child(&self.raw, v);
195
- match dict.set_item(key, child.into_py(py)) {
195
+ match dict.set_item(key, child) {
196
196
  Ok(()) => true,
197
197
  Err(e) => {
198
198
  err = Some(e);
@@ -336,11 +336,11 @@ impl Value {
336
336
  )
337
337
  }
338
338
 
339
- fn __int__(&self, py: Python<'_>) -> PyObject {
339
+ fn __int__(&self, py: Python<'_>) -> PyResult<Py<PyAny>> {
340
340
  if self.raw_slice().starts_with('-') {
341
- self.parsed().i64().into_py(py)
341
+ Ok(self.parsed().i64().into_pyobject(py)?.into_any().unbind())
342
342
  } else {
343
- self.parsed().u64().into_py(py)
343
+ Ok(self.parsed().u64().into_pyobject(py)?.into_any().unbind())
344
344
  }
345
345
  }
346
346
 
@@ -465,7 +465,7 @@ impl ValueIterator {
465
465
  slf
466
466
  }
467
467
 
468
- fn __next__(&mut self, py: Python<'_>) -> PyResult<Option<PyObject>> {
468
+ fn __next__(&mut self, py: Python<'_>) -> PyResult<Option<Py<PyAny>>> {
469
469
  let i = self.cursor;
470
470
  match self.mode {
471
471
  IterMode::Strings => {
@@ -473,7 +473,7 @@ impl ValueIterator {
473
473
  return Ok(None);
474
474
  }
475
475
  self.cursor += 1;
476
- Ok(Some(self.strings[i].as_ref().to_string().into_py(py)))
476
+ Ok(Some(self.strings[i].as_ref().into_pyobject(py)?.into_any().unbind()))
477
477
  }
478
478
  IterMode::Values => {
479
479
  if i >= self.children.len() {
@@ -488,7 +488,7 @@ impl ValueIterator {
488
488
  kind: v.kind,
489
489
  exists: v.exists,
490
490
  };
491
- Ok(Some(Py::new(py, cloned)?.into_py(py)))
491
+ Ok(Some(Py::new(py, cloned)?.into_any()))
492
492
  }
493
493
  IterMode::Items => {
494
494
  if i >= self.children.len() {
@@ -503,10 +503,10 @@ impl ValueIterator {
503
503
  kind: v.kind,
504
504
  exists: v.exists,
505
505
  };
506
- let key_obj = self.strings[i].as_ref().to_string().into_py(py);
507
- let val_obj = Py::new(py, cloned)?.into_py(py);
508
- let tup = PyTuple::new_bound(py, &[key_obj, val_obj]);
509
- Ok(Some(tup.into_py(py)))
506
+ let key_obj = self.strings[i].as_ref().into_pyobject(py)?;
507
+ let val_obj = Py::new(py, cloned)?.into_bound(py).into_any();
508
+ let tup = PyTuple::new(py, [key_obj.into_any(), val_obj])?;
509
+ Ok(Some(tup.into_any().unbind()))
510
510
  }
511
511
  }
512
512
  }
File without changes
File without changes
File without changes
File without changes
File without changes