Skip to content

Commit

Permalink
Use StrEnum for python 3.11 compatibility (Fixes #16) (#21)
Browse files Browse the repository at this point in the history
* Use StrEnum for python 3.11 compatability (Fixes #16)

* Can't use StrEnum in script that installs StrEnum

* Add python 3.11 to version matrix

* Format
  • Loading branch information
tleyden authored Oct 21, 2023
1 parent 94ccd4d commit 44e3182
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

strategy:
matrix:
python-version: [ "3.8", "3.9", "3.10" ]
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
fail-fast: false

steps:
Expand Down
4 changes: 2 additions & 2 deletions arcee/dalm.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from enum import Enum
from typing import Any, Dict, List, Literal, Optional

from pydantic import BaseModel, model_validator
from strenum import StrEnum

from arcee.api_handler import make_request
from arcee.schemas.routes import Route
Expand All @@ -12,7 +12,7 @@ def check_model_status(name: str) -> Dict[str, str]:
return make_request("get", route)


class FilterType(str, Enum):
class FilterType(StrEnum):
fuzzy_search = "fuzzy_search"
strict_search = "strict_search"

Expand Down
4 changes: 2 additions & 2 deletions arcee/schemas/routes.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from enum import Enum
from strenum import StrEnum


class Route(str, Enum):
class Route(StrEnum):
contexts = "contexts"
train_model = "models/train"
train_model_status = "models/status/{id_or_name}"
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ dependencies = [
"requests",
"typer",
"rich",
"pydantic"
"pydantic",
"StrEnum"
]

[project.scripts]
Expand Down
4 changes: 2 additions & 2 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ def _bump_version(version: str, bump: Optional[BumpType] = None) -> str:
from packaging.version import Version

v = Version(version)
if bump == BumpType.MAJOR:
if bump == BumpType.MAJOR.value:
v = Version(f"{v.major + 1}.0.0")
elif bump == BumpType.MINOR:
elif bump == BumpType.MINOR.value:
v = Version(f"{v.major}.{v.minor + 1}.0")
else:
v = Version(f"{v.major}.{v.minor}.{v.micro + 1}")
Expand Down

0 comments on commit 44e3182

Please sign in to comment.