valanga 0.1.2__tar.gz → 0.1.3__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 (23) hide show
  1. {valanga-0.1.2/src/valanga.egg-info → valanga-0.1.3}/PKG-INFO +8 -2
  2. {valanga-0.1.2 → valanga-0.1.3}/pyproject.toml +53 -3
  3. {valanga-0.1.2 → valanga-0.1.3}/src/valanga/__init__.py +2 -2
  4. {valanga-0.1.2 → valanga-0.1.3}/src/valanga/evaluations.py +1 -1
  5. {valanga-0.1.2 → valanga-0.1.3}/src/valanga/game.py +2 -0
  6. valanga-0.1.3/src/valanga/policy.py +42 -0
  7. {valanga-0.1.2 → valanga-0.1.3/src/valanga.egg-info}/PKG-INFO +8 -2
  8. {valanga-0.1.2 → valanga-0.1.3}/src/valanga.egg-info/SOURCES.txt +1 -0
  9. {valanga-0.1.2 → valanga-0.1.3}/src/valanga.egg-info/requires.txt +9 -1
  10. {valanga-0.1.2 → valanga-0.1.3}/LICENSE +0 -0
  11. {valanga-0.1.2 → valanga-0.1.3}/README.md +0 -0
  12. {valanga-0.1.2 → valanga-0.1.3}/setup.cfg +0 -0
  13. {valanga-0.1.2 → valanga-0.1.3}/src/valanga/evaluator_types.py +0 -0
  14. {valanga-0.1.2 → valanga-0.1.3}/src/valanga/over_event.py +0 -0
  15. {valanga-0.1.2 → valanga-0.1.3}/src/valanga/progress_messsage.py +0 -0
  16. {valanga-0.1.2 → valanga-0.1.3}/src/valanga/py.typed +0 -0
  17. {valanga-0.1.2 → valanga-0.1.3}/src/valanga/representation_factory.py +0 -0
  18. {valanga-0.1.2 → valanga-0.1.3}/src/valanga/represention_for_evaluation.py +0 -0
  19. {valanga-0.1.2 → valanga-0.1.3}/src/valanga.egg-info/dependency_links.txt +0 -0
  20. {valanga-0.1.2 → valanga-0.1.3}/src/valanga.egg-info/top_level.txt +0 -0
  21. {valanga-0.1.2 → valanga-0.1.3}/tests/test_over_event.py +0 -0
  22. {valanga-0.1.2 → valanga-0.1.3}/tests/test_placeholder.py +0 -0
  23. {valanga-0.1.2 → valanga-0.1.3}/tests/test_representation_factory.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: valanga
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: Shared types and utilities for evalaution
5
5
  Requires-Python: >=3.13
6
6
  License-File: LICENSE
@@ -8,6 +8,12 @@ Provides-Extra: test
8
8
  Requires-Dist: pytest>=8.4.1; extra == "test"
9
9
  Requires-Dist: coverage; extra == "test"
10
10
  Requires-Dist: pytest-cov>=6.0.0; extra == "test"
11
+ Provides-Extra: lint
12
+ Requires-Dist: ruff>=0.14.10; extra == "lint"
13
+ Requires-Dist: pylint>=4.0.4; extra == "lint"
14
+ Provides-Extra: typecheck
15
+ Requires-Dist: mypy>=1.19.1; extra == "typecheck"
16
+ Requires-Dist: pyright[nodejs]>=1.1.408; extra == "typecheck"
11
17
  Provides-Extra: dev
12
18
  Requires-Dist: tox>=4.32.0; extra == "dev"
13
19
  Requires-Dist: types-PyYAML>=6.0.12.12; extra == "dev"
@@ -15,7 +21,7 @@ Requires-Dist: ruff>=0.14.10; extra == "dev"
15
21
  Requires-Dist: pylint>=4.0.4; extra == "dev"
16
22
  Requires-Dist: black>=25.12.0; extra == "dev"
17
23
  Requires-Dist: mypy>=1.19.1; extra == "dev"
18
- Requires-Dist: pyright>=1.1.407; extra == "dev"
24
+ Requires-Dist: pyright[nodejs]>=1.1.408; extra == "dev"
19
25
  Requires-Dist: build; extra == "dev"
20
26
  Requires-Dist: twine; extra == "dev"
21
27
  Requires-Dist: sphinx; extra == "dev"
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "valanga"
7
- version = "0.1.2"
7
+ version = "0.1.3"
8
8
  description = "Shared types and utilities for evalaution"
