sanqi-python 0.1.0__tar.gz → 0.1.1__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.
@@ -10,9 +10,9 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
10
10
 
11
11
  [[package]]
12
12
  name = "libc"
13
- version = "0.2.184"
13
+ version = "0.2.191"
14
14
  source = "registry+https://github.com/rust-lang/crates.io-index"
15
- checksum = "48f5d2a454e16a5ea0f4ced81bd44e4cfc7bd3a507b61887c99fd3538b28e4af"
15
+ checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
16
16
 
17
17
  [[package]]
18
18
  name = "once_cell"
@@ -22,24 +22,24 @@ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
22
22
 
23
23
  [[package]]
24
24
  name = "portable-atomic"
25
- version = "1.13.1"
25
+ version = "1.15.0"
26
26
  source = "registry+https://github.com/rust-lang/crates.io-index"
27
- checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
27
+ checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
28
28
 
29
29
  [[package]]
30
30
  name = "proc-macro2"
31
- version = "1.0.106"
31
+ version = "1.0.107"
32
32
  source = "registry+https://github.com/rust-lang/crates.io-index"
33
- checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
33
+ checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
34
34
  dependencies = [
35
35
  "unicode-ident",
36
36
  ]
37
37
 
38
38
  [[package]]
39
39
  name = "pyo3"
40
- version = "0.28.3"
40
+ version = "0.30.1"
41
41
  source = "registry+https://github.com/rust-lang/crates.io-index"
