Skip to content

Commit

Permalink
Merge pull request #36 from FocoosAI/feat/test-coverage
Browse files Browse the repository at this point in the history
test coverage
  • Loading branch information
giuseppeambrosio97 authored Jan 8, 2025
2 parents cf70cda + 5c70876 commit bb4533d
Show file tree
Hide file tree
Showing 28 changed files with 2,143 additions and 375 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ jobs:
issues: write
pull-requests: write
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: ["3.10", "3.11","3.12"]
steps:
- name: Checkout Repository
Expand All @@ -25,7 +27,7 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install the latest version of uv and set the python version to 3.12
- name: Install the latest version of uv and set the python version
uses: astral-sh/setup-uv@v4
with:
python-version: ${{ matrix.python-version }}
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
7 changes: 6 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{
"python.analysis.typeCheckingMode": "basic",
"python.analysis.autoImportCompletions": true
"python.analysis.autoImportCompletions": true,
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
37 changes: 26 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
.PHONY: test install install-dev install-pre-commit run-pre-commit
.PHONY: test install install-dev install-pre-commit run-pre-commit .uv .pre-commit tox

install:
@pip install . --no-cache-dir
install-dev:
@pip install -e ".[dev]" --no-cache-dir
.uv: ## Check that uv is installed
@uv --version || echo 'Please install uv: https://docs.astral.sh/uv/getting-started/installation/'

install-pre-commit:
.pre-commit: ## Check that pre-commit is installed
@pre-commit -V || echo 'Please install pre-commit: https://pre-commit.com/'

install: .uv .pre-commit
@uv venv
@uv pip install -e ".[cpu,dev]"
@pre-commit install

install-gpu: .uv .pre-commit
@uv venv
@uv pip install -e ".[dev,gpu]"
@pre-commit install

lint:
@isort ./focoos --profile=black
@black ./focoos
run-pre-commit:
@isort ./focoos ./tests --profile=black
@black ./focoos ./tests

run-pre-commit: .pre-commit
@pre-commit run --all-files

test:
@pytest -s --cov=focoos --cov-report="xml:tests/coverage.xml" --junitxml=./tests/junit.xml && rm -f .coverage
@pytest -s --cov=focoos --cov-report="xml:tests/coverage.xml" --cov-report=html --junitxml=./tests/junit.xml && rm -f .coverage

tox:
tox

clean:
@rm -rf build dist *.egg-info .tox .nox .coverage .coverage.* .cache .pytest_cache htmlcov
@rm -rf build dist *.egg-info .tox .nox .coverage .coverage.* .cache .pytest_cache htmlcov */coverage.xml */junit.xml .venv
@find . -type d -name "__pycache__" -exec rm -r {} +
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

# Focoos SDK

![Tests](https://github.com/FocoosAI/focoos/actions/workflows/test.yml/badge.svg??event=push&branch=main)

## Requirements

### CUDA 12
Expand Down
75 changes: 74 additions & 1 deletion focoos/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,78 @@
from .config import FOCOOS_CONFIG
from .focoos import Focoos
from .local_model import LocalModel
from .ports import *
from .ports import (
DEV_API_URL,
LOCAL_API_URL,
PROD_API_URL,
DatasetInfo,
DatasetLayout,
DatasetMetadata,
DeploymentMode,
FocoosDet,
FocoosDetections,
FocoosTask,
GPUInfo,
Hyperparameters,
LatencyMetrics,
ModelMetadata,
ModelPreview,
ModelStatus,
OnnxEngineOpts,
RuntimeTypes,
SystemInfo,
TraininingInfo,
TrainInstance,
)
from .remote_model import RemoteModel
from .runtime import ONNXRuntime, get_runtime
from .utils.system import get_system_info
from .utils.vision import (
base64mask_to_mask,
binary_mask_to_base64,
class_to_index,
focoos_detections_to_supervision,
image_loader,
image_preprocess,
index_to_class,
sv_to_focoos_detections,
)

__all__ = [
"FOCOOS_CONFIG",
"Focoos",
"LocalModel",
"RemoteModel",
"FocoosDetections",
"FocoosDet",
"FocoosTask",
"ModelMetadata",
"ModelStatus",
"DatasetInfo",
"DatasetLayout",
"DatasetMetadata",
"DeploymentMode",
"GPUInfo",
"Hyperparameters",
"LatencyMetrics",
"ModelPreview",
"OnnxEngineOpts",
"RuntimeTypes",
"SystemInfo",
"TraininingInfo",
"TrainInstance",
"get_system_info",
"ONNXRuntime",
"get_runtime",
"DEV_API_URL",
"LOCAL_API_URL",
"PROD_API_URL",
"base64mask_to_mask",
"binary_mask_to_base64",
"class_to_index",
"focoos_detections_to_supervision",
"image_loader",
"image_preprocess",
"index_to_class",
"sv_to_focoos_detections",
]
Loading

0 comments on commit bb4533d

Please sign in to comment.