rust-pgn-reader-python-binding 2.5.3__tar.gz → 3.0.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.
Files changed (18) hide show
  1. {rust_pgn_reader_python_binding-2.5.3 → rust_pgn_reader_python_binding-3.0.0}/Cargo.lock +203 -10
  2. {rust_pgn_reader_python_binding-2.5.3 → rust_pgn_reader_python_binding-3.0.0}/Cargo.toml +4 -2
  3. {rust_pgn_reader_python_binding-2.5.3 → rust_pgn_reader_python_binding-3.0.0}/PKG-INFO +7 -2
  4. {rust_pgn_reader_python_binding-2.5.3 → rust_pgn_reader_python_binding-3.0.0}/README.md +6 -1
  5. rust_pgn_reader_python_binding-3.0.0/src/bench_parquet_arrow.py +20 -0
  6. rust_pgn_reader_python_binding-3.0.0/src/comment_parsing.rs +466 -0
  7. {rust_pgn_reader_python_binding-2.5.3 → rust_pgn_reader_python_binding-3.0.0}/src/lib.rs +178 -24
  8. {rust_pgn_reader_python_binding-2.5.3 → rust_pgn_reader_python_binding-3.0.0}/src/test.py +152 -5
  9. rust_pgn_reader_python_binding-2.5.3/src/comment_parsing.rs +0 -250
  10. {rust_pgn_reader_python_binding-2.5.3 → rust_pgn_reader_python_binding-3.0.0}/.github/workflows/CI.yml +0 -0
  11. {rust_pgn_reader_python_binding-2.5.3 → rust_pgn_reader_python_binding-3.0.0}/.gitignore +0 -0
  12. {rust_pgn_reader_python_binding-2.5.3 → rust_pgn_reader_python_binding-3.0.0}/benches/parquet_bench.rs +0 -0
  13. {rust_pgn_reader_python_binding-2.5.3 → rust_pgn_reader_python_binding-3.0.0}/pyproject.toml +0 -0
  14. {rust_pgn_reader_python_binding-2.5.3 → rust_pgn_reader_python_binding-3.0.0}/src/bench.py +0 -0
  15. {rust_pgn_reader_python_binding-2.5.3 → rust_pgn_reader_python_binding-3.0.0}/src/bench_parquet.py +0 -0
  16. {rust_pgn_reader_python_binding-2.5.3 → rust_pgn_reader_python_binding-3.0.0}/src/bench_parquet_parallel.py +0 -0
  17. {rust_pgn_reader_python_binding-2.5.3 → rust_pgn_reader_python_binding-3.0.0}/src/example_rowgroup.py +0 -0
  18. {rust_pgn_reader_python_binding-2.5.3 → rust_pgn_reader_python_binding-3.0.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"
@@ -871,12 +906,6 @@ dependencies = [
871
906
  "autocfg",
872
907
  ]
873
908
 
874
- [[package]]
875
- name = "minimal-lexical"
876
- version = "0.2.1"
877
- source = "registry+https://github.com/rust-lang/crates.io-index"
878
- checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
879
-
880
909
  [[package]]
881
910
  name = "miniz_oxide"
882
911
  version = "0.8.8"
@@ -886,6 +915,21 @@ dependencies = [
886
915
  "adler2",
887
916
  ]
888
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
+
889
933
  [[package]]
890
934
  name = "nohash-hasher"
891
935
  version = "0.2.0"
@@ -894,12 +938,11 @@ checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451"
894
938
 
895
939
  [[package]]
896
940
  name = "nom"
897
- version = "7.1.3"
941
+ version = "8.0.0"
898
942
  source = "registry+https://github.com/rust-lang/crates.io-index"
899
- checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
943
+ checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405"
900
944
  dependencies = [
901
945
  "memchr",
902
- "minimal-lexical",
903
946
  ]
904
947
 
905
948
  [[package]]
@@ -986,6 +1029,23 @@ dependencies = [
986
1029
  "libc",
987
1030
  ]
988
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
+
989
1049
  [[package]]
990
1050
  name = "once_cell"
991
1051
  version = "1.21.3"
@@ -1040,6 +1100,15 @@ dependencies = [
1040
1100
  "zstd",
1041
1101
  ]
1042
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
+
1043
1112
  [[package]]
1044
1113
  name = "paste"
1045
1114
  version = "1.0.15"
@@ -1058,6 +1127,44 @@ dependencies = [
1058
1127
  "shakmaty",
1059
1128
  ]
1060
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
+
1061
1168
  [[package]]
1062
1169
  name = "pkg-config"
1063
1170
  version = "0.3.32"
@@ -1098,6 +1205,15 @@ version = "1.11.0"
1098
1205
  source = "registry+https://github.com/rust-lang/crates.io-index"
1099
1206
  checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e"
1100
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
+
1101
1217
  [[package]]
1102
1218
  name = "proc-macro2"
1103
1219
  version = "1.0.95"
@@ -1113,6 +1229,9 @@ version = "0.25.0"
1113
1229
  source = "registry+https://github.com/rust-lang/crates.io-index"
1114
1230
  checksum = "f239d656363bcee73afef85277f1b281e8ac6212a1d42aa90e55b90ed43c47a4"
1115
1231
  dependencies = [
1232
+ "chrono",
1233
+ "chrono-tz",
1234
+ "indexmap",
1116
1235
  "indoc",
1117
1236
  "libc",
1118
1237
  "memoffset",
@@ -1124,6 +1243,25 @@ dependencies = [
1124
1243
  "unindent",
1125
1244
  ]
1126
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
+
1127
1265
  [[package]]
1128
1266
  name = "pyo3-build-config"
1129
1267
  version = "0.25.0"
@@ -1184,6 +1322,27 @@ version = "5.2.0"
1184
1322
  source = "registry+https://github.com/rust-lang/crates.io-index"
1185
1323
  checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5"
1186
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
+
1187
1346
  [[package]]
1188
1347
  name = "rayon"
1189
1348
  version = "1.10.0"
@@ -1235,19 +1394,27 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
1235
1394
 
1236
1395
  [[package]]
1237
1396
  name = "rust_pgn_reader_python_binding"
1238
- version = "2.5.3"
1397
+ version = "3.0.0"
1239
1398
  dependencies = [
1240
1399
  "arrow",
1400
+ "arrow-array",
1241
1401
  "criterion",
1242
1402
  "nom",
1243
1403
  "num_cpus",
1244
1404
  "parquet",
1245
1405
  "pgn-reader",
1246
1406
  "pyo3",
1407
+ "pyo3-arrow",
1247
1408
  "rayon",
1248
1409
  "shakmaty",
1249
1410
  ]
1250
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
+
1251
1418
  [[package]]
1252
1419
  name = "rustc_version"
1253
1420
  version = "0.4.1"
@@ -1347,6 +1514,12 @@ version = "0.1.5"
1347
1514
  source = "registry+https://github.com/rust-lang/crates.io-index"
1348
1515
  checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e"
1349
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
+
1350
1523
  [[package]]
1351
1524
  name = "snap"
1352
1525
  version = "1.1.1"
@@ -1376,6 +1549,26 @@ version = "0.13.2"
1376
1549
  source = "registry+https://github.com/rust-lang/crates.io-index"
1377
1550
  checksum = "e502f78cdbb8ba4718f566c418c52bc729126ffd16baee5baa718cf25dd5a69a"
1378
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
+
1379
1572
  [[package]]
1380
1573
  name = "thrift"
1381
1574
  version = "0.17.0"
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "rust_pgn_reader_python_binding"
3
- version = "2.5.3"
3
+ version = "3.0.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
@@ -13,9 +13,11 @@ crate-type = ["lib", "cdylib"]
13
13
  pyo3 = "0.25.0"
14
14
  shakmaty = "0.27"
15
15
  pgn-reader = "0.26.0"
16
- nom = "7"
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: 2.5.3
3
+ Version: 3.0.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
  |----------------------------------------------------------------------------|-------------|--------|
@@ -25,6 +28,8 @@ Below are some benchmarks on Lichess's 2013-07 chess games (293,459 games).
25
28
 
26
29
  The main reason for rust_pgn_reader_python_binding being slower (at least in single threaded mode) than rust-pgn-reader is because of vector / string allocations (that show up as malloc's and free's in profiling).
27
30
 
31
+ To replicate, download `2013-07-train-00000-of-00001.parquet` and then run `python bench_parquet_parallel.py`
32
+
28
33
  ## Building
29
34
  `maturin develop`
30
35
  `maturin develop --release`
@@ -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
  |----------------------------------------------------------------------------|-------------|--------|
@@ -16,6 +19,8 @@ Below are some benchmarks on Lichess's 2013-07 chess games (293,459 games).
16
19
 
17
20
  The main reason for rust_pgn_reader_python_binding being slower (at least in single threaded mode) than rust-pgn-reader is because of vector / string allocations (that show up as malloc's and free's in profiling).
18
21
 
22
+ To replicate, download `2013-07-train-00000-of-00001.parquet` and then run `python bench_parquet_parallel.py`
23
+
19
24
  ## Building
20
25
  `maturin develop`
21
26
  `maturin develop --release`
@@ -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)