gamedig 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.
@@ -0,0 +1,181 @@
1
+ # This file is autogenerated by maturin v1.7.4
2
+ # To update, run
3
+ #
4
+ # maturin generate-ci github
5
+ #
6
+ name: CI
7
+
8
+ on:
9
+ push:
10
+ branches:
11
+ - main
12
+ - master
13
+ tags:
14
+ - '*'
15
+ pull_request:
16
+ workflow_dispatch:
17
+
18
+ permissions:
19
+ contents: read
20
+
21
+ jobs:
22
+ linux:
23
+ runs-on: ${{ matrix.platform.runner }}
24
+ strategy:
25
+ matrix:
26
+ platform:
27
+ - runner: ubuntu-latest
28
+ target: x86_64
29
+ - runner: ubuntu-latest
30
+ target: x86
31
+ - runner: ubuntu-latest
32
+ target: aarch64
33
+ - runner: ubuntu-latest
34
+ target: armv7
35
+ - runner: ubuntu-latest
36
+ target: s390x
37
+ - runner: ubuntu-latest
38
+ target: ppc64le
39
+ steps:
40
+ - uses: actions/checkout@v4
41
+ - uses: actions/setup-python@v5
42
+ with:
43
+ python-version: 3.x
44
+ - name: Build wheels
45
+ uses: PyO3/maturin-action@v1
46
+ with:
47
+ target: ${{ matrix.platform.target }}
48
+ args: --release --out dist --find-interpreter
49
+ sccache: 'true'
50
+ manylinux: auto
51
+ - name: Upload wheels
52
+ uses: actions/upload-artifact@v4
53
+ with:
54
+ name: wheels-linux-${{ matrix.platform.target }}
55
+ path: dist
56
+
57
+ musllinux:
58
+ runs-on: ${{ matrix.platform.runner }}
59
+ strategy:
60
+ matrix:
61
+ platform:
62
+ - runner: ubuntu-latest
63
+ target: x86_64
64
+ - runner: ubuntu-latest
65
+ target: x86
66
+ - runner: ubuntu-latest
67
+ target: aarch64
68
+ - runner: ubuntu-latest
69
+ target: armv7
70
+ steps:
71
+ - uses: actions/checkout@v4
72
+ - uses: actions/setup-python@v5
73
+ with:
74
+ python-version: 3.x
75
+ - name: Build wheels
76
+ uses: PyO3/maturin-action@v1
77
+ with:
78
+ target: ${{ matrix.platform.target }}
79
+ args: --release --out dist --find-interpreter
80
+ sccache: 'true'
81
+ manylinux: musllinux_1_2
82
+ - name: Upload wheels
83
+ uses: actions/upload-artifact@v4
84
+ with:
85
+ name: wheels-musllinux-${{ matrix.platform.target }}
86
+ path: dist
87
+
88
+ windows:
89
+ runs-on: ${{ matrix.platform.runner }}
90
+ strategy:
91
+ matrix:
92
+ platform:
93
+ - runner: windows-latest
94
+ target: x64
95
+ - runner: windows-latest
96
+ target: x86
97
+ steps:
98
+ - uses: actions/checkout@v4
99
+ - uses: actions/setup-python@v5
100
+ with:
101
+ python-version: 3.x
102
+ architecture: ${{ matrix.platform.target }}
103
+ - name: Build wheels
104
+ uses: PyO3/maturin-action@v1
105
+ with:
106
+ target: ${{ matrix.platform.target }}
107
+ args: --release --out dist --find-interpreter
108
+ sccache: 'true'
109
+ - name: Upload wheels
110
+ uses: actions/upload-artifact@v4
111
+ with:
112
+ name: wheels-windows-${{ matrix.platform.target }}
113
+ path: dist
114
+
115
+ macos:
116
+ runs-on: ${{ matrix.platform.runner }}
117
+ strategy:
118
+ matrix:
119
+ platform:
120
+ - runner: macos-12
121
+ target: x86_64
122
+ - runner: macos-14
123
+ target: aarch64
124
+ steps:
125
+ - uses: actions/checkout@v4
126
+ - uses: actions/setup-python@v5
127
+ with:
128
+ python-version: 3.x
129
+ - name: Build wheels
130
+ uses: PyO3/maturin-action@v1
131
+ with:
132
+ target: ${{ matrix.platform.target }}
133
+ args: --release --out dist --find-interpreter
134
+ sccache: 'true'
135
+ - name: Upload wheels
136
+ uses: actions/upload-artifact@v4
137
+ with:
138
+ name: wheels-macos-${{ matrix.platform.target }}
139
+ path: dist
140
+
141
+ sdist:
142
+ runs-on: ubuntu-latest
143
+ steps:
144
+ - uses: actions/checkout@v4
145
+ - name: Build sdist
146
+ uses: PyO3/maturin-action@v1
147
+ with:
148
+ command: sdist
149
+ args: --out dist
150
+ - name: Upload sdist
151
+ uses: actions/upload-artifact@v4
152
+ with:
153
+ name: wheels-sdist
154
+ path: dist
155
+
156
+ release:
157
+ name: Release
158
+ runs-on: ubuntu-latest
159
+ if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
160
+ needs: [linux, musllinux, windows, macos, sdist]
161
+ permissions:
162
+ # Use to sign the release artifacts
163
+ id-token: write
164
+ # Used to upload release artifacts
165
+ contents: write
166
+ # Used to generate artifact attestation
167
+ attestations: write
168
+ steps:
169
+ - uses: actions/download-artifact@v4
170
+ - name: Generate artifact attestation
171
+ uses: actions/attest-build-provenance@v1
172
+ with:
173
+ subject-path: 'wheels-*/*'
174
+ - name: Publish to PyPI
175
+ if: "startsWith(github.ref, 'refs/tags/')"
176
+ uses: PyO3/maturin-action@v1
177
+ env:
178
+ MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
179
+ with:
180
+ command: upload
181
+ args: --non-interactive --skip-existing wheels-*/*
@@ -0,0 +1,72 @@
1
+ /target
2
+
3
+ # Byte-compiled / optimized / DLL files
4
+ __pycache__/
5
+ .pytest_cache/
6
+ *.py[cod]
7
+
8
+ # C extensions
9
+ *.so
10
+
11
+ # Distribution / packaging
12
+ .Python
13
+ .venv/
14
+ env/
15
+ bin/
16
+ build/
17
+ develop-eggs/
18
+ dist/
19
+ eggs/
20
+ lib/
21
+ lib64/
22
+ parts/
23
+ sdist/
24
+ var/
25
+ include/
26
+ man/
27
+ venv/
28
+ *.egg-info/
29
+ .installed.cfg
30
+ *.egg
31
+
32
+ # Installer logs
33
+ pip-log.txt
34
+ pip-delete-this-directory.txt
35
+ pip-selfcheck.json
36
+
37
+ # Unit test / coverage reports
38
+ htmlcov/
39
+ .tox/
40
+ .coverage
41
+ .cache
42
+ nosetests.xml
43
+ coverage.xml
44
+
45
+ # Translations
46
+ *.mo
47
+
48
+ # Mr Developer
49
+ .mr.developer.cfg
50
+ .project
51
+ .pydevproject
52
+
53
+ # Rope
54
+ .ropeproject
55
+
56
+ # Django stuff:
57
+ *.log
58
+ *.pot
59
+
60
+ .DS_Store
61
+
62
+ # Sphinx documentation
63
+ docs/_build/
64
+
65
+ # PyCharm
66
+ .idea/
67
+
68
+ # VSCode
69
+ .vscode/
70
+
71
+ # Pyenv
72
+ .python-version
@@ -0,0 +1,469 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 3
4
+
5
+ [[package]]
6
+ name = "adler2"
7
+ version = "2.0.0"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
10
+
11
+ [[package]]
12
+ name = "autocfg"
13
+ version = "1.4.0"
14
+ source = "registry+https://github.com/rust-lang/crates.io-index"
15
+ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
16
+
17
+ [[package]]
18
+ name = "base64"
19
+ version = "0.22.1"
20
+ source = "registry+https://github.com/rust-lang/crates.io-index"
21
+ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
22
+
23
+ [[package]]
24
+ name = "byteorder"
25
+ version = "1.5.0"
26
+ source = "registry+https://github.com/rust-lang/crates.io-index"
27
+ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
28
+
29
+ [[package]]
30
+ name = "bzip2-rs"
31
+ version = "0.1.2"
32
+ source = "registry+https://github.com/rust-lang/crates.io-index"
33
+ checksum = "beeb59e7e4c811ab37cc73680c798c7a5da77fc9989c62b09138e31ee740f735"
34
+ dependencies = [
35
+ "crc32fast",
36
+ "tinyvec",
37
+ ]
38
+
39
+ [[package]]
40
+ name = "cfg-if"
41
+ version = "1.0.0"
42
+ source = "registry+https://github.com/rust-lang/crates.io-index"
43
+ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
44
+
45
+ [[package]]
46
+ name = "crc32fast"
47
+ version = "1.4.2"
48
+ source = "registry+https://github.com/rust-lang/crates.io-index"
49
+ checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3"
50
+ dependencies = [
51
+ "cfg-if",
52
+ ]
53
+
54
+ [[package]]
55
+ name = "encoding_rs"
56
+ version = "0.8.34"
57
+ source = "registry+https://github.com/rust-lang/crates.io-index"
58
+ checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59"
59
+ dependencies = [
60
+ "cfg-if",
61
+ ]
62
+
63
+ [[package]]
64
+ name = "flate2"
65
+ version = "1.0.34"
66
+ source = "registry+https://github.com/rust-lang/crates.io-index"
67
+ checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0"
68
+ dependencies = [
69
+ "crc32fast",
70
+ "miniz_oxide",
71
+ ]
72
+
73
+ [[package]]
74
+ name = "form_urlencoded"
75
+ version = "1.2.1"
76
+ source = "registry+https://github.com/rust-lang/crates.io-index"
77
+ checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
78
+ dependencies = [
79
+ "percent-encoding",
80
+ ]
81
+
82
+ [[package]]
83
+ name = "gamedig"
84
+ version = "0.5.1"
85
+ source = "registry+https://github.com/rust-lang/crates.io-index"
86
+ checksum = "2bb2425b4d8b387f0ef9649aa098ecbf7a04a4d6f65158a797dff8c146759a78"
87
+ dependencies = [
88
+ "base64",
89
+ "byteorder",
90
+ "bzip2-rs",
91
+ "crc32fast",
92
+ "encoding_rs",
93
+ "phf",
94
+ "serde",
95
+ "serde_json",
96
+ "ureq",
97
+ "url",
98
+ ]
99
+
100
+ [[package]]
101
+ name = "heck"
102
+ version = "0.5.0"
103
+ source = "registry+https://github.com/rust-lang/crates.io-index"
104
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
105
+
106
+ [[package]]
107
+ name = "idna"
108
+ version = "0.5.0"
109
+ source = "registry+https://github.com/rust-lang/crates.io-index"
110
+ checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6"
111
+ dependencies = [
112
+ "unicode-bidi",
113
+ "unicode-normalization",
114
+ ]
115
+
116
+ [[package]]
117
+ name = "indoc"
118
+ version = "2.0.5"
119
+ source = "registry+https://github.com/rust-lang/crates.io-index"
120
+ checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
121
+
122
+ [[package]]
123
+ name = "itoa"
124
+ version = "1.0.11"
125
+ source = "registry+https://github.com/rust-lang/crates.io-index"
126
+ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
127
+
128
+ [[package]]
129
+ name = "libc"
130
+ version = "0.2.159"
131
+ source = "registry+https://github.com/rust-lang/crates.io-index"
132
+ checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5"
133
+
134
+ [[package]]
135
+ name = "log"
136
+ version = "0.4.22"
137
+ source = "registry+https://github.com/rust-lang/crates.io-index"
138
+ checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
139
+
140
+ [[package]]
141
+ name = "memchr"
142
+ version = "2.7.4"
143
+ source = "registry+https://github.com/rust-lang/crates.io-index"
144
+ checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
145
+
146
+ [[package]]
147
+ name = "memoffset"
148
+ version = "0.9.1"
149
+ source = "registry+https://github.com/rust-lang/crates.io-index"
150
+ checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
151
+ dependencies = [
152
+ "autocfg",
153
+ ]
154
+
155
+ [[package]]
156
+ name = "miniz_oxide"
157
+ version = "0.8.0"
158
+ source = "registry+https://github.com/rust-lang/crates.io-index"
159
+ checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1"
160
+ dependencies = [
161
+ "adler2",
162
+ ]
163
+
164
+ [[package]]
165
+ name = "once_cell"
166
+ version = "1.20.1"
167
+ source = "registry+https://github.com/rust-lang/crates.io-index"
168
+ checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1"
169
+ dependencies = [
170
+ "portable-atomic",
171
+ ]
172
+
173
+ [[package]]
174
+ name = "percent-encoding"
175
+ version = "2.3.1"
176
+ source = "registry+https://github.com/rust-lang/crates.io-index"
177
+ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
178
+
179
+ [[package]]
180
+ name = "phf"
181
+ version = "0.11.2"
182
+ source = "registry+https://github.com/rust-lang/crates.io-index"
183
+ checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc"
184
+ dependencies = [
185
+ "phf_macros",
186
+ "phf_shared",
187
+ ]
188
+
189
+ [[package]]
190
+ name = "phf_generator"
191
+ version = "0.11.2"
192
+ source = "registry+https://github.com/rust-lang/crates.io-index"
193
+ checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0"
194
+ dependencies = [
195
+ "phf_shared",
196
+ "rand",
197
+ ]
198
+
199
+ [[package]]
200
+ name = "phf_macros"
201
+ version = "0.11.2"
202
+ source = "registry+https://github.com/rust-lang/crates.io-index"
203
+ checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b"
204
+ dependencies = [
205
+ "phf_generator",
206
+ "phf_shared",
207
+ "proc-macro2",
208
+ "quote",
209
+ "syn",
210
+ ]
211
+
212
+ [[package]]
213
+ name = "phf_shared"
214
+ version = "0.11.2"
215
+ source = "registry+https://github.com/rust-lang/crates.io-index"
216
+ checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b"
217
+ dependencies = [
218
+ "siphasher",
219
+ ]
220
+
221
+ [[package]]
222
+ name = "portable-atomic"
223
+ version = "1.9.0"
224
+ source = "registry+https://github.com/rust-lang/crates.io-index"
225
+ checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2"
226
+
227
+ [[package]]
228
+ name = "proc-macro2"
229
+ version = "1.0.86"
230
+ source = "registry+https://github.com/rust-lang/crates.io-index"
231
+ checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
232
+ dependencies = [
233
+ "unicode-ident",
234
+ ]
235
+
236
+ [[package]]
237
+ name = "pyo3"
238
+ version = "0.22.3"
239
+ source = "registry+https://github.com/rust-lang/crates.io-index"
240
+ checksum = "15ee168e30649f7f234c3d49ef5a7a6cbf5134289bc46c29ff3155fa3221c225"
241
+ dependencies = [
242
+ "cfg-if",
243
+ "indoc",
244
+ "libc",
245
+ "memoffset",
246
+ "once_cell",
247
+ "portable-atomic",
248
+ "pyo3-build-config",
249
+ "pyo3-ffi",
250
+ "pyo3-macros",
251
+ "unindent",
252
+ ]
253
+
254
+ [[package]]
255
+ name = "pyo3-build-config"
256
+ version = "0.22.3"
257
+ source = "registry+https://github.com/rust-lang/crates.io-index"
258
+ checksum = "e61cef80755fe9e46bb8a0b8f20752ca7676dcc07a5277d8b7768c6172e529b3"
259
+ dependencies = [
260
+ "once_cell",
261
+ "target-lexicon",
262
+ ]
263
+
264
+ [[package]]
265
+ name = "pyo3-ffi"
266
+ version = "0.22.3"
267
+ source = "registry+https://github.com/rust-lang/crates.io-index"
268
+ checksum = "67ce096073ec5405f5ee2b8b31f03a68e02aa10d5d4f565eca04acc41931fa1c"
269
+ dependencies = [
270
+ "libc",
271
+ "pyo3-build-config",
272
+ ]
273
+
274
+ [[package]]
275
+ name = "pyo3-macros"
276
+ version = "0.22.3"
277
+ source = "registry+https://github.com/rust-lang/crates.io-index"
278
+ checksum = "2440c6d12bc8f3ae39f1e775266fa5122fd0c8891ce7520fa6048e683ad3de28"
279
+ dependencies = [
280
+ "proc-macro2",
281
+ "pyo3-macros-backend",
282
+ "quote",
283
+ "syn",
284
+ ]
285
+
286
+ [[package]]
287
+ name = "pyo3-macros-backend"
288
+ version = "0.22.3"
289
+ source = "registry+https://github.com/rust-lang/crates.io-index"
290
+ checksum = "1be962f0e06da8f8465729ea2cb71a416d2257dff56cbe40a70d3e62a93ae5d1"
291
+ dependencies = [
292
+ "heck",
293
+ "proc-macro2",
294
+ "pyo3-build-config",
295
+ "quote",
296
+ "syn",
297
+ ]
298
+
299
+ [[package]]
300
+ name = "python-gamedig"
301
+ version = "0.1.0"
302
+ dependencies = [
303
+ "gamedig",
304
+ "pyo3",
305
+ "serde-pyobject",
306
+ ]
307
+
308
+ [[package]]
309
+ name = "quote"
310
+ version = "1.0.37"
311
+ source = "registry+https://github.com/rust-lang/crates.io-index"
312
+ checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
313
+ dependencies = [
314
+ "proc-macro2",
315
+ ]
316
+
317
+ [[package]]
318
+ name = "rand"
319
+ version = "0.8.5"
320
+ source = "registry+https://github.com/rust-lang/crates.io-index"
321
+ checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
322
+ dependencies = [
323
+ "rand_core",
324
+ ]
325
+
326
+ [[package]]
327
+ name = "rand_core"
328
+ version = "0.6.4"
329
+ source = "registry+https://github.com/rust-lang/crates.io-index"
330
+ checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
331
+
332
+ [[package]]
333
+ name = "ryu"
334
+ version = "1.0.18"
335
+ source = "registry+https://github.com/rust-lang/crates.io-index"
336
+ checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
337
+
338
+ [[package]]
339
+ name = "serde"
340
+ version = "1.0.210"
341
+ source = "registry+https://github.com/rust-lang/crates.io-index"
342
+ checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a"
343
+ dependencies = [
344
+ "serde_derive",
345
+ ]
346
+
347
+ [[package]]
348
+ name = "serde-pyobject"
349
+ version = "0.4.0"
350
+ source = "registry+https://github.com/rust-lang/crates.io-index"
351
+ checksum = "ca4b0aad8b225845739a0030a0d5cc2ae949c56a86a7daf9226c7df7c2016d16"
352
+ dependencies = [
353
+ "pyo3",
354
+ "serde",
355
+ ]
356
+
357
+ [[package]]
358
+ name = "serde_derive"
359
+ version = "1.0.210"
360
+ source = "registry+https://github.com/rust-lang/crates.io-index"
361
+ checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f"
362
+ dependencies = [
363
+ "proc-macro2",
364
+ "quote",
365
+ "syn",
366
+ ]
367
+
368
+ [[package]]
369
+ name = "serde_json"
370
+ version = "1.0.128"
371
+ source = "registry+https://github.com/rust-lang/crates.io-index"
372
+ checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8"
373
+ dependencies = [
374
+ "itoa",
375
+ "memchr",
376
+ "ryu",
377
+ "serde",
378
+ ]
379
+
380
+ [[package]]
381
+ name = "siphasher"
382
+ version = "0.3.11"
383
+ source = "registry+https://github.com/rust-lang/crates.io-index"
384
+ checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
385
+
386
+ [[package]]
387
+ name = "syn"
388
+ version = "2.0.79"
389
+ source = "registry+https://github.com/rust-lang/crates.io-index"
390
+ checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590"
391
+ dependencies = [
392
+ "proc-macro2",
393
+ "quote",
394
+ "unicode-ident",
395
+ ]
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 = "tinyvec"
405
+ version = "1.8.0"
406
+ source = "registry+https://github.com/rust-lang/crates.io-index"
407
+ checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938"
408
+ dependencies = [
409
+ "tinyvec_macros",
410
+ ]
411
+
412
+ [[package]]
413
+ name = "tinyvec_macros"
414
+ version = "0.1.1"
415
+ source = "registry+https://github.com/rust-lang/crates.io-index"
416
+ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
417
+
418
+ [[package]]
419
+ name = "unicode-bidi"
420
+ version = "0.3.17"
421
+ source = "registry+https://github.com/rust-lang/crates.io-index"
422
+ checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893"
423
+
424
+ [[package]]
425
+ name = "unicode-ident"
426
+ version = "1.0.13"
427
+ source = "registry+https://github.com/rust-lang/crates.io-index"
428
+ checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
429
+
430
+ [[package]]
431
+ name = "unicode-normalization"
432
+ version = "0.1.24"
433
+ source = "registry+https://github.com/rust-lang/crates.io-index"
434
+ checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956"
435
+ dependencies = [
436
+ "tinyvec",
437
+ ]
438
+
439
+ [[package]]
440
+ name = "unindent"
441
+ version = "0.2.3"
442
+ source = "registry+https://github.com/rust-lang/crates.io-index"
443
+ checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce"
444
+
445
+ [[package]]
446
+ name = "ureq"
447
+ version = "2.10.1"
448
+ source = "registry+https://github.com/rust-lang/crates.io-index"
449
+ checksum = "b74fc6b57825be3373f7054754755f03ac3a8f5d70015ccad699ba2029956f4a"
450
+ dependencies = [
451
+ "base64",
452
+ "flate2",
453
+ "log",
454
+ "once_cell",
455
+ "serde",
456
+ "serde_json",
457
+ "url",
458
+ ]
459
+
460
+ [[package]]
461
+ name = "url"
462
+ version = "2.5.2"
463
+ source = "registry+https://github.com/rust-lang/crates.io-index"
464
+ checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c"
465
+ dependencies = [
466
+ "form_urlencoded",
467
+ "idna",
468
+ "percent-encoding",
469
+ ]
@@ -0,0 +1,14 @@
1
+ [package]
2
+ name = "python-gamedig"
3
+ version = "0.1.0"
4
+ edition = "2021"
5
+
6
+ # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7
+ [lib]
8
+ name = "gamedig"
9
+ crate-type = ["cdylib"]
10
+
11
+ [dependencies]
12
+ gamedig = { version = "0.5.1", features = ["serde"] }
13
+ pyo3 = "0.22.0"
14
+ serde-pyobject = "0.4.0"
gamedig-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,32 @@
1
+ Metadata-Version: 2.3
2
+ Name: gamedig
3
+ Version: 0.1.0
4
+ Classifier: Programming Language :: Rust
5
+ Classifier: Programming Language :: Python :: Implementation :: CPython
6
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
7
+ Requires-Python: >=3.8
8
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
9
+
10
+ # python-gamedig
11
+
12
+ Unofficial high-level Python bindings for the Rust [gamedig](https://crates.io/crates/gamedig) crate.
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ pip install gamedig
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ```python
23
+ from socket import gethostbyname
24
+ from gamedig import query
25
+
26
+ ip_address = gethostbyname('minecraftonline.com')
27
+
28
+ response = query('minecraft', ip_address)
29
+
30
+ print(response)
31
+ ```
32
+
@@ -0,0 +1,22 @@
1
+ # python-gamedig
2
+
3
+ Unofficial high-level Python bindings for the Rust [gamedig](https://crates.io/crates/gamedig) crate.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install gamedig
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```python
14
+ from socket import gethostbyname
15
+ from gamedig import query
16
+
17
+ ip_address = gethostbyname('minecraftonline.com')
18
+
19
+ response = query('minecraft', ip_address)
20
+
21
+ print(response)
22
+ ```
@@ -0,0 +1,21 @@
1
+ from typing import Any, Dict, Optional
2
+
3
+ def query(game_id: str, address: str, port: Optional[int] = None) -> Dict[str, Any]: ...
4
+
5
+ class GameDigError(Exception): ...
6
+ class PacketOverflowError(GameDigError): ...
7
+ class PacketUnderflowError(GameDigError): ...
8
+ class PacketBadError(GameDigError): ...
9
+ class PacketSendError(GameDigError): ...
10
+ class PacketReceiveError(GameDigError): ...
11
+ class DigDecompressError(GameDigError): ...
12
+ class DigSocketConnectError(GameDigError): ...
13
+ class SocketBindError(GameDigError): ...
14
+ class InvalidInputError(GameDigError): ...
15
+ class BadGameError(GameDigError): ...
16
+ class AutoQueryError(GameDigError): ...
17
+ class ProtocolFormatError(GameDigError): ...
18
+ class UnknownEnumCastError(GameDigError): ...
19
+ class JsonParseError(GameDigError): ...
20
+ class TypeParseError(GameDigError): ...
21
+ class HostLookupError(GameDigError): ...
@@ -0,0 +1,21 @@
1
+ [project]
2
+ name = "gamedig"
3
+ requires-python = ">=3.8"
4
+ classifiers = [
5
+ "Programming Language :: Rust",
6
+ "Programming Language :: Python :: Implementation :: CPython",
7
+ "Programming Language :: Python :: Implementation :: PyPy",
8
+ ]
9
+ dynamic = ["version"]
10
+
11
+ [build-system]
12
+ requires = ["maturin>=1.7,<2.0"]
13
+ build-backend = "maturin"
14
+
15
+ [tool.maturin]
16
+ features = ["pyo3/extension-module"]
17
+
18
+ [tool.uv]
19
+ dev-dependencies = [
20
+ "pytest>=8.3.3",
21
+ ]
@@ -0,0 +1,57 @@
1
+ use gamedig::{GDError, GDErrorKind};
2
+ use pyo3::{create_exception, exceptions::PyException, PyErr};
3
+
4
+ create_exception!(gamedig, GameDigError, PyException);
5
+ create_exception!(gamedig, PacketOverflowError, GameDigError);
6
+ create_exception!(gamedig, PacketUnderflowError, GameDigError);
7
+ create_exception!(gamedig, PacketBadError, GameDigError);
8
+ create_exception!(gamedig, PacketSendError, GameDigError);
9
+ create_exception!(gamedig, PacketReceiveError, GameDigError);
10
+ create_exception!(gamedig, DigDecompressError, GameDigError);
11
+ create_exception!(gamedig, DigSocketConnectError, GameDigError);
12
+ create_exception!(gamedig, SocketBindError, GameDigError);
13
+ create_exception!(gamedig, InvalidInputError, GameDigError);
14
+ create_exception!(gamedig, BadGameError, GameDigError);
15
+ create_exception!(gamedig, AutoQueryError, GameDigError);
16
+ create_exception!(gamedig, ProtocolFormatError, GameDigError);
17
+ create_exception!(gamedig, UnknownEnumCastError, GameDigError);
18
+ create_exception!(gamedig, JsonParseError, GameDigError);
19
+ create_exception!(gamedig, TypeParseError, GameDigError);
20
+ create_exception!(gamedig, HostLookupError, GameDigError);
21
+
22
+ pub fn gd_error_to_py_err(err: GDError) -> PyErr {
23
+ match err.kind {
24
+ GDErrorKind::PacketOverflow => {
25
+ PacketOverflowError::new_err("The received packet was bigger than the buffer size.")
26
+ }
27
+ GDErrorKind::PacketUnderflow => {
28
+ PacketUnderflowError::new_err("The received packet was shorter than the expected one.")
29
+ }
30
+ GDErrorKind::PacketBad => {
31
+ PacketBadError::new_err("The received packet is badly formatted.")
32
+ }
33
+ GDErrorKind::PacketSend => PacketSendError::new_err("Couldn't send the packet."),
34
+ GDErrorKind::PacketReceive => PacketReceiveError::new_err("Couldn't receive data."),
35
+ GDErrorKind::Decompress => DigDecompressError::new_err("Couldn't decompress data."),
36
+ GDErrorKind::SocketConnect => {
37
+ DigSocketConnectError::new_err("Couldn't create a socket connection.")
38
+ }
39
+ GDErrorKind::SocketBind => SocketBindError::new_err("Couldn't bind a socket."),
40
+ GDErrorKind::InvalidInput => InvalidInputError::new_err("Invalid input to the library."),
41
+ GDErrorKind::BadGame => BadGameError::new_err(
42
+ "The server response indicated that it is a different game than the game queried.",
43
+ ),
44
+ GDErrorKind::AutoQuery => {
45
+ AutoQueryError::new_err("None of the attempted protocols were successful.")
46
+ }
47
+ GDErrorKind::ProtocolFormat => {
48
+ ProtocolFormatError::new_err("A protocol-defined expected format was not met.")
49
+ }
50
+ GDErrorKind::UnknownEnumCast => {
51
+ UnknownEnumCastError::new_err("Couldn't cast a value to an enum.")
52
+ }
53
+ GDErrorKind::JsonParse => JsonParseError::new_err("Couldn't parse a json string."),
54
+ GDErrorKind::TypeParse => TypeParseError::new_err("Couldn't parse a value."),
55
+ GDErrorKind::HostLookup => HostLookupError::new_err("Couldn't find the host specified."),
56
+ }
57
+ }
@@ -0,0 +1,61 @@
1
+ mod errors;
2
+ mod query;
3
+
4
+ use crate::errors::*;
5
+ use pyo3::prelude::*;
6
+
7
+ #[pymodule]
8
+ fn gamedig(m: &Bound<'_, PyModule>) -> PyResult<()> {
9
+ m.add("GameDigError", m.py().get_type_bound::<GameDigError>())?;
10
+ m.add(
11
+ "PacketOverflowError",
12
+ m.py().get_type_bound::<PacketOverflowError>(),
13
+ )?;
14
+ m.add(
15
+ "PacketUnderflowError",
16
+ m.py().get_type_bound::<PacketUnderflowError>(),
17
+ )?;
18
+ m.add("PacketBadError", m.py().get_type_bound::<PacketBadError>())?;
19
+ m.add(
20
+ "PacketSendError",
21
+ m.py().get_type_bound::<PacketSendError>(),
22
+ )?;
23
+ m.add(
24
+ "PacketReceiveError",
25
+ m.py().get_type_bound::<PacketReceiveError>(),
26
+ )?;
27
+ m.add(
28
+ "DigDecompressError",
29
+ m.py().get_type_bound::<DigDecompressError>(),
30
+ )?;
31
+ m.add(
32
+ "DigSocketConnectError",
33
+ m.py().get_type_bound::<DigSocketConnectError>(),
34
+ )?;
35
+ m.add(
36
+ "SocketBindError",
37
+ m.py().get_type_bound::<SocketBindError>(),
38
+ )?;
39
+ m.add(
40
+ "InvalidInputError",
41
+ m.py().get_type_bound::<InvalidInputError>(),
42
+ )?;
43
+ m.add("BadGameError", m.py().get_type_bound::<BadGameError>())?;
44
+ m.add("AutoQueryError", m.py().get_type_bound::<AutoQueryError>())?;
45
+ m.add(
46
+ "ProtocolFormatError",
47
+ m.py().get_type_bound::<ProtocolFormatError>(),
48
+ )?;
49
+ m.add(
50
+ "UnknownEnumCastError",
51
+ m.py().get_type_bound::<UnknownEnumCastError>(),
52
+ )?;
53
+ m.add("JsonParseError", m.py().get_type_bound::<JsonParseError>())?;
54
+ m.add("TypeParseError", m.py().get_type_bound::<TypeParseError>())?;
55
+ m.add(
56
+ "HostLookupError",
57
+ m.py().get_type_bound::<HostLookupError>(),
58
+ )?;
59
+ m.add_function(wrap_pyfunction!(crate::query::query, m)?)?;
60
+ Ok(())
61
+ }
@@ -0,0 +1,27 @@
1
+ use crate::errors::*;
2
+ use gamedig as rust_gamedig;
3
+ use pyo3::{exceptions::PyValueError, prelude::*};
4
+ use serde_pyobject::to_pyobject;
5
+
6
+ #[pyfunction]
7
+ #[pyo3(signature = (game_id, address, port=None))]
8
+ pub fn query(py: Python, game_id: &str, address: &str, port: Option<u16>) -> PyResult<PyObject> {
9
+ let game = match rust_gamedig::GAMES.get(game_id) {
10
+ None => return Err(PyValueError::new_err(format!("Unknown game id: {game_id}"))),
11
+ Some(game) => game,
12
+ };
13
+
14
+ let parsed_address = match address.parse() {
15
+ Err(err) => return Err(PyValueError::new_err(format!("{err}"))),
16
+ Ok(parsed_address) => parsed_address,
17
+ };
18
+
19
+ match rust_gamedig::query(game, &parsed_address, port) {
20
+ Err(err) => return Err(gd_error_to_py_err(err)),
21
+ Ok(response) => {
22
+ let response_json = response.as_json();
23
+ let py_response = to_pyobject(py, &response_json).unwrap();
24
+ Ok(py_response.into_py(py))
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,24 @@
1
+ import gamedig
2
+ import pytest
3
+
4
+
5
+ @pytest.mark.parametrize("invalid_game_id", ["", "not-a-game-id"])
6
+ def test_query_raises_for_invalid_game_ids(invalid_game_id):
7
+ with pytest.raises(ValueError, match=f"Unknown game id: {invalid_game_id}"):
8
+ gamedig.query(invalid_game_id, "127.0.0.1")
9
+
10
+
11
+ @pytest.mark.parametrize("invalid_address", ["", "not-an-ip-address"])
12
+ def test_query_raises_for_invalid_addresses(invalid_address):
13
+ with pytest.raises(ValueError, match="invalid IP address syntax"):
14
+ gamedig.query("minecraft", invalid_address)
15
+
16
+
17
+ def test_query_raises_for_auto_query_errors():
18
+ with pytest.raises(gamedig.AutoQueryError):
19
+ gamedig.query("minecraft", "127.0.0.1")
20
+
21
+
22
+ def test_query_raises_for_packet_errors():
23
+ with pytest.raises(gamedig.PacketReceiveError):
24
+ gamedig.query("csgo", "127.0.0.1")
gamedig-0.1.0/uv.lock ADDED
@@ -0,0 +1,88 @@
1
+ version = 1
2
+ requires-python = ">=3.8"
3
+
4
+ [[package]]
5
+ name = "colorama"
6
+ version = "0.4.6"
7
+ source = { registry = "https://pypi.org/simple" }
8
+ sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697 }
9
+ wheels = [
10
+ { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335 },
11
+ ]
12
+
13
+ [[package]]
14
+ name = "exceptiongroup"
15
+ version = "1.2.2"
16
+ source = { registry = "https://pypi.org/simple" }
17
+ sdist = { url = "https://files.pythonhosted.org/packages/09/35/2495c4ac46b980e4ca1f6ad6db102322ef3ad2410b79fdde159a4b0f3b92/exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc", size = 28883 }
18
+ wheels = [
19
+ { url = "https://files.pythonhosted.org/packages/02/cc/b7e31358aac6ed1ef2bb790a9746ac2c69bcb3c8588b41616914eb106eaf/exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b", size = 16453 },
20
+ ]
21
+
22
+ [[package]]
23
+ name = "gamedig"
24
+ version = "0.1.0"
25
+ source = { editable = "." }
26
+
27
+ [package.dev-dependencies]
28
+ dev = [
29
+ { name = "pytest" },
30
+ ]
31
+
32
+ [package.metadata]
33
+
34
+ [package.metadata.requires-dev]
35
+ dev = [{ name = "pytest", specifier = ">=8.3.3" }]
36
+
37
+ [[package]]
38
+ name = "iniconfig"
39
+ version = "2.0.0"
40
+ source = { registry = "https://pypi.org/simple" }
41
+ sdist = { url = "https://files.pythonhosted.org/packages/d7/4b/cbd8e699e64a6f16ca3a8220661b5f83792b3017d0f79807cb8708d33913/iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3", size = 4646 }
42
+ wheels = [
43
+ { url = "https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374", size = 5892 },
44
+ ]
45
+
46
+ [[package]]
47
+ name = "packaging"
48
+ version = "24.1"
49
+ source = { registry = "https://pypi.org/simple" }
50
+ sdist = { url = "https://files.pythonhosted.org/packages/51/65/50db4dda066951078f0a96cf12f4b9ada6e4b811516bf0262c0f4f7064d4/packaging-24.1.tar.gz", hash = "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002", size = 148788 }
51
+ wheels = [
52
+ { url = "https://files.pythonhosted.org/packages/08/aa/cc0199a5f0ad350994d660967a8efb233fe0416e4639146c089643407ce6/packaging-24.1-py3-none-any.whl", hash = "sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124", size = 53985 },
53
+ ]
54
+
55
+ [[package]]
56
+ name = "pluggy"
57
+ version = "1.5.0"
58
+ source = { registry = "https://pypi.org/simple" }
59
+ sdist = { url = "https://files.pythonhosted.org/packages/96/2d/02d4312c973c6050a18b314a5ad0b3210edb65a906f868e31c111dede4a6/pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1", size = 67955 }
60
+ wheels = [
61
+ { url = "https://files.pythonhosted.org/packages/88/5f/e351af9a41f866ac3f1fac4ca0613908d9a41741cfcf2228f4ad853b697d/pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669", size = 20556 },
62
+ ]
63
+
64
+ [[package]]
65
+ name = "pytest"
66
+ version = "8.3.3"
67
+ source = { registry = "https://pypi.org/simple" }
68
+ dependencies = [
69
+ { name = "colorama", marker = "sys_platform == 'win32'" },
70
+ { name = "exceptiongroup", marker = "python_full_version < '3.11'" },
71
+ { name = "iniconfig" },
72
+ { name = "packaging" },
73
+ { name = "pluggy" },
74
+ { name = "tomli", marker = "python_full_version < '3.11'" },
75
+ ]
76
+ sdist = { url = "https://files.pythonhosted.org/packages/8b/6c/62bbd536103af674e227c41a8f3dcd022d591f6eed5facb5a0f31ee33bbc/pytest-8.3.3.tar.gz", hash = "sha256:70b98107bd648308a7952b06e6ca9a50bc660be218d53c257cc1fc94fda10181", size = 1442487 }
77
+ wheels = [
78
+ { url = "https://files.pythonhosted.org/packages/6b/77/7440a06a8ead44c7757a64362dd22df5760f9b12dc5f11b6188cd2fc27a0/pytest-8.3.3-py3-none-any.whl", hash = "sha256:a6853c7375b2663155079443d2e45de913a911a11d669df02a50814944db57b2", size = 342341 },
79
+ ]
80
+
81
+ [[package]]
82
+ name = "tomli"
83
+ version = "2.0.2"
84
+ source = { registry = "https://pypi.org/simple" }
85
+ sdist = { url = "https://files.pythonhosted.org/packages/35/b9/de2a5c0144d7d75a57ff355c0c24054f965b2dc3036456ae03a51ea6264b/tomli-2.0.2.tar.gz", hash = "sha256:d46d457a85337051c36524bc5349dd91b1877838e2979ac5ced3e710ed8a60ed", size = 16096 }
86
+ wheels = [
87
+ { url = "https://files.pythonhosted.org/packages/cf/db/ce8eda256fa131af12e0a76d481711abe4681b6923c27efb9a255c9e4594/tomli-2.0.2-py3-none-any.whl", hash = "sha256:2ebe24485c53d303f690b0ec092806a085f07af5a5aa1464f3931eec36caaa38", size = 13237 },
88
+ ]