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.
- {sanqi_python-0.1.0 → sanqi_python-0.1.1}/Cargo.lock +27 -28
- {sanqi_python-0.1.0 → sanqi_python-0.1.1}/Cargo.toml +2 -2
- {sanqi_python-0.1.0 → sanqi_python-0.1.1}/PKG-INFO +10 -2
- {sanqi_python-0.1.0/crates/sanqi-python → sanqi_python-0.1.1}/README.md +7 -1
- {sanqi_python-0.1.0 → sanqi_python-0.1.1}/crates/sanqi-engine/Cargo.toml +1 -1
- {sanqi_python-0.1.0 → sanqi_python-0.1.1}/crates/sanqi-python/Cargo.toml +4 -4
- {sanqi_python-0.1.0 → sanqi_python-0.1.1/crates/sanqi-python}/README.md +7 -1
- {sanqi_python-0.1.0 → sanqi_python-0.1.1}/crates/sanqi-python/src/lib.rs +1 -1
- sanqi_python-0.1.1/crates/sanqi-python/tests/test_position.py +49 -0
- {sanqi_python-0.1.0 → sanqi_python-0.1.1}/crates/sanqi-render/Cargo.toml +1 -1
- {sanqi_python-0.1.0 → sanqi_python-0.1.1}/pyproject.toml +3 -1
- {sanqi_python-0.1.0 → sanqi_python-0.1.1}/crates/sanqi-core/Cargo.toml +0 -0
- {sanqi_python-0.1.0 → sanqi_python-0.1.1}/crates/sanqi-core/README.md +0 -0
- {sanqi_python-0.1.0 → sanqi_python-0.1.1}/crates/sanqi-core/src/lib.rs +0 -0
- {sanqi_python-0.1.0 → sanqi_python-0.1.1}/crates/sanqi-engine/README.md +0 -0
- {sanqi_python-0.1.0 → sanqi_python-0.1.1}/crates/sanqi-engine/src/lib.rs +0 -0
- {sanqi_python-0.1.0 → sanqi_python-0.1.1}/crates/sanqi-render/README.md +0 -0
- {sanqi_python-0.1.0 → sanqi_python-0.1.1}/crates/sanqi-render/src/lib.rs +0 -0
|
@@ -10,9 +10,9 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
|
10
10
|
|
|
11
11
|
[[package]]
|
|
12
12
|
name = "libc"
|
|
13
|
-
version = "0.2.
|
|
13
|
+
version = "0.2.191"
|
|
14
14
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
15
|
-
checksum = "
|
|
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.
|
|
25
|
+
version = "1.15.0"
|
|
26
26
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
27
|
-
checksum = "
|
|
27
|
+
checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
|
|
28
28
|
|
|
29
29
|
[[package]]
|
|
30
30
|
name = "proc-macro2"
|
|
31
|
-
version = "1.0.
|
|
31
|
+
version = "1.0.107"
|
|
32
32
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
33
|
-
checksum = "
|
|
33
|
+
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
|
|
34
34
|
dependencies = [
|
|
35
35
|
"unicode-ident",
|
|
36
36
|
]
|
|
37
37
|
|
|
38
38
|
[[package]]
|
|
39
39
|
name = "pyo3"
|
|
40
|
-
version = "0.
|
|
40
|
+
version = "0.30.1"
|
|
41
41
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
42
|
-
checksum = "
|
|
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.
|
|
54
|
+
version = "0.30.1"
|
|
55
55
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
56
|
-
checksum = "
|
|
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.
|
|
63
|
+
version = "0.30.1"
|
|
64
64
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
65
|
-
checksum = "
|
|
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.
|
|
73
|
+
version = "0.30.1"
|
|
74
74
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
75
|
-
checksum = "
|
|
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.
|
|
85
|
+
version = "0.30.1"
|
|
86
86
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
87
|
-
checksum = "
|
|
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.
|
|
97
|
+
version = "1.0.47"
|
|
99
98
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
100
|
-
checksum = "
|
|
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.
|
|
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.
|
|
115
|
+
version = "0.1.1"
|
|
117
116
|
|
|
118
117
|
[[package]]
|
|
119
118
|
name = "sanqi-engine"
|
|
120
|
-
version = "0.1.
|
|
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.
|
|
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.
|
|
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 = "
|
|
143
|
+
version = "3.0.9"
|
|
145
144
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
146
|
-
checksum = "
|
|
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.
|
|
160
|
+
version = "1.0.27"
|
|
162
161
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
163
|
-
checksum = "
|
|
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.
|
|
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.
|
|
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.
|
|
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,10 +16,10 @@ path = "src/lib.rs"
|
|
|
16
16
|
crate-type = ["cdylib", "rlib"]
|
|
17
17
|
|
|
18
18
|
[dependencies]
|
|
19
|
-
pyo3 =
|
|
20
|
-
sanqi-core = { version = "0.1.
|
|
21
|
-
sanqi-engine = { version = "0.1.
|
|
22
|
-
sanqi-render = { version = "0.1.
|
|
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
|
-
|
|
@@ -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()
|
|
@@ -4,7 +4,7 @@ build-backend = "maturin"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "sanqi-python"
|
|
7
|
-
version = "0.1.
|
|
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
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|