feat!: adopt Python 3.15 and support BattlesnakeArena
- Require Python 3.15 in project metadata, runtime pin, and Docker stages. - Use lazy imports for database backends and type-only dependencies. - Defer benchmark dependencies until their code paths are used. - Rely on deferred annotations and use Path.info for file discovery. - Accept BattlesnakeArena alongside BattlesnakeEngine on game endpoints. - Advance quart_common for Python 3.15 and multi-agent validation. - Add pytest development dependencies and refresh the uv lockfile. - Test lazy backend loading, import order, and fresh file discovery. - Document the runtime requirements and locked uv workflow. BREAKING CHANGE: Python 3.15 or newer is required; earlier runtimes cannot parse the lazy import syntax.
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from server.GameBoard import GameBoard
|
||||
lazy from server.GameBoard import GameBoard
|
||||
|
||||
import random
|
||||
|
||||
|
||||
@@ -7,9 +7,6 @@ no sets, deques, or per-cell Python objects.
|
||||
Typical 11×11 board → 121-bit integers. Python big-int ops on these are
|
||||
extremely fast (single C-level limb operations under the hood).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
class BitBoard:
|
||||
"""Pre-computed masks and fast spatial primitives for a fixed grid size."""
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
"""Reusable compact duel-search integration for Apex-style snakes."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from snakes.engine.duel_search import BitboardDuelSearch
|
||||
|
||||
class BitboardDuelMixin:
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
"""Deadline-aware simultaneous duel search using compact tuple bodies and bitboards."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Iterable
|
||||
from dataclasses import dataclass
|
||||
from time import perf_counter
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
"""Safety-gated board geometry scoring for perimeter-aware snakes."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
def _on_edge(point: tuple[int, int], width: int, height: int) -> bool:
|
||||
x, y = point
|
||||
return x in {0, width - 1} or y in {0, height - 1}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
"""Bitboard-backed spatial primitives shared by competitive snakes."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from snakes.engine.bitboard import BitBoard
|
||||
|
||||
class BitboardSpatialMixin:
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
"""Reusable bitboard and adversarial survival rollouts."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from time import perf_counter
|
||||
|
||||
from snakes.engine.survival_search import CompactSurvivalSearch
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
"""Compact adversarial rollout for multiplayer Battlesnake positions."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from itertools import product
|
||||
from time import perf_counter
|
||||
|
||||
|
||||
@@ -24,8 +24,6 @@ Key speedups:
|
||||
per-direction Python loop + _in_bounds calls.
|
||||
S11: _future_survival_tree inlines legal-move check with bitboard ops.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
from typing import Any
|
||||
from time import perf_counter
|
||||
|
||||
|
||||
@@ -32,9 +32,6 @@ Key speedups:
|
||||
S18: Prism uses a deeper tactical horizon while retaining Apex's timeout reserve.
|
||||
S19: Rollout occupancy and evaluation caches avoid repeated flood-fill work.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from server.GameBoard import GameBoard
|
||||
from snakes.engine.bitboard import BitBoard
|
||||
from snakes.engine.duel import BitboardDuelMixin
|
||||
|
||||
Reference in New Issue
Block a user