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 10 tasks
MarkZH opened this issue Mar 22, 2023 · 3 comments
Open
3 of 10 tasks

Python version deprecation tracking #677

MarkZH opened this issue Mar 22, 2023 · 3 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 (TBD / EOL: Oct. 2025)

Deprecating 3.10 (TBD / EOL: Oct. 2026)

Deprecating 3.11 (TBD / EOL: Occt. 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).
@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).

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