deal with backport StrEnum doesn't work with python <3.10 and requirements.txt for backports

This commit is contained in:
2025-10-06 16:53:52 +02:00
parent b638237f66
commit c68aa29141
3 changed files with 8 additions and 11 deletions
-10
View File
@@ -33,16 +33,6 @@ jobs:
pip install pytest
pip install -r requirements.txt
- name: Backport to 3.8
if: matrix.python-version == '3.8'
run: |
pip install backports.zoneinfo
- name: Backport StrEnum
if: matrix.python-version < '3.11'
run: |
pip install backports.strenum
- name: Test with pytest
run: |
python -m pytest tests
+6 -1
View File
@@ -13,7 +13,12 @@ import logging
try:
from enum import StrEnum
except ImportError:
from backports.strenum import StrEnum
try:
# python <3.11 try to use backports
from backports.strenum import StrEnum
except ImportError:
# python <3.10 use Enum instead
from enum import Enum as StrEnum
@dataclass
class CommandlineParameterConfig:
+2
View File
@@ -2,3 +2,5 @@ numpy
h5py
orsopy
numba
backports.strenum; python_version<"3.11"
backports.zoneinfo; python_version<"3.9"