Open MarkZH opened 1 year ago
With deprecating 3.8
, we can use list[dict[str, int]]
instead of List[Dict[str, int]]
, so we can remove from typing import List
.
With deprecating 3.9
, we can use int | str
instaed of Union[int, str]
, and int | None
instead of Optional[int]
.
With respect to time.monotonic()
, I misinterpreted the Python docs. The documentation states that
Changed in version 3.10: On macOS, the function is now system-wide.
I had thought this meant that the function wasn't guaranteed to be available on macOS. However, according to this cpython issue, the definition of "system-wide" is
[...] the clock is the same for all processes on the system and the reference point does not change after start-up time.
Meaning, time.monotonic()
is available for macOS, but the timers on different processes cannot be used together until 3.10. Since all of the timers used in lichess-bot never leave their originating thread or process, this limitation is irrelevant.
However, time.monotonic()
has much lower time resolution than time.perf_counter()
, so the issue is moot and perf_counter()
is a better choice for timing purposes.
With deprecating 3.9
we can use TypeAlias
, so we would change MOVE = Union[PlayResult, list[Move]]
to MOVE: TypeAlias = Union[PlayResult, list[Move]]
.
With deprecating 3.10
we can use NotRequired
and Required
in TypedDict
s.
With deprecating 3.11
we can use type
instead of TypeAlias
, so we would change MOVE: TypeAlias = Union[PlayResult, list[Move]]
to type MOVE = Union[PlayResult, list[Move]]
.
We could also change nested f-strings to only use double quotes (see here).
@AttackingOrDefending Since Python 3.9 is a little more than a year away from end-of-life, should we deprecate it soon (with, say, 3 months warning) or wait until it reaches end-of-life?
I think we should wait until it reaches end-of-life, since there are probably people still using python 3.9.
With python 3.13
(deprecating 3.12
), we can use ReadOnly
in TypedDict
and also possibly support iOS and android.
With python 3.14
(deprecating 3.13
), we can remove some (possibly all) from __future__ import annotations
statements.
This issue is for discussing the scheduling and motivations for deprecating old Python versions.
Deprecating 3.8 (May 1, 2023)
685
Queue
.list
anddict
instead ofList
andDict
, for example) to reduce the occurrences offrom typing import ...
.Deprecating 3.9 (Oct. 2025)
time.time()
withtime.monotonic()
so timing is not affected by clock changes (DST, e.g.). This function is available on MacOS starting with version 3.10. Fixed with PR #801int | str
instead ofUnion[int, str]
, andint | None
instead ofOptional[int]
.MOVE = Union[PlayResult, list[Move]]
changes toMOVE: TypeAlias = Union[PlayResult, list[Move]]
.if-elif-else
withmatch
statementsDeprecating 3.10 (Oct. 2026)
Deprecating 3.11 (Oct. 2027)
MOVE: TypeAlias = Union[PlayResult, list[Move]]
totype MOVE = Union[PlayResult, list[Move]]
.Deprecating 3.12 (Oct. 2028)
Deprecating 3.13 (Oct. 2029)