Update most Python dependencies.

A lot of the dependency versions we have pinned don't have wheels for
Python 3.12. Update almost all of them so we can upgrade Python.

The few that weren't upgraded here are black and mypy, since those will
be a bit invasive, and Pillow, which has an API change I don't want to
deal with right now (I've got a commit on another machine that has
already done the migration, so I'll do it later).
This commit is contained in:
Dan Albert 2023-11-30 20:17:36 -08:00
parent 46766ecbd4
commit 7bc35ef7f4
14 changed files with 87 additions and 69 deletions

View File

@ -33,15 +33,19 @@ class FrozenCombatJs(BaseModel):
if isinstance(combat, AtIp):
return FrozenCombatJs(
id=combat.id,
flight_position=combat.flight.position().latlng(),
target_positions=[combat.flight.package.target.position.latlng()],
flight_position=LeafletPoint.from_pydcs(combat.flight.position()),
target_positions=[
LeafletPoint.from_pydcs(combat.flight.package.target.position)
],
footprint=None,
)
if isinstance(combat, DefendingSam):
return FrozenCombatJs(
id=combat.id,
flight_position=combat.flight.position().latlng(),
target_positions=[sam.position.latlng() for sam in combat.air_defenses],
flight_position=LeafletPoint.from_pydcs(combat.flight.position()),
target_positions=[
LeafletPoint.from_pydcs(sam.position) for sam in combat.air_defenses
],
footprint=None,
)
raise NotImplementedError(f"Unhandled FrozenCombat type: {combat.__class__}")

View File

@ -33,7 +33,7 @@ class ControlPointJs(BaseModel):
id=control_point.id,
name=control_point.name,
blue=control_point.captured,
position=control_point.position.latlng(),
position=LeafletPoint.from_pydcs(control_point.position),
mobile=control_point.moveable and control_point.captured,
destination=destination,
sidc=str(control_point.sidc()),

View File

@ -81,9 +81,13 @@ class GameUpdateEventsJs(BaseModel):
for f in events.updated_front_lines
]
reset_on_map_center: LeafletPoint | None = None
if events.reset_on_map_center is not None:
reset_on_map_center = LeafletPoint.from_pydcs(events.reset_on_map_center)
return GameUpdateEventsJs(
updated_flight_positions={
f[0].id: f[1].latlng() for f in events.updated_flight_positions
f[0].id: LeafletPoint.from_pydcs(f[1])
for f in events.updated_flight_positions
},
new_combats=new_combats,
updated_combats=updated_combats,
@ -110,7 +114,7 @@ class GameUpdateEventsJs(BaseModel):
],
updated_iads=updated_iads,
deleted_iads=events.deleted_iads_connections,
reset_on_map_center=events.reset_on_map_center,
reset_on_map_center=reset_on_map_center,
game_unloaded=events.game_unloaded,
new_turn=events.new_turn,
)

View File

@ -37,7 +37,7 @@ class FlightJs(BaseModel):
# lost.
position = None
if isinstance(flight.state, InFlight) or isinstance(flight.state, Killed):
position = flight.position().latlng()
position = LeafletPoint.from_pydcs(flight.position())
waypoints = None
if with_waypoints:
waypoints = waypoints_for_flight(flight)

View File

@ -27,7 +27,10 @@ class FrontLineJs(BaseModel):
bounds = FrontLineConflictDescription.frontline_bounds(front_line, theater)
return FrontLineJs(
id=front_line.id,
extents=[bounds.left_position.latlng(), bounds.right_position.latlng()],
extents=[
LeafletPoint.from_pydcs(bounds.left_position),
LeafletPoint.from_pydcs(bounds.right_position),
],
)
@staticmethod

View File