9
9
  requires-python = ">=3.13"
10
10
  dependencies = []
@@ -20,6 +20,16 @@ test = [
20
20
  "pytest-cov>=6.0.0"
21
21
  ]
22
22
 
23
+ lint = [
24
+ "ruff>=0.14.10",
25
+ "pylint>=4.0.4",
26
+ ]
27
+
28
+ typecheck = [
29
+ "mypy>=1.19.1",
30
+ "pyright[nodejs]>=1.1.408",
31
+ ]
32
+
23
33
 
24
34
  dev = [
25
35
  # Development dependencies (includes test)
@@ -33,7 +43,7 @@ dev = [
33
43
 
34
44
  # Type checking
35
45
  "mypy>=1.19.1",
36
- "pyright>=1.1.407 ",
46
+ "pyright[nodejs]>=1.1.408 ",
37
47
 
38
48
  # Building & publishing
39
49
  "build",
@@ -150,4 +160,44 @@ reportMissingImports = true
150
160
  reportUnusedImport = true
151
161
  reportMissingTypeStubs = false
152
162
  reportUnknownMemberType = false
153
- reportPrivateImportUsage = false
163
+ reportPrivateImportUsage = false
164
+
165
+
166
+ #################### TOX ####################
167
+
168
+ [tool.tox]
169
+ min_version = "4.32.0"
170
+ env_list = ["py313", "lint", "typecheck"]
171
+ isolated_build = true
172
+
173
+ [tool.tox.env_run_base]
174
+ base_python = ["python3.13"]
175
+
176
+ [tool.tox.env.py313]
177
+ description = "Run tests"
178
+ extras = ["test"]
179
+ commands = [["pytest", "{posargs}"]]
180
+
181
+ [tool.tox.env.lint]
182
+ description = "ruff + pylint (fast, no package install)"
183
+ package = "skip"
184
+ deps = ["ruff>=0.14.10", "pylint>=4.0.4"]
185
+ set_env = { PYTHONPATH = "{toxinidir}/src" }
186
+ commands = [
187
+ ["python", "-m", "ruff", "check", "src", "tests"],
188
+ ["python", "-m", "ruff", "format", "--check", "src", "tests"],
189
+ ["python", "-m", "pylint", "src/valanga"],
190
+ ]
191
+
192
+ [tool.tox.env.typecheck]
193
+ description = "mypy + pyright (fast, no package install)"
194
+ package = "skip"
195
+ deps = ["mypy>=1.19.1", "pyright[nodejs]>=1.1.408"]
196
+ set_env = { MYPYPATH = "{toxinidir}/src" }
197
+ commands = [
198
+ ["python", "-m", "mypy", "--config-file", "pyproject.toml", "src/valanga"],
199
+ ["python", "-m", "pyright", "src/valanga"],
200
+ ]
201
+
202
+
203
+ #################### END TOX ####################
@@ -1,6 +1,6 @@
1
1
  """Common types and utilities shared by multiple libraries."""
2
2
 
3
- from .evaluations import BoardEvaluation, EvalItem, FloatyStateEvaluation, ForcedOutcome
3
+ from .evaluations import EvalItem, FloatyStateEvaluation, ForcedOutcome, StateEvaluation
4
4
  from .game import (
5
5
  BLACK,
6
6
  WHITE,
@@ -22,7 +22,7 @@ from .represention_for_evaluation import ContentRepresentation
22
22
  __all__ = [
23
23
  "ForcedOutcome",
24
24
  "FloatyStateEvaluation",
25
- "BoardEvaluation",
25
+ "StateEvaluation",
26
26
  "EvalItem",
27
27
  "OverEvent",
28
28
  "Color",
@@ -55,4 +55,4 @@ class FloatyStateEvaluation:
55
55
  value_white: float | None
56
56
 
57
57
 
58
- BoardEvaluation = FloatyStateEvaluation | ForcedOutcome
58
+ StateEvaluation = FloatyStateEvaluation | ForcedOutcome
@@ -6,6 +6,8 @@ from collections.abc import Hashable
6
6
  from enum import Enum
7
7
  from typing import Annotated, Iterator, Protocol, Self, Sequence, TypeVar
8
8
 
9
+ type Seed = Annotated[int, "seed"]
10
+
9
11
  type StateTag = Annotated[Hashable, "A label or identifier for a state in a game"]
10
12
 
11
13
  type StateModifications = Annotated[
@@ -0,0 +1,42 @@
1
+ """
2
+ Policy-related classes and protocols for branch selection in game trees.
3
+ """
4
+
5
+ from dataclasses import dataclass
6
+ from typing import Mapping, Protocol
7
+
8
+ from valanga.evaluations import StateEvaluation
9
+ from valanga.game import BranchKey, Seed, State
10
+
11
+
12
+ @dataclass(frozen=True, slots=True)
13
+ class BranchPolicy:
14
+ """
15
+ Represents a probability distribution over branches.
16
+ """
17
+
18
+ probs: Mapping[BranchKey, float] # should sum to ~1.0
19
+
20
+
21
+ @dataclass(frozen=True, slots=True)
22
+ class Recommendation:
23
+ """A recommendation for a specific branch in a tree node."""
24
+
25
+ recommended_key: BranchKey
26
+ evaluation: StateEvaluation | None = None
27
+ policy: BranchPolicy | None = None
28
+ branch_evals: Mapping[BranchKey, StateEvaluation] | None = None
29
+
30
+
31
+ class BranchSelector(Protocol):
32
+ """Protocol for a branch selector."""
33
+
34
+ def recommend(self, state: State, seed: Seed) -> Recommendation:
35
+ """Given a state and a seed, recommends a branch to take.
36
+ Args:
37
+ state (State): The current state of the game.
38
+ seed (Seed): A seed for any randomness involved in the selection.
39
+ Returns:
40
+ Recommendation: The recommended branch to take.
41
+ """
42
+ ...
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: valanga
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: Shared types and utilities for evalaution
5
5
  Requires-Python: >=3.13
6
6
  License-File: LICENSE
@@ -8,6 +8,12 @@ Provides-Extra: test
8
8
  Requires-Dist: pytest>=8.4.1; extra == "test"
9
9
  Requires-Dist: coverage; extra == "test"
10
10
  Requires-Dist: pytest-cov>=6.0.0; extra == "test"
11
+ Provides-Extra: lint
12
+ Requires-Dist: ruff>=0.14.10; extra == "lint"
13
+ Requires-Dist: pylint>=4.0.4; extra == "lint"
14
+ Provides-Extra: typecheck
15
+ Requires-Dist: mypy>=1.19.1; extra == "typecheck"
16
+ Requires-Dist: pyright[nodejs]>=1.1.408; extra == "typecheck"
11
17
  Provides-Extra: dev
12
18
  Requires-Dist: tox>=4.32.0; extra == "dev"
13
19
  Requires-Dist: types-PyYAML>=6.0.12.12; extra == "dev"
@@ -15,7 +21,7 @@ Requires-Dist: ruff>=0.14.10; extra == "dev"
15
21
  Requires-Dist: pylint>=4.0.4; extra == "dev"
16
22
  Requires-Dist: black>=25.12.0; extra == "dev"
17
23
  Requires-Dist: mypy>=1.19.1; extra == "dev"
18
- Requires-Dist: pyright>=1.1.407; extra == "dev"
24
+ Requires-Dist: pyright[nodejs]>=1.1.408; extra == "dev"
19
25
  Requires-Dist: build; extra == "dev"
20
26
  Requires-Dist: twine; extra == "dev"
21
27
  Requires-Dist: sphinx; extra == "dev"
@@ -6,6 +6,7 @@ src/valanga/evaluations.py
6
6
  src/valanga/evaluator_types.py
7
7
  src/valanga/game.py
8
8
  src/valanga/over_event.py
9
+ src/valanga/policy.py
9
10
  src/valanga/progress_messsage.py
10
11
  src/valanga/py.typed
11
12
  src/valanga/representation_factory.py
@@ -6,7 +6,7 @@ ruff>=0.14.10
6
6
  pylint>=4.0.4
7
7
  black>=25.12.0
8
8
  mypy>=1.19.1
9
- pyright>=1.1.407
9
+ pyright[nodejs]>=1.1.408
10
10
  build
11
11
  twine
12
12
  sphinx
@@ -14,7 +14,15 @@ sphinx-rtd-theme
14
14
  sphinx-autodoc-typehints
15
15
  pre-commit
16
16
 
17
+ [lint]
18
+ ruff>=0.14.10
19
+ pylint>=4.0.4
20
+
17
21
  [test]
18
22
  pytest>=8.4.1
19
23
  coverage
20
24
  pytest-cov>=6.0.0
25
+
26
+ [typecheck]
27
+ mypy>=1.19.1
28
+ pyright[nodejs]>=1.1.408
File without changes
File without changes
File without changes
File without changes