[PyOV] Drop Python 3.7 in OpenVINO Runtime (#19534)

* Drop 37

* Fix linter

* Minor change

* Minor changes

* update add_lib_path

* Minor changes

* Update pypi pages

* Update pypi pages

* Fix linter

* Minor changes

---------

Co-authored-by: Anastasia Kuporosova <anastasia.kuporosova@intel.com>
Co-authored-by: Jan Iwaszkiewicz <jan.iwaszkiewicz@intel.com>
Co-authored-by: Ilya Lavrenov <ilya.lavrenov@intel.com>
This commit is contained in:
Przemyslaw Wysocki 2023-10-06 10:28:27 +02:00 committed by Alexander Nesterov
parent 5ba7d9b72d
commit 664dc77078
14 changed files with 27 additions and 31 deletions

View File

@ -14,8 +14,8 @@ import json
from pathlib import Path
if sys.version_info[:2] < (3, 7):
raise Exception("Python version must be >= 3.7")
if sys.version_info[:2] < (3, 8):
raise Exception("Python version must be >= 3.8")
class ConfigException(Exception):

View File

@ -30,7 +30,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.7'
python-version: '3.8'
- name: Install dependencies
run: python -m pip install -r src/bindings/python/requirements_test.txt

View File

@ -1,4 +1,3 @@
clang==11.1.0; python_version == '3.7'
clang==12.0.1; python_version == '3.8'
clang==12.0.1; python_version == '3.9'
clang==14.0; python_version == '3.10'

View File

@ -65,7 +65,7 @@ set "PATH=%OPENVINO_LIB_PATHS%;%PATH%"
:: Check if Python is installed
set PYTHON_VERSION_MAJOR=3
set MIN_REQUIRED_PYTHON_VERSION_MINOR=7
set MIN_REQUIRED_PYTHON_VERSION_MINOR=8
set MAX_SUPPORTED_PYTHON_VERSION_MINOR=11
python --version 2>NUL

View File

@ -99,7 +99,7 @@ if command -v lsb_release >/dev/null 2>&1; then
fi
PYTHON_VERSION_MAJOR="3"
MIN_REQUIRED_PYTHON_VERSION_MINOR="7"
MIN_REQUIRED_PYTHON_VERSION_MINOR="8"
MAX_SUPPORTED_PYTHON_VERSION_MINOR="11"
check_python_version () {

View File

@ -105,16 +105,16 @@ def get_dtype(ngraph_type: NgraphType) -> np.dtype:
def get_ndarray(data: NumericData) -> np.ndarray:
"""Wrap data into a numpy ndarray."""
if type(data) == np.ndarray:
if isinstance(data, np.ndarray):
return data
return np.array(data)
def get_shape(data: NumericData) -> TensorShape:
"""Return a shape of NumericData."""
if type(data) == np.ndarray:
if isinstance(data, np.ndarray):
return data.shape # type: ignore
elif type(data) == list:
if isinstance(data, list):
return [len(data)] # type: ignore
return []

View File

@ -121,16 +121,16 @@ def get_numpy_ctype(openvino_type: Type) -> type:
def get_ndarray(data: NumericData) -> np.ndarray:
"""Wrap data into a numpy ndarray."""
if type(data) == np.ndarray:
if isinstance(data, np.ndarray):
return data # type: ignore
return np.array(data)
def get_shape(data: NumericData) -> TensorShape:
"""Return a shape of NumericData."""
if type(data) == np.ndarray:
if isinstance(data, np.ndarray):
return data.shape # type: ignore
elif type(data) == list:
if isinstance(data, list):
return [len(data)] # type: ignore
return []

View File

@ -36,10 +36,7 @@ def _add_openvino_libs_to_search_path() -> None:
lib_path = os.path.join(os.path.dirname(__file__), lib)
if os.path.isdir(lib_path):
# On Windows, with Python >= 3.8, DLLs are no longer imported from the PATH.
if (3, 8) <= sys.version_info:
os.add_dll_directory(os.path.abspath(lib_path))
else:
os.environ["PATH"] = os.path.abspath(lib_path) + ";" + os.environ["PATH"]
os.add_dll_directory(os.path.abspath(lib_path))
def add_openvino_libs_to_path() -> None:

View File

@ -47,8 +47,8 @@ def test_any_dict(value_dict, value_type, data_type):
assert isinstance(ovany.value, dict)
assert ovany[key] == list(value_dict.values())[0]
assert len(ovany.value) == 1
assert type(ovany.value[key]) == value_type
assert type(list(value_dict.values())[0]) == data_type
assert isinstance(ovany.value[key], value_type)
assert isinstance(list(value_dict.values())[0], data_type)
assert ovany.get() == value_dict

View File

@ -195,7 +195,7 @@ def test_simple_if_basic():
if_node.set_function(0, then_body)
subgraph_func = if_node.get_function(0)
assert type(subgraph_func) == type(then_body)
assert isinstance(subgraph_func, type(then_body))
assert compare_models(subgraph_func, then_body)
assert subgraph_func._get_raw_address() == then_body._get_raw_address()

View File

@ -142,7 +142,7 @@ def test_loop_basic():
subgraph_func = loop.get_function()
assert type(subgraph_func) == type(graph_body)
assert isinstance(subgraph_func, type(graph_body))
assert subgraph_func._get_raw_address() == graph_body._get_raw_address()
assert compare_models(subgraph_func, graph_body)
assert loop.get_special_body_ports() == body_ports

View File

@ -121,7 +121,7 @@ def test_tensor_iterator_basic():
subgraph_func = ti.get_function()
assert type(subgraph_func) == type(graph_body)
assert isinstance(subgraph_func, type(graph_body))
assert compare_models(subgraph_func, graph_body)
assert subgraph_func._get_raw_address() == graph_body._get_raw_address()
assert ti.get_num_iterations() == 16

View File

@ -472,7 +472,7 @@ def test_single_property_setting(device):
core.set_property(device, streams.num(streams.Num.AUTO))
assert props.streams.Num.AUTO.to_integer() == -1
assert type(core.get_property(device, streams.num())) == int
assert isinstance(core.get_property(device, streams.num()), int)
@pytest.mark.skipif(os.environ.get("TEST_DEVICE", "CPU") != "CPU", reason=f"Cannot run test on device {os.environ.get('TEST_DEVICE')}, Plugin specific test")
@ -539,10 +539,10 @@ def test_core_cpu_properties(properties_to_set):
assert core.get_property("CPU", streams.num) == 5
# RO properties
assert type(core.get_property("CPU", props.supported_properties)) == dict
assert type(core.get_property("CPU", props.available_devices)) == list
assert type(core.get_property("CPU", props.optimal_number_of_infer_requests)) == int
assert type(core.get_property("CPU", props.range_for_streams)) == tuple
assert type(core.get_property("CPU", props.range_for_async_infer_requests)) == tuple
assert type(core.get_property("CPU", device.full_name)) == str
assert type(core.get_property("CPU", device.capabilities)) == list
assert isinstance(core.get_property("CPU", props.supported_properties), dict)
assert isinstance(core.get_property("CPU", props.available_devices), list)
assert isinstance(core.get_property("CPU", props.optimal_number_of_infer_requests), int)
assert isinstance(core.get_property("CPU", props.range_for_streams), tuple)
assert isinstance(core.get_property("CPU", props.range_for_async_infer_requests), tuple)
assert isinstance(core.get_property("CPU", device.full_name), str)
assert isinstance(core.get_property("CPU", device.capabilities), list)

View File

@ -17,8 +17,8 @@
import sys
if sys.version_info[0] < 3 or (sys.version_info[0] == 3 and sys.version_info[1] < 7):
exit("Python* 3.7 or higher is required to run the Deployment Manager.")
if sys.version_info[0] < 3 or (sys.version_info[0] == 3 and sys.version_info[1] < 8):
exit("Python* 3.8 or higher is required to run the Deployment Manager.")
if __name__ == '__main__':
from deployman.main import main