Skip to content

Commit

Permalink
[PyOV] Legacy IE Python API removal (openvinotoolkit#20908)
Browse files Browse the repository at this point in the history
* [PyOV] Legacy IE Python API removal

* clean configs &cmake

* remove ngraph

* remove from yml

* try to fix build

* clean up

* remove old api from python snippets and docs (#170)

* remove old api from python snippets

* pysnippets removal p2

* remove ngraph snippet

* remove old api from docs

* remove migration snippets

* remove compatibility req after refactoring on master

* fix after merge

* fix after merge

* Update docs/articles_en/documentation/openvino_legacy_features/api_2_0_transition_guide/graph_construction.rst
  • Loading branch information
akuporos authored Jan 11, 2024
1 parent 0ad75bd commit a561a2a
Show file tree
Hide file tree
Showing 135 changed files with 2 additions and 15,970 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/code_style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ jobs:
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r ./src/bindings/python/requirements.txt
# Add for -DENABLE_PYTHON=ON, no cython
python3 -m pip install -r ./src/bindings/python/src/compatibility/openvino/requirements-dev.txt
# Run cmake with -DENABLE_PROFILING_ITT=ON -DSELECTIVE_BUILD=COLLECT in order to enable codestyle check for ITT collector
- name: CMake configure
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ jobs:
python3 -m pip install --upgrade pip
python3 -m pip install -r ${{ github.workspace }}/src/bindings/python/wheel/requirements-dev.txt
python3 -m pip install -r ${{ github.workspace }}/src/bindings/python/requirements.txt
# For running Python API tests
python3 -m pip install -r ${{ github.workspace }}/src/bindings/python/src/compatibility/openvino/requirements-dev.txt
# For running Paddle frontend unit tests
python3 -m pip install -r ${{ github.workspace }}/src/frontends/paddle/tests/requirements.txt
# For running ONNX frontend unit tests
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/fedora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ jobs:
python3 -m pip install -U pip
# For Python API: build and wheel packaging
python3 -m pip install -r ${OPENVINO_REPO}/src/bindings/python/wheel/requirements-dev.txt
python3 -m pip install -r ${OPENVINO_REPO}/src/bindings/python/src/compatibility/openvino/requirements-dev.txt
# For running ONNX frontend unit tests
python3 -m pip install --force-reinstall -r ${OPENVINO_REPO}/src/frontends/onnx/tests/requirements.txt
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ jobs:
run: |
# For Python API: build and wheel packaging
python3 -m pip install -r ${OPENVINO_REPO}/src/bindings/python/wheel/requirements-dev.txt
python3 -m pip install -r ${OPENVINO_REPO}/src/bindings/python/src/compatibility/openvino/requirements-dev.txt
# For running ONNX frontend unit tests
python3 -m pip install --force-reinstall -r ${OPENVINO_REPO}/src/frontends/onnx/tests/requirements.txt
Expand Down Expand Up @@ -204,7 +203,6 @@ jobs:
run: |
/usr/bin/python3.8 -m pip install -U pip
/usr/bin/python3.8 -m pip install -r ${OPENVINO_REPO}/src/bindings/python/wheel/requirements-dev.txt
/usr/bin/python3.8 -m pip install -r ${OPENVINO_REPO}/src/bindings/python/src/compatibility/openvino/requirements-dev.txt
cmake -UPYTHON* \
-DENABLE_PYTHON_PACKAGING=ON \
-DENABLE_TESTS=OFF \
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/linux_arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ jobs:
run: |
# For Python API: build and wheel packaging
python3 -m pip install -r ${OPENVINO_REPO}/src/bindings/python/wheel/requirements-dev.txt
python3 -m pip install -r ${OPENVINO_REPO}/src/bindings/python/src/compatibility/openvino/requirements-dev.txt
# For running ONNX frontend unit tests
python3 -m pip install --force-reinstall -r ${OPENVINO_REPO}/src/frontends/onnx/tests/requirements.txt
Expand Down Expand Up @@ -203,7 +202,6 @@ jobs:
run: |
/usr/bin/python3.8 -m pip install -U pip
/usr/bin/python3.8 -m pip install -r ${OPENVINO_REPO}/src/bindings/python/wheel/requirements-dev.txt
/usr/bin/python3.8 -m pip install -r ${OPENVINO_REPO}/src/bindings/python/src/compatibility/openvino/requirements-dev.txt
cmake -UPYTHON* \
-DENABLE_PYTHON_PACKAGING=ON \
-DENABLE_TESTS=OFF \
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/linux_riscv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ jobs:
python3 -m venv ${OPENVINO_BUILD_DIR}/env
source ${OPENVINO_BUILD_DIR}/env/bin/activate
python3 -m pip install -r ${OPENVINO_REPO}/src/bindings/python/wheel/requirements-dev.txt
python3 -m pip install -r ${OPENVINO_REPO}/src/bindings/python/src/compatibility/openvino/requirements-dev.txt
python3 -m pip install conan
- name: Install RISC-V native debian packages
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,6 @@ jobs:
python3 -m pip install -r ${{ env.OPENVINO_REPO }}/src/bindings/python/wheel/requirements-dev.txt
python3 -m pip install -r ${{ env.OPENVINO_REPO }}/src/bindings/python/requirements.txt
# For running Python API tests
python3 -m pip install -r ${{ env.OPENVINO_REPO }}/src/bindings/python/src/compatibility/openvino/requirements-dev.txt
# For running ONNX frontend unit tests
python3 -m pip install --force-reinstall -r ${{ env.OPENVINO_REPO }}/src/frontends/onnx/tests/requirements.txt
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/mac_arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@ jobs:
python3 -m pip install -r ${{ env.OPENVINO_REPO }}/src/bindings/python/wheel/requirements-dev.txt
python3 -m pip install -r ${{ env.OPENVINO_REPO }}/src/bindings/python/requirements.txt
# For running Python API tests
python3 -m pip install -r ${{ env.OPENVINO_REPO }}/src/bindings/python/src/compatibility/openvino/requirements-dev.txt
# For running ONNX frontend unit tests
python3 -m pip install --force-reinstall -r ${{ env.OPENVINO_REPO }}/src/frontends/onnx/tests/requirements.txt
Expand Down
50 changes: 0 additions & 50 deletions .github/workflows/py_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,42 +53,6 @@ jobs:
name: samples_diff
path: samples_diff.diff

# IE Python API Flake code-style
- name: Run flake8 on IE Python API
run: python -m flake8 ./ --config=setup.cfg
working-directory: src/bindings/python/src/compatibility/openvino

- name: Create code style diff for IE Python API
if: failure()
run: |
python -m black -l 160 -S ./
git diff > ie_python_diff.diff
working-directory: src/bindings/python/src/compatibility/openvino

- uses: actions/upload-artifact@v3
if: failure()
with:
name: ie_python_diff
path: ie_python_diff.diff

# nGraph Python API Flake code-style
- name: Run flake8 on nGraph Python API
run: python -m flake8 ./src/compatibility/ngraph --config=setup.cfg
working-directory: src/bindings/python

- name: Create code style diff for nGraph Python API
if: failure()
run: |
python -m black -l 160 -S ./
git diff > pyngraph_diff.diff
working-directory: src/bindings/python/src/compatibility/ngraph

- uses: actions/upload-artifact@v3
if: failure()
with:
name: pyngraph_diff
path: pyngraph_diff.diff

# Python API 2.0 Flake code-style
- name: Run flake8 on Python API 2.0
run: python -m flake8 ./src/openvino --config=setup.cfg
Expand Down Expand Up @@ -131,25 +95,11 @@ jobs:
run: python -m flake8 tests/ --config=setup.cfg
working-directory: src/bindings/python

# IE Python API mypy check
- name: Run mypy on IE Python API
run: python -m mypy ./ --config-file ./setup.cfg
working-directory: src/bindings/python/src/compatibility/openvino

# nGraph Python API mypy check
- name: Run mypy on nGraph Python API
run: python -m mypy ./src/compatibility/ngraph --config-file ./setup.cfg
working-directory: src/bindings/python

# Python API 2.0 mypy check
- name: Run mypy on Python API 2.0
run: python -m mypy ./src/openvino --config-file ./setup.cfg
working-directory: src/bindings/python

- name: Run Bandit
run: python -m bandit -r ./ -f screen
working-directory: src/bindings/python/src/compatibility/openvino

# layer_tests Flake code-style
- name: Run flake8 on python tests in openvino/tests/layer_tests
run: |
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ jobs:
run: |
# For Python API: build and wheel packaging
python3 -m pip install -r ${{ env.OPENVINO_REPO }}/src/bindings/python/wheel/requirements-dev.txt
python3 -m pip install -r ${{ env.OPENVINO_REPO }}/src/bindings/python/src/compatibility/openvino/requirements-dev.txt
# For running ONNX frontend unit tests
python3 -m pip install --force-reinstall -r ${{ env.OPENVINO_REPO }}/src/frontends/onnx/tests/requirements.txt
Expand Down
38 changes: 2 additions & 36 deletions src/bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ endif()
# Check python requirements
#

set(ie_build_python_req "${OpenVINOPython_SOURCE_DIR}/src/compatibility/openvino/requirements-dev.txt")

function(ov_check_python_build_conditions)
# user explicitly specified ENABLE_PYTHON=ON
if(ENABLE_PYTHON)
Expand Down Expand Up @@ -94,42 +92,19 @@ function(ov_check_python_build_conditions)
message(${message_mode} "Python 3.x Interpreter and Development.Module components are not found. OpenVINO Python API will be turned off (ENABLE_PYTHON is OFF)")
endif()

# check for Cython requirement for build IE API 1.0
ov_check_pip_packages(REQUIREMENTS_FILE ${ie_build_python_req}
RESULT_VAR ie_build_python_req_FOUND
WARNING_MESSAGE "install python3 -m pip install -r ${ie_build_python_req} for IE API 1.0 requirements"
MESSAGE_MODE TRACE)

# cython can be installed as a debian package, so pip requirements can be unsatisfied
# so, let's check to find cython anyway
if(NOT ie_build_python_req_FOUND)
find_package(Cython QUIET
PATHS "${OpenVINOPython_SOURCE_DIR}/src/compatibility/openvino/cmake"
NO_CMAKE_FIND_ROOT_PATH
NO_DEFAULT_PATH)
if(CYTHON_VERSION VERSION_GREATER_EQUAL 0.29)
set(ie_build_python_req_FOUND ON)
else()
message(${message_mode} "Python requirements '${ie_build_python_req}' are missed, IE Python API 1.0 will not be built (ENABLE_PYTHON is OFF)")
endif()
endif()

if(NOT OV_GENERATOR_MULTI_CONFIG AND CMAKE_BUILD_TYPE STREQUAL "Debug" AND CMAKE_DEBUG_POSTFIX)
set(python_debug ON)
message(${message_mode} "Building python bindings in debug configuration is not supported on your platform (ENABLE_PYTHON is OFF)")
else()
set(python_debug OFF)
endif()

if((Python3_Development.Module_FOUND OR Python3_Development_FOUND) AND
ie_build_python_req_FOUND AND NOT python_debug)
if((Python3_Development.Module_FOUND OR Python3_Development_FOUND) AND NOT python_debug)
set(ENABLE_PYTHON_DEFAULT ON PARENT_SCOPE)
else()
set(ENABLE_PYTHON_DEFAULT OFF PARENT_SCOPE)
endif()

# to disable API 1.0
set(ie_build_python_req_FOUND ${ie_build_python_req_FOUND} PARENT_SCOPE)
endfunction()

ov_check_python_build_conditions()
Expand All @@ -155,7 +130,6 @@ function(ov_check_init_files_alignment init_files)
endfunction()

set(INIT_FILES_RUNTIME "${OpenVINOPython_SOURCE_DIR}/src/openvino/__init__.py"
"${OpenVINOPython_SOURCE_DIR}/src/compatibility/openvino/__init__.py"
"${OpenVINO_SOURCE_DIR}/tools/ovc/openvino/__init__.py"
"${OpenVINO_SOURCE_DIR}/tools/benchmark_tool/openvino/__init__.py")

Expand Down Expand Up @@ -209,7 +183,7 @@ ov_dependent_option(ENABLE_WHEEL "Build wheel packages for PyPI" ${ENABLE_WHEEL_

if(NOT ENABLE_PYTHON)
if(CMAKE_SOURCE_DIR STREQUAL OpenVINOPython_SOURCE_DIR)
message(FATAL_ERROR "Python OpenVINO API build requirements are not satisfied. Please, install ${ie_build_python_req}")
message(FATAL_ERROR "Python OpenVINO API build requirements are not satisfied.")
else()
return()
endif()
Expand All @@ -236,15 +210,8 @@ if(NOT pybind11_FOUND)
add_subdirectory(thirdparty/pybind11 EXCLUDE_FROM_ALL)
endif()

add_subdirectory(src/compatibility/pyngraph)
add_subdirectory(src/pyopenvino)

if(ie_build_python_req_FOUND)
add_subdirectory(src/compatibility/openvino)
else()
message(WARNING "NOTE: Python API for OpenVINO 1.0 is disabled")
endif()

#
# Packaging
#
Expand Down Expand Up @@ -312,7 +279,6 @@ macro(ov_define_setup_py_dependencies)
endif()
endforeach()

file(GLOB_RECURSE compat_ngraph_py_files ${OpenVINOPython_SOURCE_DIR}/src/compatibility/*.py)
file(GLOB_RECURSE openvino_py_files ${OpenVINOPython_SOURCE_DIR}/src/openvino/*.py)

list(APPEND ov_setup_py_deps
Expand Down
1 change: 0 additions & 1 deletion src/bindings/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ OpenVINO PYTHON API has the following structure:

* [docs](./docs/) - folder that contains developer documentation and code examples.
* [src](./src/) - folder with all source files for Python API.
* [src/compatibility](./src/compatibility/) - sources for compatibility API, including older modules like `ngraph` and `openvino.inference_engine`.
* [src/openvino](./src/openvino/) - Python sources.
* [src/openvino/preprocess](./src/openvino/preprocess/) - Torchvision to OpenVINO preprocessing converter.
* [src/pyopenvino](./src/pyopenvino/) - C++ sources.
Expand Down
1 change: 0 additions & 1 deletion src/bindings/python/docs/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ OpenVINO can be built based on specific virtual environments such as [venv](http
cd <openvino_repo>
pip install -r src/bindings/python/requirements.txt
pip install -r src/bindings/python/requirements_test.txt
pip install -r src/bindings/python/src/compatibility/openvino/requirements-dev.txt
```
If `-DENABLE_WHEEL=ON` flag is present in `cmake` command, additionally install wheel requirements:
```
Expand Down
1 change: 0 additions & 1 deletion src/bindings/python/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ docstring-convention = google
enable-extensions = G
per-file-ignores =
src/openvino/runtime/*/ops.py: VNE001,VNE003
src/compatibility/ngraph/*: C101,C812,C819,CCE001,E800,N806,P101,RST201,RST202,RST203,RST206,VNE001,VNE003
src/openvino/preprocess/torchvision/*: N801, VNE001
*__init__.py: F401

Expand Down
Loading

0 comments on commit a561a2a

Please sign in to comment.