Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use StrEnum for python 3.11 compatibility (Fixes #16) #21

Merged
merged 4 commits into from
Oct 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
Comment on lines +192 to +194
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wasn't possible to use StrEnum in this python module, since this module is used for installing all 3rd party deps, so it would be a catch-22

v = Version(f"{v.major}.{v.minor + 1}.0")
else:
v = Version(f"{v.major}.{v.minor}.{v.micro + 1}")
Expand Down