Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix mypy errors in the entire codebase#8577

dhruvmanila started this conversation inTeam Posts
Discussion options

We need to fix all themypy errors and they are increasing with the number of commits. I am planning to open an issue indicating this problem and asking for help. Some questions in my mind:

  • As Python 3.9 is out, do we switch tolist[type] or keeptyping.List? Note: We do not yet run Python 3.9 on our CI as some of the dependencies aren't compatible yet.
  • Some files do containfrom __future__ import annotation and usinglist[type] butmypy complains about it:
backtracking/minimax.py:15: error: "list" is not subscriptable, use "typing.List" instead

So, do we switch to Python 3.9 compatible type hints or advise users to user thetyping module instead?

You must be logged in to vote

Replies: 3 comments

Comment options

At this point, we should switch to Python 3.9 (dropping any dependencies which are not ready) and then mypy should accept the syntax without the future import.

You must be logged in to vote
0 replies
Comment options

dhruvmanila
Nov 22, 2020
Maintainer Author

That would probably fail some of the checks as some files could rely on that dependency.

You must be logged in to vote
0 replies
Comment options

I suggest a phased approach for Python 3.9 migration and mypy error fixes:

1. Retain Python 3.8+ compatibility first: Keep using  typing.List  instead of native  list[type]  for now, since CI doesn’t support 3.9 yet due to dependency issues. This fixes the mypy errors and keeps the codebase stable.

2. Prepare for 3.9 migration: Document all places using  typing.List  and create a task to switch to native type hints once dependencies are updated.

3. Handle  future import annotations : This import is useful for Python 3.7+ type hinting, so keep it—resolve mypy’s dissatisfaction by adding the relevant ignore comments or updating the mypy config file.

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Labels
None yet
3 participants
@dhruvmanila@cclauss@xssbx

[8]ページ先頭

©2009-2025 Movatter.jp