oncoray / mirp

Medical Image Radiomics Processor
https://oncoray.github.io/mirp/
European Union Public License 1.2
38 stars 11 forks source link

Support Python versions below 3.11 #54

Closed surajpaib closed 4 months ago

surajpaib commented 4 months ago

It would be useful to support highly used Python versions so that the end-user does not need to create a separate environment to try out MIRP.

PyPI stats indicate that most packages are downloaded for 3.8/3.9/3.10: https://pypistats.org/packages/__all__ However, 3.8 goes EOL very soon, but 3.9 and 3.10 have quite some time before EOL (1.5yrs and 2.5yrs) https://devguide.python.org/versions/

alexzwanenburg commented 4 months ago

Thanks for suggestion. The supported Python versions are currently constrained by functionality in the typing library. Notably, MIRP makes use of the following, newer features:

The use of Self could be made backward compatible by (conditionally) importing Self from typing_extensions.

After some searching, I don't think there is a suitable way to make PEP 604 and 585 backward compatible with older Python versions. from __future__ import annotations (PEP 563 introduced in 3.7) does not seem to work, according to this thread, and using it may cause issues in upcoming Python versions, see PEP 649.

Realistically -- that is without forgoing typing entirely -- MIRP can be updated to support Python version 3.10 as the earliest version.

alexzwanenburg commented 4 months ago

For reference, also see Scientific Python SPEC 0, which recommends time-based policies for dropping support for dependencies. In case of python versions, their recommendation is 3 years. This recommendation provides for deprecating support for 3.10 late 2024, with earlier versions already having been deprecated.

alexzwanenburg commented 4 months ago

Added support for Python 3.10 in version 2.1.2.