From 9ce902d82c946593bb6b32cd1029e50351d8a95d Mon Sep 17 00:00:00 2001 From: Artur Glavic Date: Mon, 6 Oct 2025 16:36:26 +0200 Subject: [PATCH] Allow StrEnum from backports for python <3.11 --- .github/workflows/unit_tests.yml | 5 +++++ eos/options.py | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index be278bc..c6ffe74 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -36,6 +36,11 @@ jobs: 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 diff --git a/eos/options.py b/eos/options.py index 3975994..0c217ed 100644 --- a/eos/options.py +++ b/eos/options.py @@ -3,7 +3,6 @@ Classes for stroing various configurations needed for reduction. """ import argparse from dataclasses import dataclass, field, Field, fields, MISSING -from enum import StrEnum from typing import get_args, get_origin, List, Optional, Tuple, Union from datetime import datetime from os import path @@ -11,6 +10,11 @@ import numpy as np import logging +try: + from enum import StrEnum +except ImportError: + from backports.strenum import StrEnum + @dataclass class CommandlineParameterConfig: argument: str # default parameter for command line resutign ins "--argument"