@ -7,12 +7,12 @@ from pydantic import BaseModel
from game.server.controlpoints.models import ControlPointJs
from game.server.flights.models import FlightJs
from game.server.frontlines.models import FrontLineJs
from game.server.iadsnetwork.models import IadsNetworkJs
from game.server.leaflet import LeafletPoint
from game.server.mapzones.models import ThreatZoneContainerJs, UnculledZoneJs
from game.server.navmesh.models import NavMeshesJs
from game.server.supplyroutes.models import SupplyRouteJs
from game.server.tgos.models import TgoJs
from game.server.iadsnetwork.models import IadsConnectionJs, IadsNetworkJs
if TYPE_CHECKING:
from game import Game
@ -44,6 +44,8 @@ class GameJs(BaseModel):
iads_network=IadsNetworkJs.from_network(game.theater.iads_network),
threat_zones=ThreatZoneContainerJs.for_game(game),
navmeshes=NavMeshesJs.from_game(game),
map_center=game.theater.terrain.map_view_default.position.latlng(),
map_center=LeafletPoint.from_pydcs(
game.theater.terrain.map_view_default.position
),
unculled_zones=UnculledZoneJs.from_game(game),
)

View File

@ -19,6 +19,11 @@ class LeafletPoint(BaseModel):
title = "LatLng"
@staticmethod
def from_pydcs(point: Point) -> LeafletPoint:
latlng = point.latlng()
return LeafletPoint(lat=latlng.lat, lng=latlng.lng)
LeafletLine = list[LeafletPoint]

View File

