OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[PyOV] Migrate from direct setup.py calls in Benchmark App and Docs CI (#27220)
Przemyslaw Wysocki6f001e9a37d8
diff --git a/.github/workflows/build_doc.yml b/.github/workflows/build_doc.ymlindex 6623f5ea182..6f38ff0214b 100644--- a/.github/workflows/build_doc.yml+++ b/.github/workflows/build_doc.yml@@ -41,7 +41,7 @@ jobs:- name: Install python dependenciesrun: |python3 -m pip install -r docs/requirements.txt- (cd docs/openvino_sphinx_theme && python3 setup.py install)+ (cd docs/openvino_sphinx_theme && python3 -m pip install .)python3 -m pip install docs/openvino_custom_sphinx_sitemap- name: Download and install doxygendiff --git a/cmake/developer_package/packaging/common-libraries.cmake b/cmake/developer_package/packaging/common-libraries.cmakeindex 0ec054da853..4ac0124d308 100644--- a/cmake/developer_package/packaging/common-libraries.cmake+++ b/cmake/developer_package/packaging/common-libraries.cmake@@ -30,7 +30,7 @@ macro(ov_common_libraries_cpack_set_dirs)ov_get_pyversion(pyversion)if(pyversion)- # should not be used in production; only by setup.py install+ # should not be used in production; only by pip installset(OV_CPACK_PYTHONDIR lib/${pyversion}/site-packages)endif()@@ -94,7 +94,7 @@ macro(ov_define_component_include_rules)set(OV_CPACK_COMP_PYTHON_OPENVINO_EXCLUDE_ALL EXCLUDE_FROM_ALL)set(OV_CPACK_COMP_BENCHMARK_APP_EXCLUDE_ALL ${OV_CPACK_COMP_PYTHON_OPENVINO_EXCLUDE_ALL})set(OV_CPACK_COMP_OVC_EXCLUDE_ALL ${OV_CPACK_COMP_PYTHON_OPENVINO_EXCLUDE_ALL})- # we don't pack artifacts of setup.py install, because it's called explicitly in conda / brew+ # we don't pack artifacts of pip install, because it's called explicitly in conda / brew# or not used at all like in cases with conan / vcpkgset(OV_CPACK_COMP_PYTHON_OPENVINO_PACKAGE_EXCLUDE_ALL ${OV_CPACK_COMP_PYTHON_OPENVINO_EXCLUDE_ALL})# we don't need wheels in the distribution packagesdiff --git a/cmake/developer_package/packaging/debian/debian.cmake b/cmake/developer_package/packaging/debian/debian.cmakeindex 2b95fcfde5c..a23d5290044 100644--- a/cmake/developer_package/packaging/debian/debian.cmake+++ b/cmake/developer_package/packaging/debian/debian.cmake@@ -95,12 +95,12 @@ macro(ov_define_component_include_rules)endif()# pythonif(ENABLE_PYTHON_PACKAGING)- # pack artifacts of setup.py install+ # pack artifacts of pip installunset(OV_CPACK_COMP_PYTHON_OPENVINO_PACKAGE_EXCLUDE_ALL)else()set(OV_CPACK_COMP_PYTHON_OPENVINO_PACKAGE_EXCLUDE_ALL EXCLUDE_FROM_ALL)endif()- # we don't pack python components itself, we pack artifacts of setup.py install+ # we don't pack python components itself, we pack artifacts of pip installset(OV_CPACK_COMP_PYTHON_OPENVINO_EXCLUDE_ALL EXCLUDE_FROM_ALL)set(OV_CPACK_COMP_BENCHMARK_APP_EXCLUDE_ALL ${OV_CPACK_COMP_PYTHON_OPENVINO_EXCLUDE_ALL})set(OV_CPACK_COMP_OVC_EXCLUDE_ALL ${OV_CPACK_COMP_PYTHON_OPENVINO_EXCLUDE_ALL})diff --git a/cmake/developer_package/packaging/rpm/rpm.cmake b/cmake/developer_package/packaging/rpm/rpm.cmakeindex 45d9b0c0ca2..bb4e7942d76 100644--- a/cmake/developer_package/packaging/rpm/rpm.cmake+++ b/cmake/developer_package/packaging/rpm/rpm.cmake@@ -86,12 +86,12 @@ macro(ov_define_component_include_rules)endif()# pythonif(ENABLE_PYTHON_PACKAGING)- # pack artifacts of setup.py install+ # pack artifacts of pip installunset(OV_CPACK_COMP_PYTHON_OPENVINO_PACKAGE_EXCLUDE_ALL)else()set(OV_CPACK_COMP_PYTHON_OPENVINO_PACKAGE_EXCLUDE_ALL EXCLUDE_FROM_ALL)endif()- # we don't pack python components itself, we pack artifacts of setup.py install+ # we don't pack python components itself, we pack artifacts of pip installset(OV_CPACK_COMP_PYTHON_OPENVINO_EXCLUDE_ALL EXCLUDE_FROM_ALL)set(OV_CPACK_COMP_BENCHMARK_APP_EXCLUDE_ALL ${OV_CPACK_COMP_PYTHON_OPENVINO_EXCLUDE_ALL})set(OV_CPACK_COMP_OVC_EXCLUDE_ALL ${OV_CPACK_COMP_PYTHON_OPENVINO_EXCLUDE_ALL})diff --git a/docs/documentation_build_instructions.md b/docs/documentation_build_instructions.mdindex d9219454b86..a1412cfc3f3 100644--- a/docs/documentation_build_instructions.md+++ b/docs/documentation_build_instructions.md@@ -26,7 +26,7 @@ $ source env/bin/activate```5. Install the sphinx theme```-(env) $ cd docs/openvino_sphinx_theme && python setup.py install && cd -+(env) $ python -m pip install docs/openvino_sphinx_theme``````6. Install the custom sphinx sitemap```diff --git a/docs/openvino_sphinx_theme/README.md b/docs/openvino_sphinx_theme/README.mdindex 7931c481c30..2e82fa06e8c 100644--- a/docs/openvino_sphinx_theme/README.md+++ b/docs/openvino_sphinx_theme/README.md@@ -4,7 +4,8 @@1. Install the `openvino_sphinx_theme` using `python`:```-python setup.py install --user+cd openvino/docs/openvino_sphinx_theme+python -m pip install --user .```2. Update the `html_theme` variable in your `conf.py`:diff --git a/tools/benchmark_tool/requirements.txt b/tools/benchmark_tool/requirements.txtindex f8f5f92cdde..5594ff31cd3 100644--- a/tools/benchmark_tool/requirements.txt+++ b/tools/benchmark_tool/requirements.txt@@ -1,2 +1 @@--c ../constraints.txtnumpy>=1.16.6,<2.1.0diff --git a/tools/benchmark_tool/setup.py b/tools/benchmark_tool/setup.pyindex 0df9a9bc923..98f2a369a60 100644--- a/tools/benchmark_tool/setup.py+++ b/tools/benchmark_tool/setup.py@@ -6,92 +6,18 @@"""Use this script to create a wheel with OpenVINO™ Python* tools:-$ python setup.py sdist bdist_wheel+$ python -m pip wheel ."""-import pkg_resources-import refrom setuptools import setup, find_packages-from pathlib import Path-from typing import Dict, List+with open('requirements.txt', 'r', encoding='utf-8') as f:+ raw_contents = f.readlines()+ reqs = [line.strip() for line in raw_contents]+with open('README.md', 'r', encoding='utf-8') as f:long_description = f.read()--def read_constraints(path: str='../constraints.txt') -> Dict[str, List[str]]:- """- Read a constraints.txt file and return a dict- of {package_name: [required_version_1, required_version_2]}.- The dict values are a list because a package can be mentioned- multiple times, for example:- mxnet~=1.2.0; sys_platform == 'win32'- mxnet>=1.7.0; sys_platform != 'win32'- """- constraints = {}- with open(Path(__file__).resolve().parent / path) as f:- raw_constraints = f.readlines()- for line in raw_constraints:- # skip comments- if line.startswith('#'):- continue- line = line.replace('\n', '')- # read constraints for that package- package, delimiter, constraint = re.split('(~|=|<|>|;)', line, maxsplit=1)- # if there is no entry for that package, add it- if constraints.get(package) is None:- constraints[package] = [delimiter + constraint]- # else add another entry for that package- else:- constraints[package].extend([delimiter + constraint])- return constraints---def read_requirements(path: str) -> List[str]:- """- Read a requirements.txt file and return a list- of requirements. Three cases are supported, the- list corresponds to priority:- 1. version specified in requirements.txt- 2. version specified in constraints.txt- 3. version unbound-- Putting environment markers into constraints.txt is prone to bugs.- They should be specified in requirements.txt files.- """- requirements = []- constraints = read_constraints()- with open(Path(__file__).resolve().parent / path) as f:- raw_requirements = f.readlines()- for line in raw_requirements:- # skip comments and constraints link- if line.startswith(('#', '-c')):- continue- # get rid of newlines- line = line.replace('\n', '')- # if version is specified (non-word chars present)- package_constraint = constraints.get(line.split(';')[0])- if re.search('(~|=|<|>)', line) and len(line.split(';'))>1:- if package_constraint: # both markers and versions specified- marker_index = line.find(";")- # insert package version between package name and environment markers- line = line[:marker_index] \- + ",".join([constraint for constraint in package_constraint]) \- + line[marker_index:]- requirements.append(line)- # else get version from constraints- else:- constraint = constraints.get(line)- # if version found in constraints.txt- if constraint:- for marker in constraint:- requirements.append(line+marker)- # else version is unbound- else:- requirements.append(line)- return requirements--setup(name='benchmark_tool',version='0.0.0',@@ -111,6 +37,7 @@ setup('Operating System :: OS Independent',],packages=find_packages(),- install_requires=read_requirements('requirements.txt'),+ install_requires=reqs,+ data_files=[('.', ['requirements.txt'])],python_requires='>=3.9',)