roboflow / inference

A fast, easy-to-use, production-ready inference server for computer vision supporting deployment of many popular model architectures and fine-tuned models.
https://inference.roboflow.com
Other
1.12k stars 84 forks source link

fix: replace match statement with if-else for Python 3.9 compatibility #488

Closed natserract closed 1 week ago

natserract commented 1 week ago

Description

There was an issue when installing inference on python version 3.9. Since, python 3.9 doesn't support match statement

https://github.com/roboflow/inference/blob/d6cb89de97438187940bc18440109b78a55960bd/inference/enterprise/device_manager/command_handler.py#L41

inference package requires Python>=3.8,<=3.11.

Type of change

How has this change been tested, please provide a testcase or example of how you tested the change?

Specifications:

Python 3.9.19

Reproduce:

pip install inference

The installation may have completed successfully, but you will encounter errors when package compiled:

Screen Shot 2024-06-27 at 12 55 51 Screen Shot 2024-06-27 at 19 51 51

Any specific deployment considerations

 def validate_python_version(cls, values: Dict) -> Dict:
  """Validate valid python version."""
  if sys.version_info < (3, 8):
      raise ValueError(
          "inference relies on Python 3.8 or higher "
          f"you have Python version: {sys.version}"
      )
  return values

Docs

CLAassistant commented 1 week ago

CLA assistant check
All committers have signed the CLA.

PawelPeczek-Roboflow commented 1 week ago

Seems fine, I will let @robiscoding to review