42
- checksum = "91fd8e38a3b50ed1167fb981cd6fd60147e091784c427b8f7183a7ee32c31c12"
42
+ checksum = "229ca13b8a15bb0d1487b81ab975bfcd97513416499a8312011b6036e42e0de4"
43
43
  dependencies = [
44
44
  "libc",
45
45
  "once_cell",
@@ -51,18 +51,18 @@ dependencies = [
51
51
 
52
52
  [[package]]
53
53
  name = "pyo3-build-config"
54
- version = "0.28.3"
54
+ version = "0.30.1"
55
55
  source = "registry+https://github.com/rust-lang/crates.io-index"
56
- checksum = "e368e7ddfdeb98c9bca7f8383be1648fd84ab466bf2bc015e94008db6d35611e"
56
+ checksum = "70130e2b6dd1ee589a8788026a429561ca5c40fa7a2fa7914c2282eddae24700"
57
57
  dependencies = [
58
58
  "target-lexicon",
59
59
  ]
60
60
 
61
61
  [[package]]
62
62
  name = "pyo3-ffi"
63
- version = "0.28.3"
63
+ version = "0.30.1"
64
64
  source = "registry+https://github.com/rust-lang/crates.io-index"
65
- checksum = "7f29e10af80b1f7ccaf7f69eace800a03ecd13e883acfacc1e5d0988605f651e"
65
+ checksum = "5e7ff73c555c286d212d4ce7e5fbda845a973c4f61bd5f160f5f2c3c2a04d1c4"
66
66
  dependencies = [
67
67
  "libc",
68
68
  "pyo3-build-config",
@@ -70,9 +70,9 @@ dependencies = [
70
70
 
71
71
  [[package]]
72
72
  name = "pyo3-macros"
73
- version = "0.28.3"
73
+ version = "0.30.1"
74
74
  source = "registry+https://github.com/rust-lang/crates.io-index"
75
- checksum = "df6e520eff47c45997d2fc7dd8214b25dd1310918bbb2642156ef66a67f29813"
75
+ checksum = "c46d2e5862c7bb8207e3b639f713dda3c499933444784154c11d013c5a691b60"
76
76
  dependencies = [
77
77
  "proc-macro2",
78
78
  "pyo3-macros-backend",
@@ -82,29 +82,28 @@ dependencies = [
82
82
 
83
83
  [[package]]
84
84
  name = "pyo3-macros-backend"
85
- version = "0.28.3"
85
+ version = "0.30.1"
86
86
  source = "registry+https://github.com/rust-lang/crates.io-index"
87
- checksum = "c4cdc218d835738f81c2338f822078af45b4afdf8b2e33cbb5916f108b813acb"
87
+ checksum = "38b89f066f2ae72a2aef52d1537ca2fcd104440ebfadee06e97aa90738a25b9b"
88
88
  dependencies = [
89
89
  "heck",
90
90
  "proc-macro2",
91
- "pyo3-build-config",
92
91
  "quote",
93
92
  "syn",
94
93
  ]
95
94
 
96
95
  [[package]]
97
96
  name = "quote"
98
- version = "1.0.45"
97
+ version = "1.0.47"
99
98
  source = "registry+https://github.com/rust-lang/crates.io-index"
100
- checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
99
+ checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
101
100
  dependencies = [
102
101
  "proc-macro2",
103
102
  ]
104
103
 
105
104
  [[package]]
106
105
  name = "sanqi-cli"
107
- version = "0.1.0"
106
+ version = "0.1.1"
108
107
  dependencies = [
109
108
  "sanqi-core",
110
109
  "sanqi-engine",
@@ -113,18 +112,18 @@ dependencies = [
113
112
 
114
113
  [[package]]
115
114
  name = "sanqi-core"
116
- version = "0.1.0"
115
+ version = "0.1.1"
117
116
 
118
117
  [[package]]
119
118
  name = "sanqi-engine"
120
- version = "0.1.0"
119
+ version = "0.1.1"
121
120
  dependencies = [
122
121
  "sanqi-core",
123
122
  ]
124
123
 
125
124
  [[package]]
126
125
  name = "sanqi-python"
127
- version = "0.1.0"
126
+ version = "0.1.1"
128
127
  dependencies = [
129
128
  "pyo3",
130
129
  "sanqi-core",
@@ -134,16 +133,16 @@ dependencies = [
134
133
 
135
134
  [[package]]
136
135
  name = "sanqi-render"
137
- version = "0.1.0"
136
+ version = "0.1.1"
138
137
  dependencies = [
139
138
  "sanqi-core",
140
139
  ]
141
140
 
142
141
  [[package]]
143
142
  name = "syn"
144
- version = "2.0.117"
143
+ version = "3.0.9"
145
144
  source = "registry+https://github.com/rust-lang/crates.io-index"
146
- checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
145
+ checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b"
147
146
  dependencies = [
148
147
  "proc-macro2",
149
148
  "quote",
@@ -158,6 +157,6 @@ checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
158
157
 
159
158
  [[package]]
160
159
  name = "unicode-ident"
161
- version = "1.0.24"
160
+ version = "1.0.27"
162
161
  source = "registry+https://github.com/rust-lang/crates.io-index"
163
- checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
162
+ checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
@@ -5,10 +5,10 @@ resolver = "2"
5
5
  [workspace.package]
6
6
  edition = "2024"
7
7
  license = "MIT"
8
- version = "0.1.0"
8
+ version = "0.1.1"
9
9
  repository = "https://github.com/curoli/sanqi"
10
10
  homepage = "https://github.com/curoli/sanqi"
11
- rust-version = "1.85"
11
+ rust-version = "1.88"
12
12
 
13
13
  [workspace.lints.clippy]
14
14
  dbg_macro = "deny"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sanqi-python
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Classifier: Development Status :: 3 - Alpha
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -10,6 +10,8 @@ Classifier: Programming Language :: Python :: 3.9
10
10
  Classifier: Programming Language :: Python :: 3.10
11
11
  Classifier: Programming Language :: Python :: 3.11
12
12
  Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Programming Language :: Python :: 3.14
13
15
  Classifier: Programming Language :: Rust
14
16
  Summary: Python bindings for the Sanqi Rust engine
15
17
  Keywords: sanqi,board game,game engine,rust
@@ -40,6 +42,13 @@ Or build a wheel:
40
42
  maturin build
41
43
  ```
42
44
 
45
+ To test the installed bindings:
46
+
47
+ ```bash
48
+ python -m pip install ../../target/wheels/sanqi_python-*.whl
49
+ python -m unittest discover -s tests
50
+ ```
51
+
43
52
  ## Example
44
53
 
45
54
  ```python
@@ -73,4 +82,3 @@ if move is not None:
73
82
  - `Position.outcome()`
74
83
  - `Position.supporting_pivots(move)`
75
84
 
76
-
@@ -16,6 +16,13 @@ Or build a wheel:
16
16
  maturin build
17
17
  ```
18
18
 
19
+ To test the installed bindings:
20
+
21
+ ```bash
22
+ python -m pip install ../../target/wheels/sanqi_python-*.whl
23
+ python -m unittest discover -s tests
24
+ ```
25
+
19
26
  ## Example
20
27
 
21
28
  ```python
@@ -48,4 +55,3 @@ if move is not None:
48
55
  - `Position.evaluate()`
49
56
  - `Position.outcome()`
50
57
  - `Position.supporting_pivots(move)`
51
-
@@ -16,7 +16,7 @@ name = "sanqi_engine"
16
16
  path = "src/lib.rs"
17
17
 
18
18
  [dependencies]
19
- sanqi-core = { version = "0.1.0", path = "../sanqi-core" }
19
+ sanqi-core = { version = "0.1.1", path = "../sanqi-core" }
20
20
 
21
21
  [lints]
22
22
  workspace = true
@@ -16,10 +16,10 @@ path = "src/lib.rs"
16
16
  crate-type = ["cdylib", "rlib"]
17
17
 
18
18
  [dependencies]
19
- pyo3 = { version = "0.28.3", features = ["extension-module"] }
20
- sanqi-core = { version = "0.1.0", path = "../sanqi-core" }
21
- sanqi-engine = { version = "0.1.0", path = "../sanqi-engine" }
22
- sanqi-render = { version = "0.1.0", path = "../sanqi-render" }
19
+ pyo3 = "0.30.1"
20
+ sanqi-core = { version = "0.1.1", path = "../sanqi-core" }
21
+ sanqi-engine = { version = "0.1.1", path = "../sanqi-engine" }
22
+ sanqi-render = { version = "0.1.1", path = "../sanqi-render" }
23
23
 
24
24
  [lints]
25
25
  workspace = true
@@ -16,6 +16,13 @@ Or build a wheel:
16
16
  maturin build
17
17
  ```
18
18
 
19
+ To test the installed bindings:
20
+
21
+ ```bash
22
+ python -m pip install ../../target/wheels/sanqi_python-*.whl
23
+ python -m unittest discover -s tests
24
+ ```
25
+
19
26
  ## Example
20
27
 
21
28
  ```python
@@ -48,4 +55,3 @@ if move is not None:
48
55
  - `Position.evaluate()`
49
56
  - `Position.outcome()`
50
57
  - `Position.supporting_pivots(move)`
51
-
@@ -30,7 +30,7 @@ fn parse_piece_style(value: Option<&str>) -> PyResult<TextPieceStyle> {
30
30
  }
31
31
  }
32
32
 
33
- #[pyclass(name = "Position", skip_from_py_object)]
33
+ #[pyclass(name = "Position")]
34
34
  #[derive(Clone)]
35
35
  struct PyPosition {
36
36
  inner: Position,
@@ -0,0 +1,49 @@
1
+ import unittest
2
+
3
+ import sanqi_python as sanqi
4
+
5
+
6
+ class PositionTests(unittest.TestCase):
7
+ def test_move_and_copy(self):
8
+ position = sanqi.Position.initial()
9
+ original = position.copy()
10
+ move = position.legal_moves()[0]
11
+ self.assertTrue(position.is_legal_move(move))
12
+ self.assertEqual(sanqi.parse_move_string(move), move)
13
+ position.apply_move(move)
14
+ self.assertEqual(position.side_to_move(), "black")
15
+ self.assertEqual(original.side_to_move(), "white")
16
+ self.assertNotEqual(position.ascii_board(), original.ascii_board())
17
+
18
+ def test_analysis(self):
19
+ position = sanqi.initial_position()
20
+ analysis = position.analyze(1)
21
+ self.assertIsNotNone(analysis)
22
+ self.assertIn(analysis["best_move"], position.legal_moves())
23
+ self.assertIsInstance(analysis["score"], int)
24
+ self.assertEqual(analysis["depth"], 1)
25
+ self.assertEqual(analysis["principal_variation"][0], analysis["best_move"])
26
+ timed = position.analyze_timed(1, 1000)
27
+ self.assertIn(timed["best_move"], position.legal_moves())
28
+
29
+ def test_rendering_and_pivots(self):
30
+ position = sanqi.Position.initial()
31
+ move = position.legal_moves()[0]
32
+ self.assertIn("<svg", position.svg_board())
33
+ self.assertIn("<svg", position.svg_for_move(move))
34
+ pivots = position.supporting_pivots(move)
35
+ self.assertTrue(pivots)
36
+ self.assertEqual(len(pivots[0]["supports"]), 2)
37
+
38
+ def test_invalid_input(self):
39
+ position = sanqi.Position.initial()
40
+ with self.assertRaises(ValueError):
41
+ sanqi.Position.empty("invalid")
42
+ with self.assertRaises(ValueError):
43
+ position.apply_move("invalid")
44
+ with self.assertRaises(ValueError):
45
+ position.piece_at("z9")
46
+
47
+
48
+ if __name__ == "__main__":
49
+ unittest.main()
@@ -16,7 +16,7 @@ name = "sanqi_render"
16
16
  path = "src/lib.rs"
17
17
 
18
18
  [dependencies]
19
- sanqi-core = { version = "0.1.0", path = "../sanqi-core" }
19
+ sanqi-core = { version = "0.1.1", path = "../sanqi-core" }
20
20
 
21
21
  [lints]
22
22
  workspace = true
@@ -4,7 +4,7 @@ build-backend = "maturin"
4
4
 
5
5
  [project]
6
6
  name = "sanqi-python"
7
- version = "0.1.0"
7
+ version = "0.1.1"
8
8
  description = "Python bindings for the Sanqi Rust engine"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -21,6 +21,8 @@ classifiers = [
21
21
  "Programming Language :: Python :: 3.10",
22
22
  "Programming Language :: Python :: 3.11",
23
23
  "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Programming Language :: Python :: 3.14",
24
26
  "Programming Language :: Rust",
25
27
  ]
26
28