Skip to content

Commit

Permalink
Repo layout refactoring (#253)
Browse files Browse the repository at this point in the history
* Move sources

* Update samples CMake

* Rename python tests

* Update workflows after renaming

* Update paths
  • Loading branch information
sovrasov authored Jan 16, 2025
1 parent e97b12c commit 6e7d108
Show file tree
Hide file tree
Showing 139 changed files with 29 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
python-version: "3.10"
- name: Install dependencies
run: pip install 'model_api/python/.[docs]'
run: pip install 'src/python/.[docs]'
- name: Install and Generate Doxygen
uses: mattnotmitt/doxygen-action@v1.9.8
- name: Build Docs
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pre_commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Install clang-format
run: sudo apt-get install -y clang-format-10
- name: Install dependencies
run: pip install 'model_api/python/.[full]'
run: pip install 'src/python/.[full]'
- name: Run pre-commit checks
run: pre-commit run --all-files
Unit-Tests:
Expand All @@ -43,6 +43,6 @@ jobs:
with:
python-version: "3.9"
- name: Install dependencies
run: pip install 'model_api/python/.[tests,ovms]'
run: pip install 'src/python/.[tests,ovms]'
- name: Run python unit tests
run: pytest tests/python/unit
16 changes: 8 additions & 8 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@ jobs:
python -m pip install --upgrade build
- name: Build sdist
run: |
sed -i '/omz_tools/d' model_api/python/pyproject.toml
python -m build --sdist model_api/python/
sed -i '/omz_tools/d' src/python/pyproject.toml
python -m build --sdist src/python/
- uses: actions/upload-artifact@v4
with:
name: artifact-sdist
path: model_api/python/dist/*.tar.gz
path: src/python/dist/*.tar.gz
- name: Build wheel
run: |
sed -i '/omz_tools/d' model_api/python/pyproject.toml
python -m build --wheel model_api/python/
sed -i '/omz_tools/d' src/python/pyproject.toml
python -m build --wheel src/python/
- uses: actions/upload-artifact@v4
with:
name: artifact-wheel
path: model_api/python/dist/*.whl
path: src/python/dist/*.whl

publish_package:
name: Publish package
Expand All @@ -52,7 +52,7 @@ jobs:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: model_api/python/dist
path: src/python/dist
pattern: artifact-*
merge-multiple: true
# to determine where to publish the package distribution to PyPI or TestPyPI
Expand All @@ -67,7 +67,7 @@ jobs:
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: model_api/python/dist/*
file: src/python/dist/*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_accuracy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
run: |
source venv/bin/activate
python -m pip install --upgrade pip
pip install model_api/python/[tests,build] --extra-index-url https://download.pytorch.org/whl/cpu
pip install src/python/[tests,build] --extra-index-url https://download.pytorch.org/whl/cpu
- name: Prepare test data
run: |
source venv/bin/activate
Expand All @@ -37,7 +37,7 @@ jobs:
DATA=data pytest --data=./data tests/python/accuracy/test_YOLOv8.py
- name: Install CPP dependencies
run: |
sudo bash model_api/cpp/install_dependencies.sh
sudo bash src/cpp/install_dependencies.sh
- name: Build CPP Test
run: |
pip install nanobind==2.4.0
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/test_precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ jobs:
run: |
source venv/bin/activate
python -m pip install --upgrade pip
pip install model_api/python/[tests,ovms] --extra-index-url https://download.pytorch.org/whl/cpu
pip install src/python/[tests,ovms] --extra-index-url https://download.pytorch.org/whl/cpu
- name: Prepare test data
run: |
source venv/bin/activate
python tests/cpp/precommit/prepare_data.py -d data -p tests/cpp/precommit/public_scope.json
- name: Run test
run: |
source venv/bin/activate
pytest --data=./data tests/python/funtional
pytest --data=./data tests/python/functional
CPP-Code-Quality:
name: CPP-Code-Quality
runs-on: ubuntu-latest
Expand All @@ -46,7 +46,7 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN}}
# missingInclude: cppcheck can't find stl, openvino, opencv
other_options: --suppress=missingInclude -Imodel_api/cpp/models/include -Imodel_api/cpp/utils/include -Imodel_api/cpp/pipelines/include --check-config
other_options: --suppress=missingInclude -Isrc/cpp/models/include -Isrc/cpp/utils/include -Isrc/cpp/pipelines/include --check-config
CPP-Precommit:
runs-on: ubuntu-22.04
steps:
Expand All @@ -63,9 +63,9 @@ jobs:
run: |
source venv/bin/activate
python -m pip install --upgrade pip
pip install model_api/python/[tests,build] --extra-index-url https://download.pytorch.org/whl/cpu
pip install src/python/[tests,build] --extra-index-url https://download.pytorch.org/whl/cpu
sudo bash model_api/cpp/install_dependencies.sh
sudo bash src/cpp/install_dependencies.sh
- name: Prepare test data
run: |
source venv/bin/activate
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
run: |
source venv/Scripts/activate
python -m pip install --upgrade pip
pip install model_api/python/[tests,build] --extra-index-url https://download.pytorch.org/whl/cpu
pip install src/python/[tests,build] --extra-index-url https://download.pytorch.org/whl/cpu
curl https://storage.openvinotoolkit.org/repositories/openvino/packages/2024.6/windows/w_openvino_toolkit_windows_2024.6.0.17404.4c0f47d2335_x86_64.zip --output w_openvino_toolkit_windows.zip
unzip w_openvino_toolkit_windows.zip
rm w_openvino_toolkit_windows.zip
Expand All @@ -114,7 +114,7 @@ jobs:
shell: bash
run: |
mkdir build && cd build
MSYS_NO_PATHCONV=1 cmake ../examples/cpp/ -DOpenVINO_DIR=$GITHUB_WORKSPACE/w_openvino_toolkit_windows_2024.6.0.17404.4c0f47d2335_x86_64/runtime/cmake -DOpenCV_DIR=$GITHUB_WORKSPACE/opencv/opencv/build -DCMAKE_CXX_FLAGS=/WX -DENABLE_PY_BINDINGS=OFF
MSYS_NO_PATHCONV=1 cmake ../examples/cpp/ -DOpenVINO_DIR=$GITHUB_WORKSPACE/w_openvino_toolkit_windows_2024.6.0.17404.4c0f47d2335_x86_64/runtime/cmake -DOpenCV_DIR=$GITHUB_WORKSPACE/opencv/opencv/build -DCMAKE_CXX_FLAGS=/WX
cmake --build . --config Release -j $((`nproc`*2+2))
- name: Run sync sample
shell: cmd
Expand Down Expand Up @@ -146,7 +146,7 @@ jobs:
- name: serving_api
run: |
python -m pip install --upgrade pip
python -m pip install model_api/python/[ovms,tests]
python -m pip install src/python/[ovms,tests]
python -c "from model_api.models import DetectionModel; DetectionModel.create_model('ssd_mobilenet_v1_fpn_coco').save('ovms_models/ssd_mobilenet_v1_fpn_coco/1/ssd_mobilenet_v1_fpn_coco.xml')"
docker run -d --rm -v $GITHUB_WORKSPACE/ovms_models/:/models -p 8000:8000 openvino/model_server:latest --model_path /models/ssd_mobilenet_v1_fpn_coco/ --model_name ssd_mobilenet_v1_fpn_coco --rest_port 8000 --log_level DEBUG --target_device CPU
python tests/cpp/precommit/prepare_data.py -d data -p tests/cpp/precommit/public_scope.json
Expand Down
3 changes: 2 additions & 1 deletion examples/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ endmacro()

find_package(OpenCV REQUIRED COMPONENTS imgcodecs)

add_subdirectory(../../model_api/cpp ${Samples_BINARY_DIR}/model_api/cpp)
set (ENABLE_PY_BINDINGS OFF)
add_subdirectory(../../src/cpp ${Samples_BINARY_DIR}/src/cpp)

add_example(NAME asynchronous_api SOURCES ./asynchronous_api/main.cpp DEPENDENCIES model_api)
add_example(NAME synchronous_api SOURCES ./synchronous_api/main.cpp DEPENDENCIES model_api)
4 changes: 2 additions & 2 deletions examples/cpp/asynchronous_api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ This example demonstrates how to use a C++ API of OpenVINO Model API for asynchr
- Install third party dependencies by running the following script:

```bash
chmod +x ../../../model_api/cpp/install_dependencies.sh
sudo ../../../model_api/cpp/install_dependencies.sh
chmod +x ../../../src/cpp/install_dependencies.sh
sudo ../../../src/cpp/install_dependencies.sh
```

- Build example:
Expand Down
4 changes: 2 additions & 2 deletions examples/cpp/synchronous_api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ This example demonstrates how to use a C++ API of OpenVINO Model API for synchro
- Install third party dependencies by running the following script:

```bash
chmod +x ../../../model_api/cpp/install_dependencies.sh
sudo ../../../model_api/cpp/install_dependencies.sh
chmod +x ../../../src/cpp/install_dependencies.sh
sudo ../../../src/cpp/install_dependencies.sh
```

- Build example:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/cpp/accuracy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ include(../cmake/common.cmake)
find_package(OpenCV REQUIRED COMPONENTS core highgui videoio imgproc imgcodecs)
find_package(OpenVINO REQUIRED COMPONENTS Runtime)

add_subdirectory(../../../model_api/cpp ${tests_BINARY_DIR}/model_api/cpp)
add_subdirectory(../../../src/cpp ${tests_BINARY_DIR}/model_api/cpp)

add_test(NAME test_accuracy SOURCES test_accuracy.cpp DEPENDENCIES model_api)
add_test(NAME test_YOLOv8 SOURCES test_YOLOv8.cpp DEPENDENCIES model_api)
2 changes: 1 addition & 1 deletion tests/cpp/precommit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ include(../cmake/common.cmake)
find_package(OpenCV REQUIRED COMPONENTS core highgui videoio imgproc imgcodecs)
find_package(OpenVINO REQUIRED COMPONENTS Runtime)

add_subdirectory(../../../model_api/cpp ${tests_BINARY_DIR}/model_api/cpp)
add_subdirectory(../../../src/cpp ${tests_BINARY_DIR}/model_api/cpp)

add_test(NAME test_sanity SOURCES test_sanity.cpp DEPENDENCIES model_api)
add_test(NAME test_model_config SOURCES test_model_config.cpp DEPENDENCIES model_api)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 6e7d108

Please sign in to comment.