rust-pgn-reader-python-binding 2.5.5__tar.gz → 3.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.
- {rust_pgn_reader_python_binding-2.5.5 → rust_pgn_reader_python_binding-3.1.0}/Cargo.lock +201 -1
- {rust_pgn_reader_python_binding-2.5.5 → rust_pgn_reader_python_binding-3.1.0}/Cargo.toml +3 -1
- {rust_pgn_reader_python_binding-2.5.5 → rust_pgn_reader_python_binding-3.1.0}/PKG-INFO +15 -3
- {rust_pgn_reader_python_binding-2.5.5 → rust_pgn_reader_python_binding-3.1.0}/README.md +14 -2
- rust_pgn_reader_python_binding-3.1.0/src/bench_parquet_arrow.py +20 -0
- rust_pgn_reader_python_binding-3.1.0/src/comment_parsing.rs +466 -0
- rust_pgn_reader_python_binding-3.1.0/src/lib.rs +532 -0
- {rust_pgn_reader_python_binding-2.5.5 → rust_pgn_reader_python_binding-3.1.0}/src/test.py +152 -5
- rust_pgn_reader_python_binding-2.5.5/src/comment_parsing.rs +0 -256
- rust_pgn_reader_python_binding-2.5.5/src/lib.rs +0 -289
- {rust_pgn_reader_python_binding-2.5.5 → rust_pgn_reader_python_binding-3.1.0}/.github/workflows/CI.yml +0 -0
- {rust_pgn_reader_python_binding-2.5.5 → rust_pgn_reader_python_binding-3.1.0}/.gitignore +0 -0
- {rust_pgn_reader_python_binding-2.5.5 → rust_pgn_reader_python_binding-3.1.0}/benches/parquet_bench.rs +0 -0
- {rust_pgn_reader_python_binding-2.5.5 → rust_pgn_reader_python_binding-3.1.0}/pyproject.toml +0 -0
- {rust_pgn_reader_python_binding-2.5.5 → rust_pgn_reader_python_binding-3.1.0}/src/bench.py +0 -0
- {rust_pgn_reader_python_binding-2.5.5 → rust_pgn_reader_python_binding-3.1.0}/src/bench_parquet.py +0 -0
- {rust_pgn_reader_python_binding-2.5.5 → rust_pgn_reader_python_binding-3.1.0}/src/bench_parquet_parallel.py +0 -0
- {rust_pgn_reader_python_binding-2.5.5 → rust_pgn_reader_python_binding-3.1.0}/src/example_rowgroup.py +0 -0
- {rust_pgn_reader_python_binding-2.5.5 → rust_pgn_reader_python_binding-3.1.0}/src/example_str.py +0 -0
|
@@ -125,6 +125,7 @@ dependencies = [
|
|
|
125
125
|
"arrow-data",
|
|
126
126
|
"arrow-schema",
|
|
127
127
|
"chrono",
|
|
128
|
+
"chrono-tz",
|
|
128
129
|
"half",
|
|
129
130
|
"hashbrown",
|
|
130
131
|
"num",
|
|
@@ -255,6 +256,9 @@ name = "arrow-schema"
|
|
|
255
256
|
version = "55.1.0"
|
|
256
257
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
257
258
|
checksum = "73a47aa0c771b5381de2b7f16998d351a6f4eb839f1e13d48353e17e873d969b"
|
|
259
|
+
dependencies = [
|
|
260
|
+
"bitflags",
|
|
261
|
+
]
|
|
258
262
|
|
|
259
263
|
[[package]]
|
|
260
264
|
name = "arrow-select"
|
|
@@ -397,6 +401,27 @@ dependencies = [
|
|
|
397
401
|
"windows-link",
|
|
398
402
|
]
|
|
399
403
|
|
|
404
|
+
[[package]]
|
|
405
|
+
name = "chrono-tz"
|
|
406
|
+
version = "0.10.3"
|
|
407
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
408
|
+
checksum = "efdce149c370f133a071ca8ef6ea340b7b88748ab0810097a9e2976eaa34b4f3"
|
|
409
|
+
dependencies = [
|
|
410
|
+
"chrono",
|
|
411
|
+
"chrono-tz-build",
|
|
412
|
+
"phf",
|
|
413
|
+
]
|
|
414
|
+
|
|
415
|
+
[[package]]
|
|
416
|
+
name = "chrono-tz-build"
|
|
417
|
+
version = "0.4.1"
|
|
418
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
419
|
+
checksum = "8f10f8c9340e31fc120ff885fcdb54a0b48e474bbd77cab557f0c30a3e569402"
|
|
420
|
+
dependencies = [
|
|
421
|
+
"parse-zoneinfo",
|
|
422
|
+
"phf_codegen",
|
|
423
|
+
]
|
|
424
|
+
|
|
400
425
|
[[package]]
|
|
401
426
|
name = "ciborium"
|
|
402
427
|
version = "0.2.2"
|
|
@@ -856,6 +881,16 @@ dependencies = [
|
|
|
856
881
|
"twox-hash 1.6.3",
|
|
857
882
|
]
|
|
858
883
|
|
|
884
|
+
[[package]]
|
|
885
|
+
name = "matrixmultiply"
|
|
886
|
+
version = "0.3.10"
|
|
887
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
888
|
+
checksum = "a06de3016e9fae57a36fd14dba131fccf49f74b40b7fbdb472f96e361ec71a08"
|
|
889
|
+
dependencies = [
|
|
890
|
+
"autocfg",
|
|
891
|
+
"rawpointer",
|
|
892
|
+
]
|
|
893
|
+
|
|
859
894
|
[[package]]
|
|
860
895
|
name = "memchr"
|
|
861
896
|
version = "2.7.4"
|
|
@@ -880,6 +915,21 @@ dependencies = [
|
|
|
880
915
|
"adler2",
|
|
881
916
|
]
|
|
882
917
|
|
|
918
|
+
[[package]]
|
|
919
|
+
name = "ndarray"
|
|
920
|
+
version = "0.16.1"
|
|
921
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
922
|
+
checksum = "882ed72dce9365842bf196bdeedf5055305f11fc8c03dee7bb0194a6cad34841"
|
|
923
|
+
dependencies = [
|
|
924
|
+
"matrixmultiply",
|
|
925
|
+
"num-complex",
|
|
926
|
+
"num-integer",
|
|
927
|
+
"num-traits",
|
|
928
|
+
"portable-atomic",
|
|
929
|
+
"portable-atomic-util",
|
|
930
|
+
"rawpointer",
|
|
931
|
+
]
|
|
932
|
+
|
|
883
933
|
[[package]]
|
|
884
934
|
name = "nohash-hasher"
|
|
885
935
|
version = "0.2.0"
|
|
@@ -979,6 +1029,23 @@ dependencies = [
|
|
|
979
1029
|
"libc",
|
|
980
1030
|
]
|
|
981
1031
|
|
|
1032
|
+
[[package]]
|
|
1033
|
+
name = "numpy"
|
|
1034
|
+
version = "0.25.0"
|
|
1035
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1036
|
+
checksum = "29f1dee9aa8d3f6f8e8b9af3803006101bb3653866ef056d530d53ae68587191"
|
|
1037
|
+
dependencies = [
|
|
1038
|
+
"half",
|
|
1039
|
+
"libc",
|
|
1040
|
+
"ndarray",
|
|
1041
|
+
"num-complex",
|
|
1042
|
+
"num-integer",
|
|
1043
|
+
"num-traits",
|
|
1044
|
+
"pyo3",
|
|
1045
|
+
"pyo3-build-config",
|
|
1046
|
+
"rustc-hash",
|
|
1047
|
+
]
|
|
1048
|
+
|
|
982
1049
|
[[package]]
|
|
983
1050
|
name = "once_cell"
|
|
984
1051
|
version = "1.21.3"
|
|
@@ -1033,6 +1100,15 @@ dependencies = [
|
|
|
1033
1100
|
"zstd",
|
|
1034
1101
|
]
|
|
1035
1102
|
|
|
1103
|
+
[[package]]
|
|
1104
|
+
name = "parse-zoneinfo"
|
|
1105
|
+
version = "0.3.1"
|
|
1106
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1107
|
+
checksum = "1f2a05b18d44e2957b88f96ba460715e295bc1d7510468a2f3d3b44535d26c24"
|
|
1108
|
+
dependencies = [
|
|
1109
|
+
"regex",
|
|
1110
|
+
]
|
|
1111
|
+
|
|
1036
1112
|
[[package]]
|
|
1037
1113
|
name = "paste"
|
|
1038
1114
|
version = "1.0.15"
|
|
@@ -1051,6 +1127,44 @@ dependencies = [
|
|
|
1051
1127
|
"shakmaty",
|
|
1052
1128
|
]
|
|
1053
1129
|
|
|
1130
|
+
[[package]]
|
|
1131
|
+
name = "phf"
|
|
1132
|
+
version = "0.11.3"
|
|
1133
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1134
|
+
checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078"
|
|
1135
|
+
dependencies = [
|
|
1136
|
+
"phf_shared",
|
|
1137
|
+
]
|
|
1138
|
+
|
|
1139
|
+
[[package]]
|
|
1140
|
+
name = "phf_codegen"
|
|
1141
|
+
version = "0.11.3"
|
|
1142
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1143
|
+
checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a"
|
|
1144
|
+
dependencies = [
|
|
1145
|
+
"phf_generator",
|
|
1146
|
+
"phf_shared",
|
|
1147
|
+
]
|
|
1148
|
+
|
|
1149
|
+
[[package]]
|
|
1150
|
+
name = "phf_generator"
|
|
1151
|
+
version = "0.11.3"
|
|
1152
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1153
|
+
checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d"
|
|
1154
|
+
dependencies = [
|
|
1155
|
+
"phf_shared",
|
|
1156
|
+
"rand",
|
|
1157
|
+
]
|
|
1158
|
+
|
|
1159
|
+
[[package]]
|
|
1160
|
+
name = "phf_shared"
|
|
1161
|
+
version = "0.11.3"
|
|
1162
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1163
|
+
checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5"
|
|
1164
|
+
dependencies = [
|
|
1165
|
+
"siphasher",
|
|
1166
|
+
]
|
|
1167
|
+
|
|
1054
1168
|
[[package]]
|
|
1055
1169
|
name = "pkg-config"
|
|
1056
1170
|
version = "0.3.32"
|
|
@@ -1091,6 +1205,15 @@ version = "1.11.0"
|
|
|
1091
1205
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1092
1206
|
checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e"
|
|
1093
1207
|
|
|
1208
|
+
[[package]]
|
|
1209
|
+
name = "portable-atomic-util"
|
|
1210
|
+
version = "0.2.4"
|
|
1211
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1212
|
+
checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507"
|
|
1213
|
+
dependencies = [
|
|
1214
|
+
"portable-atomic",
|
|
1215
|
+
]
|
|
1216
|
+
|
|
1094
1217
|
[[package]]
|
|
1095
1218
|
name = "proc-macro2"
|
|
1096
1219
|
version = "1.0.95"
|
|
@@ -1106,6 +1229,9 @@ version = "0.25.0"
|
|
|
1106
1229
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1107
1230
|
checksum = "f239d656363bcee73afef85277f1b281e8ac6212a1d42aa90e55b90ed43c47a4"
|
|
1108
1231
|
dependencies = [
|
|
1232
|
+
"chrono",
|
|
1233
|
+
"chrono-tz",
|
|
1234
|
+
"indexmap",
|
|
1109
1235
|
"indoc",
|
|
1110
1236
|
"libc",
|
|
1111
1237
|
"memoffset",
|
|
@@ -1117,6 +1243,25 @@ dependencies = [
|
|
|
1117
1243
|
"unindent",
|
|
1118
1244
|
]
|
|
1119
1245
|
|
|
1246
|
+
[[package]]
|
|
1247
|
+
name = "pyo3-arrow"
|
|
1248
|
+
version = "0.10.1"
|
|
1249
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1250
|
+
checksum = "5251087eef2b22de114aa731c1175f59a2e9bdbe6f32cf4e926f7a151fc8b012"
|
|
1251
|
+
dependencies = [
|
|
1252
|
+
"arrow-array",
|
|
1253
|
+
"arrow-buffer",
|
|
1254
|
+
"arrow-cast",
|
|
1255
|
+
"arrow-data",
|
|
1256
|
+
"arrow-schema",
|
|
1257
|
+
"arrow-select",
|
|
1258
|
+
"half",
|
|
1259
|
+
"indexmap",
|
|
1260
|
+
"numpy",
|
|
1261
|
+
"pyo3",
|
|
1262
|
+
"thiserror",
|
|
1263
|
+
]
|
|
1264
|
+
|
|
1120
1265
|
[[package]]
|
|
1121
1266
|
name = "pyo3-build-config"
|
|
1122
1267
|
version = "0.25.0"
|
|
@@ -1177,6 +1322,27 @@ version = "5.2.0"
|
|
|
1177
1322
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1178
1323
|
checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5"
|
|
1179
1324
|
|
|
1325
|
+
[[package]]
|
|
1326
|
+
name = "rand"
|
|
1327
|
+
version = "0.8.5"
|
|
1328
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1329
|
+
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
|
1330
|
+
dependencies = [
|
|
1331
|
+
"rand_core",
|
|
1332
|
+
]
|
|
1333
|
+
|
|
1334
|
+
[[package]]
|
|
1335
|
+
name = "rand_core"
|
|
1336
|
+
version = "0.6.4"
|
|
1337
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1338
|
+
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
|
1339
|
+
|
|
1340
|
+
[[package]]
|
|
1341
|
+
name = "rawpointer"
|
|
1342
|
+
version = "0.2.1"
|
|
1343
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1344
|
+
checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
|
|
1345
|
+
|
|
1180
1346
|
[[package]]
|
|
1181
1347
|
name = "rayon"
|
|
1182
1348
|
version = "1.10.0"
|
|
@@ -1228,19 +1394,27 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
|
|
|
1228
1394
|
|
|
1229
1395
|
[[package]]
|
|
1230
1396
|
name = "rust_pgn_reader_python_binding"
|
|
1231
|
-
version = "
|
|
1397
|
+
version = "3.1.0"
|
|
1232
1398
|
dependencies = [
|
|
1233
1399
|
"arrow",
|
|
1400
|
+
"arrow-array",
|
|
1234
1401
|
"criterion",
|
|
1235
1402
|
"nom",
|
|
1236
1403
|
"num_cpus",
|
|
1237
1404
|
"parquet",
|
|
1238
1405
|
"pgn-reader",
|
|
1239
1406
|
"pyo3",
|
|
1407
|
+
"pyo3-arrow",
|
|
1240
1408
|
"rayon",
|
|
1241
1409
|
"shakmaty",
|
|
1242
1410
|
]
|
|
1243
1411
|
|
|
1412
|
+
[[package]]
|
|
1413
|
+
name = "rustc-hash"
|
|
1414
|
+
version = "2.1.1"
|
|
1415
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1416
|
+
checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
|
|
1417
|
+
|
|
1244
1418
|
[[package]]
|
|
1245
1419
|
name = "rustc_version"
|
|
1246
1420
|
version = "0.4.1"
|
|
@@ -1340,6 +1514,12 @@ version = "0.1.5"
|
|
|
1340
1514
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1341
1515
|
checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e"
|
|
1342
1516
|
|
|
1517
|
+
[[package]]
|
|
1518
|
+
name = "siphasher"
|
|
1519
|
+
version = "1.0.1"
|
|
1520
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1521
|
+
checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d"
|
|
1522
|
+
|
|
1343
1523
|
[[package]]
|
|
1344
1524
|
name = "snap"
|
|
1345
1525
|
version = "1.1.1"
|
|
@@ -1369,6 +1549,26 @@ version = "0.13.2"
|
|
|
1369
1549
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1370
1550
|
checksum = "e502f78cdbb8ba4718f566c418c52bc729126ffd16baee5baa718cf25dd5a69a"
|
|
1371
1551
|
|
|
1552
|
+
[[package]]
|
|
1553
|
+
name = "thiserror"
|
|
1554
|
+
version = "1.0.69"
|
|
1555
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1556
|
+
checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
|
|
1557
|
+
dependencies = [
|
|
1558
|
+
"thiserror-impl",
|
|
1559
|
+
]
|
|
1560
|
+
|
|
1561
|
+
[[package]]
|
|
1562
|
+
name = "thiserror-impl"
|
|
1563
|
+
version = "1.0.69"
|
|
1564
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1565
|
+
checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
|
|
1566
|
+
dependencies = [
|
|
1567
|
+
"proc-macro2",
|
|
1568
|
+
"quote",
|
|
1569
|
+
"syn",
|
|
1570
|
+
]
|
|
1571
|
+
|
|
1372
1572
|
[[package]]
|
|
1373
1573
|
name = "thrift"
|
|
1374
1574
|
version = "0.17.0"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "rust_pgn_reader_python_binding"
|
|
3
|
-
version = "
|
|
3
|
+
version = "3.1.0"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
|
|
6
6
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
@@ -16,6 +16,8 @@ pgn-reader = "0.26.0"
|
|
|
16
16
|
nom = "8.0"
|
|
17
17
|
rayon = "1.10"
|
|
18
18
|
num_cpus = "1.17"
|
|
19
|
+
arrow-array = "55"
|
|
20
|
+
pyo3-arrow = "0.10"
|
|
19
21
|
|
|
20
22
|
[dev-dependencies]
|
|
21
23
|
criterion = "0.6"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rust_pgn_reader_python_binding
|
|
3
|
-
Version:
|
|
3
|
+
Version: 3.1.0
|
|
4
4
|
Classifier: Programming Language :: Rust
|
|
5
5
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
6
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
@@ -11,8 +11,11 @@ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
|
11
11
|
## Fast PGN parsing bindings for Python
|
|
12
12
|
This project adds Python bindings to [rust-pgn-reader](https://github.com/niklasf/rust-pgn-reader). In addition, it also parses and extracts [%clk ..] and [%eval ..] tags from comments.
|
|
13
13
|
|
|
14
|
+
## Installing
|
|
15
|
+
`pip install rust_pgn_reader_python_binding`
|
|
16
|
+
|
|
14
17
|
## Benchmarks
|
|
15
|
-
Below are some benchmarks on Lichess's 2013-07 chess games (293,459 games).
|
|
18
|
+
Below are some benchmarks on Lichess's 2013-07 chess games (293,459 games) on an 7800X3D.
|
|
16
19
|
|
|
17
20
|
| Parser | File format | Time |
|
|
18
21
|
|----------------------------------------------------------------------------|-------------|--------|
|
|
@@ -20,13 +23,21 @@ Below are some benchmarks on Lichess's 2013-07 chess games (293,459 games).
|
|
|
20
23
|
| rust_pgn_reader_python_binding | PGN | 4.7s |
|
|
21
24
|
| rust_pgn_reader_python_binding, parse_game (single_threaded) | parquet | 3.3s |
|
|
22
25
|
| rust_pgn_reader_python_binding, parse_games (multithreaded) | parquet | 0.5s |
|
|
26
|
+
| rust_pgn_reader_python_binding, parse_game_moves_arrow_chunked_array (multithreaded) | parquet | 0.35s |
|
|
23
27
|
| [chess-library](https://github.com/Disservin/chess-library) | PGN | 2s |
|
|
24
28
|
| [python-chess](https://github.com/niklasf/python-chess) | PGN | 3+ min |
|
|
25
29
|
|
|
26
|
-
|
|
30
|
+
To replicate, download `2013-07-train-00000-of-00001.parquet` and then run:
|
|
31
|
+
|
|
32
|
+
`python bench_parquet.py` (single-threaded parse_game)
|
|
33
|
+
|
|
34
|
+
`python bench_parquet_parallel.py` (multithreaded parse_games)
|
|
35
|
+
|
|
36
|
+
`python bench_parquet_arrow.py` (multithreaded parse_game_moves_arrow_chunked_array)
|
|
27
37
|
|
|
28
38
|
## Building
|
|
29
39
|
`maturin develop`
|
|
40
|
+
|
|
30
41
|
`maturin develop --release`
|
|
31
42
|
|
|
32
43
|
For a more thorough tutorial, follow https://lukesalamone.github.io/posts/how-to-create-rust-python-bindings/
|
|
@@ -39,4 +50,5 @@ Linux/WSL-only:
|
|
|
39
50
|
|
|
40
51
|
## Testing
|
|
41
52
|
`cargo test`
|
|
53
|
+
|
|
42
54
|
`python -m unittest src/test.py`
|
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
## Fast PGN parsing bindings for Python
|
|
3
3
|
This project adds Python bindings to [rust-pgn-reader](https://github.com/niklasf/rust-pgn-reader). In addition, it also parses and extracts [%clk ..] and [%eval ..] tags from comments.
|
|
4
4
|
|
|
5
|
+
## Installing
|
|
6
|
+
`pip install rust_pgn_reader_python_binding`
|
|
7
|
+
|
|
5
8
|
## Benchmarks
|
|
6
|
-
Below are some benchmarks on Lichess's 2013-07 chess games (293,459 games).
|
|
9
|
+
Below are some benchmarks on Lichess's 2013-07 chess games (293,459 games) on an 7800X3D.
|
|
7
10
|
|
|
8
11
|
| Parser | File format | Time |
|
|
9
12
|
|----------------------------------------------------------------------------|-------------|--------|
|
|
@@ -11,13 +14,21 @@ Below are some benchmarks on Lichess's 2013-07 chess games (293,459 games).
|
|
|
11
14
|
| rust_pgn_reader_python_binding | PGN | 4.7s |
|
|
12
15
|
| rust_pgn_reader_python_binding, parse_game (single_threaded) | parquet | 3.3s |
|
|
13
16
|
| rust_pgn_reader_python_binding, parse_games (multithreaded) | parquet | 0.5s |
|
|
17
|
+
| rust_pgn_reader_python_binding, parse_game_moves_arrow_chunked_array (multithreaded) | parquet | 0.35s |
|
|
14
18
|
| [chess-library](https://github.com/Disservin/chess-library) | PGN | 2s |
|
|
15
19
|
| [python-chess](https://github.com/niklasf/python-chess) | PGN | 3+ min |
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
To replicate, download `2013-07-train-00000-of-00001.parquet` and then run:
|
|
22
|
+
|
|
23
|
+
`python bench_parquet.py` (single-threaded parse_game)
|
|
24
|
+
|
|
25
|
+
`python bench_parquet_parallel.py` (multithreaded parse_games)
|
|
26
|
+
|
|
27
|
+
`python bench_parquet_arrow.py` (multithreaded parse_game_moves_arrow_chunked_array)
|
|
18
28
|
|
|
19
29
|
## Building
|
|
20
30
|
`maturin develop`
|
|
31
|
+
|
|
21
32
|
`maturin develop --release`
|
|
22
33
|
|
|
23
34
|
For a more thorough tutorial, follow https://lukesalamone.github.io/posts/how-to-create-rust-python-bindings/
|
|
@@ -30,4 +41,5 @@ Linux/WSL-only:
|
|
|
30
41
|
|
|
31
42
|
## Testing
|
|
32
43
|
`cargo test`
|
|
44
|
+
|
|
33
45
|
`python -m unittest src/test.py`
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import rust_pgn_reader_python_binding
|
|
2
|
+
import pyarrow.parquet as pq
|
|
3
|
+
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
|
|
6
|
+
file_path = "2013-07-train-00000-of-00001.parquet"
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
pf = pq.ParquetFile(file_path)
|
|
10
|
+
|
|
11
|
+
movetext_arrow_array = pf.read(columns=["movetext"]).column("movetext")
|
|
12
|
+
|
|
13
|
+
a = datetime.now()
|
|
14
|
+
|
|
15
|
+
extractors = rust_pgn_reader_python_binding.parse_game_moves_arrow_chunked_array(
|
|
16
|
+
movetext_arrow_array
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
b = datetime.now()
|
|
20
|
+
print(b - a)
|