Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions .clang-format

This file was deleted.

2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ updates:
patterns:
- "*"
- package-ecosystem: pip
directory: /src/python
directory: /src
schedule:
interval: weekly
target-branch: "master"
Expand Down
7 changes: 1 addition & 6 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
# See help here: https://github.com/marketplace/actions/labeler

cpp:
- changed-files:
- any-glob-to-any-file:
- src/cpp/**

python:
- changed-files:
- any-glob-to-any-file:
- src/python/**
- src/**

tests:
- changed-files:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ jobs:
build-mode: none
- language: python
build-mode: none
- language: c-cpp
build-mode: none

steps:
- name: Checkout repository
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
with:
python-version: "3.10"
- name: Install dependencies
run: pip install 'src/python/.[docs]'
run: pip install 'src/.[docs]'
- name: Install and Generate Doxygen
uses: mattnotmitt/doxygen-action@b84fe17600245bb5db3d6c247cc274ea98c15a3b # v1.12.0
- name: Build Docs
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/pre_commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ jobs:
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 22
- name: Install clang-format
run: sudo apt-get install -y clang-format-13
- name: Install dependencies
run: pip install 'src/python/.[full]'
run: pip install 'src/.[full]'
- name: Run pre-commit checks
run: pre-commit run --all-files
Unit-Tests:
Expand All @@ -47,9 +45,9 @@ jobs:
with:
python-version: "3.10"
- name: Install dependencies
run: pip install 'src/python/.[tests,ovms]'
run: pip install 'src/.[tests,ovms]'
- name: Run python unit tests
run: pytest tests/python/unit
run: pytest tests/unit
Zizmor-Scan-PR:
runs-on: ubuntu-latest
permissions:
Expand Down Expand Up @@ -81,5 +79,5 @@ jobs:
scan-scope: "changed"
severity-level: "LOW"
confidence-level: "LOW"
config_file: "src/python/pyproject.toml"
config_file: "src/pyproject.toml"
fail-on-findings: true
8 changes: 4 additions & 4 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ jobs:
python -m pip install --upgrade build
- name: Build sdist
run: |
python -m build --sdist src/python/
python -m build --sdist src/
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: artifact-sdist
path: src/python/dist/*.tar.gz
path: src/dist/*.tar.gz
- name: Build wheel
run: |
python -m build --wheel src/python/
python -m build --wheel src/
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: artifact-wheel
path: src/python/dist/*.whl
path: src/dist/*.whl

publish_package:
name: Publish package
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/security-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
scan-scope: "all"
severity-level: "LOW"
confidence-level: "LOW"
config_file: "src/python/pyproject.toml"
config_file: "src/pyproject.toml"
fail-on-findings: false # reports only

trivy-scan:
Expand All @@ -68,7 +68,7 @@ jobs:
run: python -m pip install pip-tools

- name: Freeze dependencies
run: pip-compile --extra=full -o requirements.txt $(pwd)/src/python/pyproject.toml
run: pip-compile --extra=full -o requirements.txt $(pwd)/src/pyproject.toml

- name: Run Trivy scan
id: trivy
Expand Down
28 changes: 3 additions & 25 deletions .github/workflows/test_accuracy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,34 +27,12 @@ jobs:
run: |
source venv/bin/activate
python -m pip install --upgrade pip
pip install src/python/[tests,build] --extra-index-url https://download.pytorch.org/whl/cpu
pip install src/[tests,build] --extra-index-url https://download.pytorch.org/whl/cpu
- name: Prepare test data
run: |
source venv/bin/activate
python tests/python/accuracy/prepare_data.py -d data
python tests/accuracy/prepare_data.py -d data
- name: Run Python Test
run: |
source venv/bin/activate
pytest -v --data=./data tests/python/accuracy/test_accuracy.py
- name: Install CPP dependencies
run: |
sudo bash src/cpp/install_dependencies.sh
- name: Build CPP Test
run: |
mkdir build && cd build
pip install nanobind==2.4.0
pip install typing_extensions==4.12.2
cmake ../tests/cpp/accuracy/
make -j
- name: Build CPP-PY Bindings
run: |
source venv/bin/activate
pip install src/cpp/py_bindings
- name: Run CPP Test
run: |
build/test_accuracy -d data -p tests/python/accuracy/public_scope.json
- name: Run CPP-PY Bindings Test
run: |
source venv/bin/activate
pip list
pytest --data=./data --config=./tests/python/accuracy/public_scope.json tests/cpp/accuracy/test_bindings.py
pytest -v --data=./data tests/accuracy/test_accuracy.py
104 changes: 6 additions & 98 deletions .github/workflows/test_precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,107 +29,15 @@ jobs:
run: |
source venv/bin/activate
python -m pip install --upgrade pip
pip install src/python/[tests,ovms] --extra-index-url https://download.pytorch.org/whl/cpu
pip install src/[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
python tests/precommit/prepare_data.py -d data -p tests/precommit/public_scope.json
- name: Run test
run: |
source venv/bin/activate
pytest --data=./data tests/python/functional
CPP-Code-Quality:
name: CPP-Code-Quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: cppcheck
uses: chmorgan/cppcheck-action@88696b3fd4a3ced3df76a2f7dc44b251d8232bcb # v1.4
with:
github_token: ${{ secrets.GITHUB_TOKEN}}
# missingInclude: cppcheck can't find stl, openvino, opencv
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:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.10"
cache: pip
- name: Create and start a virtual environment
run: |
python -m venv venv
source venv/bin/activate
- name: Install dependencies
run: |
source venv/bin/activate
python -m pip install --upgrade pip
pip install src/python/[tests,build] --extra-index-url https://download.pytorch.org/whl/cpu

sudo bash src/cpp/install_dependencies.sh
- 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: Build
run: |
mkdir build && cd build
pip install nanobind==2.4.0
pip install typing_extensions==4.12.2
cmake ../tests/cpp/precommit/
cmake --build . -j $((`nproc`*2+2))
- name: Run test
run: |
build/test_sanity -d data -p tests/cpp/precommit/public_scope.json && build/test_model_config -d data
CPP-Windows-Precommit:
runs-on: windows-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.10"
cache: pip
- name: Create and start a virtual environment
shell: bash
run: |
python -m venv venv
source venv/Scripts/activate
- name: Install dependencies
shell: bash
run: |
source venv/Scripts/activate
python -m pip install --upgrade pip
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
curl -L https://github.com/opencv/opencv/releases/download/4.10.0/opencv-4.10.0-windows.exe --output opencv-4.10.0-windows.exe
./opencv-4.10.0-windows.exe -oopencv -y
rm opencv-4.10.0-windows.exe
- name: Prepare test data
shell: bash
run: |
source venv/Scripts/activate
python tests/cpp/precommit/prepare_data.py -d data -p tests/cpp/precommit/public_scope.json
- name: Build
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
cmake --build . --config Release -j $((`nproc`*2+2))
- name: Run sync sample
shell: cmd
# .\w_openvino_toolkit_windows_2023.0.0.10926.b4452d56304_x86_64\setupvars.bat exits with 0 code without moving to a next command. Set PATH manually
run: |
set PATH=opencv\opencv\build\x64\vc16\bin;w_openvino_toolkit_windows_2024.6.0.17404.4c0f47d2335_x86_64\runtime\bin\intel64\Release;w_openvino_toolkit_windows_2024.6.0.17404.4c0f47d2335_x86_64\runtime\3rdparty\tbb\bin;%PATH%
.\build\Release\synchronous_api.exe .\data\otx_models\detection_model_with_xai_head.xml .\data\BloodImage_00007.jpg
pytest --data=./data tests/functional
serving_api:
strategy:
fail-fast: false
Expand All @@ -153,8 +61,8 @@ jobs:
- name: serving_api
run: |
python -m pip install --upgrade pip
python -m pip install src/python/[ovms,tests]
python tests/cpp/precommit/prepare_data.py -d data -p tests/cpp/precommit/public_scope.json
python -m pip install src/[ovms,tests]
python tests/precommit/prepare_data.py -d data -p tests/precommit/public_scope.json
python -c "from model_api.models import DetectionModel; DetectionModel.create_model('./data/otx_models/detection_model_with_xai_head.xml').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 examples/python/serving_api/run.py data/coco128/images/train2017/000000000009.jpg # detects 4 objects
python examples/serving_api/run.py data/coco128/images/train2017/000000000009.jpg # detects 4 objects
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Generated by examples/python/synchronous_api/run.py
# Generated by examples/synchronous_api/run.py
mask.png
ssd_mobilenet_v1_fpn_coco_with_preprocessing.xml
ssd_mobilenet_v1_fpn_coco_with_preprocessing.bin
tmp/
# Generated by tests/python/accuracy/test_accuracy.py
# Generated by tests/accuracy/test_accuracy.py
test_scope.json

# Byte-compiled / optimized / DLL files
Expand Down
9 changes: 1 addition & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,6 @@ repos:
hooks:
- id: markdownlint

# C++ code quality
- repo: https://github.com/cpp-linter/cpp-linter-hooks
rev: v0.5.1
hooks:
- id: clang-format
args: [--style=file, --version=13]

# zizmor detects security issues in GitHub Actions workflows.
- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.9.0
Expand All @@ -62,7 +55,7 @@ repos:
args:
[
"-c",
"src/python/pyproject.toml",
"src/pyproject.toml",
"--severity-level",
"all",
"--confidence-level",
Expand Down
13 changes: 6 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Set up your development environment to start contributing. This involves install
2. Install the development requirements:

```bash
pip install -e ./src/python[full]
pip install -e ./src[full]
```

3. [Build](https://github.com/open-edge-platform/model_api?tab=readme-ov-file#c) C++ binaries
Expand All @@ -71,12 +71,11 @@ pre-commit run --all-files

```bash
pre-commit run --all-files
python tests/cpp/precommit/prepare_data.py -d data -p tests/cpp/precommit/public_scope.json
python tests/python/accuracy/prepare_data.py -d data
pytest tests/python/

build/test_sanity -d data -p tests/cpp/precommit/public_scope.json && build/test_model_config -d data
build/test_accuracy -d data -p tests/python/accuracy/public_scope.json
pytest tests/unit
python tests/precommit/prepare_data.py -d data -p tests/precommit/public_scope.json
pytest --data=./data tests/functional
python tests/accuracy/prepare_data.py -d data
pytest --data=./data tests/functional
```

5. **Update the Changelog:** For significant changes, add a summary to the [CHANGELOG](CHANGELOG.md).
Expand Down
Loading