@ -36,7 +36,7 @@ class UnculledZoneJs(BaseModel):
def from_game(game: Game) -> list[UnculledZoneJs]:
return [
UnculledZoneJs(
position=zone.latlng(),
position=LeafletPoint.from_pydcs(zone),
radius=game.settings.perf_culling_distance * 1000,
)
for zone in game.get_culling_zones()

View File

@ -2,7 +2,7 @@ from __future__ import annotations
from functools import lru_cache
from pydantic import BaseSettings
from pydantic_settings import BaseSettings
class ServerSettings(BaseSettings):

View File

@ -92,7 +92,7 @@ class SupplyRouteJs(BaseModel):
# https://reactjs.org/docs/lists-and-keys.html#keys
# https://github.com/dcs-liberation/dcs_liberation/issues/2167
id=uuid.uuid4(),
points=[p.latlng() for p in points],
points=[LeafletPoint.from_pydcs(p) for p in points],
front_active=not sea and a.front_is_active(b),
is_sea=sea,
blue=a.captured,

View File

@ -38,7 +38,7 @@ class TgoJs(BaseModel):
control_point_name=tgo.control_point.name,
category=tgo.category,
blue=tgo.control_point.captured,
position=tgo.position.latlng(),
position=LeafletPoint.from_pydcs(tgo.position),
units=[unit.display_name for unit in tgo.units],
threat_ranges=threat_ranges,
detection_ranges=detection_ranges,

View File

@ -82,7 +82,7 @@ class FlightWaypointJs(BaseModel):
return FlightWaypointJs(
name=waypoint.name,
position=waypoint.position.latlng(),
position=LeafletPoint.from_pydcs(waypoint.position),
altitude_ft=waypoint.alt.feet,
altitude_reference=waypoint.alt_type,
is_movable=is_movable,

View File

@ -5,7 +5,6 @@ from typing import TYPE_CHECKING
from uuid import UUID
from dcs import Point
from dcs.mapping import LatLng
if TYPE_CHECKING:
from game import Game
@ -38,7 +37,7 @@ class GameUpdateEvents:
updated_control_points: set[ControlPoint] = field(default_factory=set)
updated_iads: set[IadsNetworkNode] = field(default_factory=set)
deleted_iads_connections: set[UUID] = field(default_factory=set)
reset_on_map_center: LatLng | None = None
reset_on_map_center: Point | None = None
game_unloaded: bool = False
new_turn: bool = False
shutting_down: bool = False
@ -140,9 +139,7 @@ class GameUpdateEvents:
self.game_unloaded = True
self.reset_on_map_center = None
else:
self.reset_on_map_center = (
game.theater.terrain.map_view_default.position.latlng()
)
self.reset_on_map_center = game.theater.terrain.map_view_default.position
self.game_unloaded = False
return self

View File

@ -1,54 +1,57 @@
altgraph==0.17.3
anyio==3.6.2
asgiref==3.6.0
attrs==22.2.0
altgraph==0.17.4
annotated-types==0.6.0
anyio==3.7.1
asgiref==3.7.2
attrs==23.1.0
black==22.12.0
certifi==2023.7.22
cfgv==3.3.1
click==8.1.3
certifi==2023.11.17
cfgv==3.4.0
click==8.1.7
colorama==0.4.6
coverage==7.0.5
distlib==0.3.6
exceptiongroup==1.1.0
Faker==15.3.4
fastapi==0.95.2
filelock==3.9.0
coverage==7.3.2
distlib==0.3.7
exceptiongroup==1.2.0
Faker==20.1.0
fastapi==0.104.1
filelock==3.13.1
future==0.18.3
h11==0.14.0
httptools==0.5.0
identify==2.5.11
idna==3.4
iniconfig==1.1.1
httptools==0.6.1
identify==2.5.32
idna==3.6
iniconfig==2.0.0
Jinja2==3.1.2
MarkupSafe==2.1.1
MarkupSafe==2.1.3
mypy==1.2.0
mypy-extensions==1.0.0
nodeenv==1.7.0
numpy==1.25.1
packaging==22.0
pathspec==0.10.3
pefile==2022.5.30
nodeenv==1.8.0
numpy==1.26.2
packaging==23.2
pathspec==0.11.2
pefile==2023.2.7
Pillow==10.0.1
platformdirs==2.6.2
pluggy==1.0.0
pre-commit==2.21.0
pydantic==1.10.7
git+https://github.com/pydcs/dcs@ca4cb436663416c8637ca17fdf1b090030696782#egg=pydcs
pyinstaller==5.13.0
pyinstaller-hooks-contrib==2023.6
pyproj==3.4.1
PySide6==6.4.1
PySide6-Addons==6.4.1
PySide6-Essentials==6.4.1
pytest==7.2.0
pytest-cov==4.0.0
pytest-mock==3.10.0
platformdirs==4.0.0
pluggy==1.3.0
pre-commit==3.5.0
pydantic==2.5.2
pydantic-settings==2.1.0
pydantic_core==2.14.5
pydcs @ git+https://github.com/pydcs/dcs@05ebda06cbe77b09b2b0fae915993caaa30c81bd
pyinstaller==6.2.0
pyinstaller-hooks-contrib==2023.10
pyproj==3.6.1
PySide6==6.6.0
PySide6-Addons==6.6.0
PySide6-Essentials==6.6.0
pytest==7.4.3
pytest-cov==4.1.0
pytest-mock==3.12.0
python-dateutil==2.8.2
python-dotenv==0.21.0
python-dotenv==1.0.0
pywin32-ctypes==0.2.2
PyYAML==6.0
shapely==2.0.1
shiboken6==6.4.1
PyYAML==6.0.1
shapely==2.0.2
shiboken6==6.6.0
six==1.16.0
sniffio==1.3.0
starlette==0.27.0
@ -57,10 +60,10 @@ tomli==2.0.1
types-Jinja2==2.11.9
types-MarkupSafe==1.1.10
types-Pillow==9.3.0.4
types-PyYAML==6.0.12.2
types-tabulate==0.9.0.0
typing_extensions==4.4.0
uvicorn==0.20.0
virtualenv==20.17.1
watchfiles==0.18.1
websockets==10.4
types-PyYAML==6.0.12.12
types-tabulate==0.9.0.3
typing_extensions==4.8.0
uvicorn==0.24.0.post1
virtualenv==20.24.7
watchfiles==0.21.0
websockets==12.0