deal with backport StrEnum doesn't work with python <3.10 and requirements.txt for backports
This commit is contained in:
@@ -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
@@ -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,3 +2,5 @@ numpy
|
||||
h5py
|
||||
orsopy
|
||||
numba
|
||||
backports.strenum; python_version<"3.11"
|
||||
backports.zoneinfo; python_version<"3.9"
|
||||
|
||||
Reference in New Issue
Block a user