Files
detections/setup.py
Roman Meshko 6ad4b700dd
ci/woodpecker/push/02-build-push Pipeline was successful
Feature/run jetson e2e tests (#4)
* Run tests

* Run tests

* Run tests

* Run tests

* Added rebuild

* Added files for e2e tests

* Added rebuild

* Added rebuild

* Added biuld TensorRT flag

* Changed to use NumPy 1.x for Jetson

* Make universal invocation

* Make Cython constans

* Changed to prepare onnx

* Changed smoke-test to wait AI conversion

* Added step for model conversion

* Changed to not run step in parallel

* Push model to docker registry

* Push model to docker registry

* Push model to docker registry
2026-05-05 21:44:51 +03:00

56 lines
2.0 KiB
Python

from setuptools import setup, Extension
from Cython.Build import cythonize
import numpy as np
import os
SRC = "src"
np_inc = [np.get_include(), SRC]
extensions = [
Extension('constants_inf', [f'{SRC}/constants_inf.pyx'], include_dirs=[SRC]),
Extension('ai_availability_status', [f'{SRC}/ai_availability_status.pyx'], include_dirs=[SRC]),
Extension('annotation', [f'{SRC}/annotation.pyx'], include_dirs=[SRC]),
Extension('ai_config', [f'{SRC}/ai_config.pyx'], include_dirs=[SRC]),
Extension('loader_http_client', [f'{SRC}/loader_http_client.pyx'], include_dirs=[SRC]),
Extension('engines.inference_engine', [f'{SRC}/engines/inference_engine.pyx'], include_dirs=np_inc),
Extension('engines.engine_factory', [f'{SRC}/engines/engine_factory.pyx'], include_dirs=[SRC]),
Extension('engines.onnx_engine', [f'{SRC}/engines/onnx_engine.pyx'], include_dirs=np_inc),
Extension('engines.coreml_engine', [f'{SRC}/engines/coreml_engine.pyx'], include_dirs=np_inc),
Extension('inference', [f'{SRC}/inference.pyx'], include_dirs=np_inc),
]
build_tensorrt = os.environ.get("BUILD_TENSORRT_EXTENSIONS", "").lower() in ("1", "true", "yes")
if not build_tensorrt:
try:
import tensorrt # pyright: ignore[reportMissingImports]
build_tensorrt = True
except ImportError:
build_tensorrt = False
if build_tensorrt:
extensions.append(
Extension('engines.tensorrt_engine', [f'{SRC}/engines/tensorrt_engine.pyx'], include_dirs=np_inc)
)
extensions.append(
Extension('engines.jetson_tensorrt_engine', [f'{SRC}/engines/jetson_tensorrt_engine.pyx'], include_dirs=np_inc)
)
setup(
name="azaion.detections",
package_dir={"": SRC},
packages=["engines"],
ext_modules=cythonize(
extensions,
include_path=[SRC],
compiler_directives={
"language_level": 3,
"emit_code_comments": False,
"binding": True,
'boundscheck': False,
'wraparound': False,
}
),
zip_safe=False
)