Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python version deprecation tracking #677

Open
3 of 13 tasks
MarkZH opened this issue Mar 22, 2023 · 6 comments
Open
3 of 13 tasks

Python version deprecation tracking #677

MarkZH opened this issue Mar 22, 2023 · 6 comments

Comments

@MarkZH
Copy link
Collaborator

MarkZH commented Mar 22, 2023

This issue is for discussing the scheduling and motivations for deprecating old Python versions.

Deprecating 3.8 (May 1, 2023)

  • Drop support for Python 3.8 #685
  • Finish type hinting with Queue.
  • Use builtin types for hinting (list and dict instead of List and Dict, for example) to reduce the occurrences of from typing import ....

Deprecating 3.9 (Oct. 2025)

Deprecating 3.10 (Oct. 2026)

Deprecating 3.11 (Oct. 2027)

  • Use type instead of TypeAlias, to change MOVE: TypeAlias = Union[PlayResult, list[Move]] to type MOVE = Union[PlayResult, list[Move]].
  • Change nested f-strings to only use double quotes (see here).

Deprecating 3.12 (Oct. 2028)

  • Use ReadOnly in TypedDict
  • Possibly support iOS and android.

Deprecating 3.13 (Oct. 2029)

@AttackingOrDefending
Copy link
Member

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].

@MarkZH
Copy link
Collaborator Author

MarkZH commented Aug 11, 2023

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.

@MarkZH MarkZH unpinned this issue Mar 4, 2024
@AttackingOrDefending
Copy link
Member

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 TypedDicts.

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).

@MarkZH
Copy link
Collaborator Author

MarkZH commented Aug 29, 2024

@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?

@AttackingOrDefending
Copy link
Member

I think we should wait until it reaches end-of-life, since there are probably people still using python 3.9.

@AttackingOrDefending
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants