Skip to content

Commit

Permalink
Add input continue warning for wrong ultralytics version in model dep…
Browse files Browse the repository at this point in the history
…loy (#185)

* Add input continue warning for wrong ultralytics version in model deploy

* Put import sys in correct order in versions.py

* Bump package version to 1.1.6
  • Loading branch information
SolomonLake authored Sep 7, 2023
1 parent 78c15e9 commit 66aa98e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion roboflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from roboflow.core.workspace import Workspace
from roboflow.util.general import write_line

__version__ = "1.1.5"
__version__ = "1.1.6"


def check_key(api_key, model, notebook, num_retries=0):
Expand Down
2 changes: 1 addition & 1 deletion roboflow/core/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ def deploy(self, model_type: str, model_path: str) -> None:
)

print_warn_for_wrong_dependencies_versions(
[("ultralytics", "==", "8.0.134")]
[("ultralytics", "==", "8.0.134")], ask_to_continue=True
)

elif "yolov5" in model_type or "yolov7" in model_type:
Expand Down
9 changes: 8 additions & 1 deletion roboflow/util/versions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
from importlib import import_module
from typing import List, Tuple

Expand Down Expand Up @@ -42,13 +43,19 @@ def get_wrong_dependencies_versions(


def print_warn_for_wrong_dependencies_versions(
dependencies_versions: List[Tuple[str, str, str]]
dependencies_versions: List[Tuple[str, str, str]], ask_to_continue: bool = False
):
wrong_dependencies_versions = get_wrong_dependencies_versions(dependencies_versions)
for dependency, order, version, module_version in wrong_dependencies_versions:
print(
f"Dependency {dependency}{order}{version} is required but found version={module_version}, to fix: `pip install {dependency}{order}{version}`"
)
if ask_to_continue:
answer = input(
f"Would you like to continue with the wrong version of {dependency}? y/n: "
)
if answer.lower() != "y":
sys.exit(1)


def warn_for_wrong_dependencies_versions(
Expand Down

0 comments on commit 66aa98e

Please sign in to comment.