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

[build] Upgrade py 3.10 #1770

Merged
merged 4 commits into from
Nov 13, 2024
Merged

[build] Upgrade py 3.10 #1770

merged 4 commits into from
Nov 13, 2024

Conversation

felixdittrich92
Copy link
Contributor

@felixdittrich92 felixdittrich92 commented Nov 6, 2024

This PR:

  • Move to minimum py 3.10 for next release

  • reason:

    • numpy 2.0 requires py >= 3.10
    • same for TF >=2.18 because it depends on numpy >= 2.0
    • same for onnxruntime >= 1.19 which dropped support for py 3.9 because of dep numpy >= 2.0
  • Fix mypy

  • minor numpy 2.0 compatibility fix int0 -> intp (does also exist in <2.0)

Copy link

codecov bot commented Nov 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.59%. Comparing base (b411109) to head (ed7f468).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1770      +/-   ##
==========================================
+ Coverage   96.58%   96.59%   +0.01%     
==========================================
  Files         164      164              
  Lines        7895     7895              
==========================================
+ Hits         7625     7626       +1     
+ Misses        270      269       -1     
Flag Coverage Δ
unittests 96.59% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@felixdittrich92 felixdittrich92 marked this pull request as ready for review November 6, 2024 08:10
@felixdittrich92 felixdittrich92 added this to the 0.11.0 milestone Nov 6, 2024
@felixdittrich92
Copy link
Contributor Author

@odulcy-mindee py3.9 end of life is Oct 25 but if already so many move to 3.10 i think we should follow that people will benefit from the improvements - Additional this would make it possible to move to python's built in types and away from the >= py3.11 deprecated typing types

@felixdittrich92 felixdittrich92 self-assigned this Nov 6, 2024
@felixdittrich92 felixdittrich92 added topic: build Related to dependencies and build topic: ci Related to CI type: misc Miscellaneous labels Nov 6, 2024
@@ -24,7 +24,7 @@ jobs:
uses: actions/setup-python@v5
with:
# MacOS issue ref.: https://github.com/actions/setup-python/issues/855 & https://github.com/actions/setup-python/issues/865
python-version: ${{ matrix.os == 'macos-latest' && '3.11' || matrix.python }}
python-version: ${{ matrix.os == 'macos-latest' && matrix.python == '3.10' && '3.11' || matrix.python }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there 3.11 written in this condition ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's still the action bug with macOS for the python matrix == 3.10 uses python 3.11 to avoid the bug do you remember ? :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but why matrix.python == '3.10' && '3.11' || matrix.python ? Shouldn't matrix.os == 'macos-latest' && matrix.python == '3.10' be enough ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@odulcy-mindee syntax is a bit confusing the last && defines which value to use so

matrix.os == 'macos-latest' && matrix.python == '3.10' -> if both True use 3.11 (&& '3.11') else use the matrix.python version

We could also used the version before so if macos-latest use always python 3.11 the change is a bit more explicit (but can be fully removed later on if we change to py 3.11 & py 3.12)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the end with the current defined matrix.python array both commands does the same the change makes it only a bit more "fine grained" ^^

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, thanks for the clarification

@felixdittrich92
Copy link
Contributor Author

felixdittrich92 commented Nov 12, 2024

@odulcy-mindee you have to merge this (i can't ^^) and adjust the required test rules in the GitHub repo settings :)

@odulcy-mindee odulcy-mindee merged commit 83f1bc5 into mindee:main Nov 13, 2024
82 checks passed
@felixdittrich92 felixdittrich92 deleted the py3.10 branch November 13, 2024 13:12
@odulcy-mindee
Copy link
Collaborator

you have to merge this (i can't ^^) and adjust the required test rules in the GitHub repo settings :)

@felixdittrich92 done

@felixdittrich92
Copy link
Contributor Author

Thanks 😊

@@ -183,7 +183,7 @@ ignore_missing_imports = true
[tool.ruff]
exclude = [".git", "venv*", "build", "**/__init__.py"]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, have **/__init__.py to be excluded?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @kuraga :)

Yeah because it does strange things here:

init.py example:

from doctr.file_utils import is_tf_available, is_torch_available

if is_tf_available():
    from .tensorflow import *
elif is_torch_available():
    from .pytorch import *  # type: ignore[assignment]

and if i remember it has raised circular import issues on other places 😅

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: build Related to dependencies and build topic: ci Related to CI type: misc Miscellaneous
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants