matrice-inference 0.1.0__tar.gz → 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of matrice-inference might be problematic. Click here for more details.

Files changed (119) hide show
  1. {matrice_inference-0.1.0 → matrice_inference-0.1.2}/PKG-INFO +8 -6
  2. {matrice_inference-0.1.0 → matrice_inference-0.1.2}/matrice_inference.egg-info/PKG-INFO +8 -6
  3. matrice_inference-0.1.2/matrice_inference.egg-info/SOURCES.txt +41 -0
  4. {matrice_inference-0.1.0 → matrice_inference-0.1.2}/pyproject.toml +13 -9
  5. matrice_inference-0.1.2/setup.py +322 -0
  6. matrice_inference-0.1.2/src/matrice_inference/__init__.py +72 -0
  7. matrice_inference-0.1.2/src/matrice_inference/server/__init__.py +23 -0
  8. matrice_inference-0.1.2/src/matrice_inference/server/inference_interface.py +176 -0
  9. matrice_inference-0.1.2/src/matrice_inference/server/model/__init__.py +1 -0
  10. matrice_inference-0.1.2/src/matrice_inference/server/model/model_manager.py +274 -0
  11. matrice_inference-0.1.2/src/matrice_inference/server/model/model_manager_wrapper.py +550 -0
  12. matrice_inference-0.1.2/src/matrice_inference/server/model/triton_model_manager.py +290 -0
  13. matrice_inference-0.1.2/src/matrice_inference/server/model/triton_server.py +1248 -0
  14. matrice_inference-0.1.2/src/matrice_inference/server/proxy_interface.py +371 -0
  15. matrice_inference-0.1.2/src/matrice_inference/server/server.py +1004 -0
  16. matrice_inference-0.1.2/src/matrice_inference/server/stream/__init__.py +0 -0
  17. matrice_inference-0.1.2/src/matrice_inference/server/stream/app_deployment.py +228 -0
  18. matrice_inference-0.1.2/src/matrice_inference/server/stream/consumer_worker.py +201 -0
  19. matrice_inference-0.1.2/src/matrice_inference/server/stream/frame_cache.py +127 -0
  20. matrice_inference-0.1.2/src/matrice_inference/server/stream/inference_worker.py +163 -0
  21. matrice_inference-0.1.2/src/matrice_inference/server/stream/post_processing_worker.py +230 -0
  22. matrice_inference-0.1.2/src/matrice_inference/server/stream/producer_worker.py +147 -0
  23. matrice_inference-0.1.2/src/matrice_inference/server/stream/stream_pipeline.py +451 -0
  24. matrice_inference-0.1.2/src/matrice_inference/server/stream/utils.py +23 -0
  25. matrice_inference-0.1.2/src/matrice_inference/tmp/abstract_model_manager.py +58 -0
  26. matrice_inference-0.1.2/src/matrice_inference/tmp/aggregator/__init__.py +18 -0
  27. matrice_inference-0.1.2/src/matrice_inference/tmp/aggregator/aggregator.py +330 -0
  28. matrice_inference-0.1.2/src/matrice_inference/tmp/aggregator/analytics.py +906 -0
  29. matrice_inference-0.1.2/src/matrice_inference/tmp/aggregator/ingestor.py +438 -0
  30. matrice_inference-0.1.2/src/matrice_inference/tmp/aggregator/latency.py +597 -0
  31. matrice_inference-0.1.2/src/matrice_inference/tmp/aggregator/pipeline.py +968 -0
  32. matrice_inference-0.1.2/src/matrice_inference/tmp/aggregator/publisher.py +431 -0
  33. matrice_inference-0.1.2/src/matrice_inference/tmp/aggregator/synchronizer.py +594 -0
  34. matrice_inference-0.1.2/src/matrice_inference/tmp/batch_manager.py +239 -0
  35. matrice_inference-0.1.2/src/matrice_inference/tmp/overall_inference_testing.py +338 -0
  36. matrice_inference-0.1.2/src/matrice_inference/tmp/triton_utils.py +638 -0
  37. matrice_inference-0.1.0/matrice_inference.egg-info/SOURCES.txt +0 -84
  38. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/aggregator/aggregator.cpython-312-x86_64-linux-gnu.so +0 -0
  39. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/aggregator/aggregator.pyi +0 -55
  40. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/aggregator/analytics.cpython-312-x86_64-linux-gnu.so +0 -0
  41. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/aggregator/analytics.pyi +0 -63
  42. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/aggregator/ingestor.cpython-312-x86_64-linux-gnu.so +0 -0
  43. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/aggregator/ingestor.pyi +0 -79
  44. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/aggregator/pipeline.cpython-312-x86_64-linux-gnu.so +0 -0
  45. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/aggregator/pipeline.pyi +0 -139
  46. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/aggregator/publisher.cpython-312-x86_64-linux-gnu.so +0 -0
  47. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/aggregator/publisher.pyi +0 -59
  48. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/aggregator/synchronizer.cpython-312-x86_64-linux-gnu.so +0 -0
  49. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/aggregator/synchronizer.pyi +0 -58
  50. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/client/auto_streaming/auto_streaming.cpython-312-x86_64-linux-gnu.so +0 -0
  51. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/client/auto_streaming/auto_streaming.pyi +0 -145
  52. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/client/auto_streaming/auto_streaming_utils.cpython-312-x86_64-linux-gnu.so +0 -0
  53. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/client/auto_streaming/auto_streaming_utils.pyi +0 -126
  54. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/client/client.cpython-312-x86_64-linux-gnu.so +0 -0
  55. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/client/client.pyi +0 -337
  56. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/client/client_stream_utils.cpython-312-x86_64-linux-gnu.so +0 -0
  57. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/client/client_stream_utils.pyi +0 -83
  58. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/client/client_utils.cpython-312-x86_64-linux-gnu.so +0 -0
  59. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/client/client_utils.pyi +0 -77
  60. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/client/streaming_gateway/streaming_gateway.cpython-312-x86_64-linux-gnu.so +0 -0
  61. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/client/streaming_gateway/streaming_gateway.pyi +0 -120
  62. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/client/streaming_gateway/streaming_gateway_utils.cpython-312-x86_64-linux-gnu.so +0 -0
  63. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/client/streaming_gateway/streaming_gateway_utils.pyi +0 -442
  64. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/client/streaming_gateway/streaming_results_handler.cpython-312-x86_64-linux-gnu.so +0 -0
  65. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/client/streaming_gateway/streaming_results_handler.pyi +0 -19
  66. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/optimize/cache_manager.cpython-312-x86_64-linux-gnu.so +0 -0
  67. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/optimize/cache_manager.pyi +0 -15
  68. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/optimize/frame_comparators.cpython-312-x86_64-linux-gnu.so +0 -0
  69. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/optimize/frame_comparators.pyi +0 -203
  70. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/optimize/frame_difference.cpython-312-x86_64-linux-gnu.so +0 -0
  71. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/optimize/frame_difference.pyi +0 -165
  72. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/optimize/transmission.cpython-312-x86_64-linux-gnu.so +0 -0
  73. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/optimize/transmission.pyi +0 -97
  74. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/server/inference/batch_manager.cpython-312-x86_64-linux-gnu.so +0 -0
  75. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/server/inference/batch_manager.pyi +0 -50
  76. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/server/inference/inference_interface.cpython-312-x86_64-linux-gnu.so +0 -0
  77. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/server/inference/inference_interface.pyi +0 -114
  78. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/server/inference/model_manager.cpython-312-x86_64-linux-gnu.so +0 -0
  79. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/server/inference/model_manager.pyi +0 -80
  80. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/server/inference/triton_utils.cpython-312-x86_64-linux-gnu.so +0 -0
  81. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/server/inference/triton_utils.pyi +0 -115
  82. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/server/proxy/proxy_interface.cpython-312-x86_64-linux-gnu.so +0 -0
  83. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/server/proxy/proxy_interface.pyi +0 -90
  84. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/server/proxy/proxy_utils.cpython-312-x86_64-linux-gnu.so +0 -0
  85. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/server/proxy/proxy_utils.pyi +0 -113
  86. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/server/server.cpython-312-x86_64-linux-gnu.so +0 -0
  87. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/server/server.pyi +0 -155
  88. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/server/stream/inference_worker.cpython-312-x86_64-linux-gnu.so +0 -0
  89. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/server/stream/inference_worker.pyi +0 -56
  90. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/server/stream/kafka_consumer_worker.cpython-312-x86_64-linux-gnu.so +0 -0
  91. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/server/stream/kafka_consumer_worker.pyi +0 -51
  92. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/server/stream/kafka_producer_worker.cpython-312-x86_64-linux-gnu.so +0 -0
  93. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/server/stream/kafka_producer_worker.pyi +0 -50
  94. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/server/stream/stream_debug_logger.cpython-312-x86_64-linux-gnu.so +0 -0
  95. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/server/stream/stream_debug_logger.pyi +0 -47
  96. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/server/stream/stream_manager.cpython-312-x86_64-linux-gnu.so +0 -0
  97. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/server/stream/stream_manager.pyi +0 -69
  98. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/server/stream/video_buffer.cpython-312-x86_64-linux-gnu.so +0 -0
  99. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/server/stream/video_buffer.pyi +0 -120
  100. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/stream/kafka_stream.cpython-312-x86_64-linux-gnu.so +0 -0
  101. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/stream/kafka_stream.pyi +0 -444
  102. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/stream/redis_stream.cpython-312-x86_64-linux-gnu.so +0 -0
  103. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deploy/stream/redis_stream.pyi +0 -447
  104. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deployment/camera_manager.cpython-312-x86_64-linux-gnu.so +0 -0
  105. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deployment/camera_manager.pyi +0 -669
  106. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deployment/deployment.cpython-312-x86_64-linux-gnu.so +0 -0
  107. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deployment/deployment.pyi +0 -736
  108. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deployment/inference_pipeline.cpython-312-x86_64-linux-gnu.so +0 -0
  109. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deployment/inference_pipeline.pyi +0 -527
  110. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deployment/streaming_gateway_manager.cpython-312-x86_64-linux-gnu.so +0 -0
  111. matrice_inference-0.1.0/matrice_inference_compiled/matrice_inference/deployment/streaming_gateway_manager.pyi +0 -275
  112. matrice_inference-0.1.0/setup.py +0 -198
  113. {matrice_inference-0.1.0 → matrice_inference-0.1.2}/LICENSE.txt +0 -0
  114. {matrice_inference-0.1.0 → matrice_inference-0.1.2}/README.md +0 -0
  115. {matrice_inference-0.1.0 → matrice_inference-0.1.2}/matrice_inference.egg-info/dependency_links.txt +0 -0
  116. {matrice_inference-0.1.0 → matrice_inference-0.1.2}/matrice_inference.egg-info/not-zip-safe +0 -0
  117. {matrice_inference-0.1.0 → matrice_inference-0.1.2}/matrice_inference.egg-info/top_level.txt +0 -0
  118. {matrice_inference-0.1.0 → matrice_inference-0.1.2}/setup.cfg +0 -0
  119. {matrice_inference-0.1.0/matrice_inference_compiled → matrice_inference-0.1.2/src}/matrice_inference/py.typed +0 -0
@@ -1,26 +1,28 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matrice_inference
3
- Version: 0.1.0
4
- Summary: Common utilities for Matrice.ai services
3
+ Version: 0.1.2
4
+ Summary: Common server utilities for Matrice.ai services
5
5
  Author-email: "Matrice.ai" <dipendra@matrice.ai>
6
6
  License-Expression: MIT
7
- Keywords: matrice,inference,utilities,cython
7
+ Keywords: matrice,common,utilities,pyarmor,obfuscated
8
8
  Classifier: Development Status :: 4 - Beta
9
9
  Classifier: Intended Audience :: Developers
10
+ Classifier: Operating System :: OS Independent
10
11
  Classifier: Operating System :: POSIX :: Linux
12
+ Classifier: Operating System :: Microsoft :: Windows
13
+ Classifier: Operating System :: MacOS
11
14
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
12
- Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3.7
14
15
  Classifier: Programming Language :: Python :: 3.8
15
16
  Classifier: Programming Language :: Python :: 3.9
16
17
  Classifier: Programming Language :: Python :: 3.10
17
18
  Classifier: Programming Language :: Python :: 3.11
18
19
  Classifier: Programming Language :: Python :: 3.12
19
20
  Classifier: Typing :: Typed
20
- Requires-Python: <4,>=3.7
21
+ Requires-Python: >=3.8
21
22
  Description-Content-Type: text/markdown
22
23
  License-File: LICENSE.txt
23
24
  Dynamic: license-file
25
+ Dynamic: requires-python
24
26
 
25
27
 
26
28
  # matrice\_inference
@@ -1,26 +1,28 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: matrice_inference
3
- Version: 0.1.0
4
- Summary: Common utilities for Matrice.ai services
3
+ Version: 0.1.2
4
+ Summary: Common server utilities for Matrice.ai services
5
5
  Author-email: "Matrice.ai" <dipendra@matrice.ai>
6
6
  License-Expression: MIT
7
- Keywords: matrice,inference,utilities,cython
7
+ Keywords: matrice,common,utilities,pyarmor,obfuscated
8
8
  Classifier: Development Status :: 4 - Beta
9
9
  Classifier: Intended Audience :: Developers
10
+ Classifier: Operating System :: OS Independent
10
11
  Classifier: Operating System :: POSIX :: Linux
12
+ Classifier: Operating System :: Microsoft :: Windows
13
+ Classifier: Operating System :: MacOS
11
14
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
12
- Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3.7
14
15
  Classifier: Programming Language :: Python :: 3.8
15
16
  Classifier: Programming Language :: Python :: 3.9
16
17
  Classifier: Programming Language :: Python :: 3.10
17
18
  Classifier: Programming Language :: Python :: 3.11
18
19
  Classifier: Programming Language :: Python :: 3.12
19
20
  Classifier: Typing :: Typed
20
- Requires-Python: <4,>=3.7
21
+ Requires-Python: >=3.8
21
22
  Description-Content-Type: text/markdown
22
23
  License-File: LICENSE.txt
23
24
  Dynamic: license-file
25
+ Dynamic: requires-python
24
26
 
25
27
 
26
28
  # matrice\_inference
@@ -0,0 +1,41 @@
1
+ LICENSE.txt
2
+ README.md
3
+ pyproject.toml
4
+ setup.py
5
+ matrice_inference.egg-info/PKG-INFO
6
+ matrice_inference.egg-info/SOURCES.txt
7
+ matrice_inference.egg-info/dependency_links.txt
8
+ matrice_inference.egg-info/not-zip-safe
9
+ matrice_inference.egg-info/top_level.txt
10
+ src/matrice_inference/__init__.py
11
+ src/matrice_inference/py.typed
12
+ src/matrice_inference/server/__init__.py
13
+ src/matrice_inference/server/inference_interface.py
14
+ src/matrice_inference/server/proxy_interface.py
15
+ src/matrice_inference/server/server.py
16
+ src/matrice_inference/server/model/__init__.py
17
+ src/matrice_inference/server/model/model_manager.py
18
+ src/matrice_inference/server/model/model_manager_wrapper.py
19
+ src/matrice_inference/server/model/triton_model_manager.py
20
+ src/matrice_inference/server/model/triton_server.py
21
+ src/matrice_inference/server/stream/__init__.py
22
+ src/matrice_inference/server/stream/app_deployment.py
23
+ src/matrice_inference/server/stream/consumer_worker.py
24
+ src/matrice_inference/server/stream/frame_cache.py
25
+ src/matrice_inference/server/stream/inference_worker.py
26
+ src/matrice_inference/server/stream/post_processing_worker.py
27
+ src/matrice_inference/server/stream/producer_worker.py
28
+ src/matrice_inference/server/stream/stream_pipeline.py
29
+ src/matrice_inference/server/stream/utils.py
30
+ src/matrice_inference/tmp/abstract_model_manager.py
31
+ src/matrice_inference/tmp/batch_manager.py
32
+ src/matrice_inference/tmp/overall_inference_testing.py
33
+ src/matrice_inference/tmp/triton_utils.py
34
+ src/matrice_inference/tmp/aggregator/__init__.py
35
+ src/matrice_inference/tmp/aggregator/aggregator.py
36
+ src/matrice_inference/tmp/aggregator/analytics.py
37
+ src/matrice_inference/tmp/aggregator/ingestor.py
38
+ src/matrice_inference/tmp/aggregator/latency.py
39
+ src/matrice_inference/tmp/aggregator/pipeline.py
40
+ src/matrice_inference/tmp/aggregator/publisher.py
41
+ src/matrice_inference/tmp/aggregator/synchronizer.py
@@ -1,28 +1,32 @@
1
1
  [build-system]
2
- requires = ["setuptools>=77.0.0", "wheel", "Cython>=3.0.0"]
2
+ requires = ["setuptools>=65.0.0", "wheel", "pyarmor>=8.0.0"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "matrice_inference"
7
- version = "0.1.0"
8
- description = "Common utilities for Matrice.ai services"
7
+ dynamic = ["version"]
8
+ description = "Common server utilities for Matrice.ai services"
9
9
  readme = "README.md"
10
10
  authors = [{ name = "Matrice.ai", email = "dipendra@matrice.ai" }]
11
11
  license = "MIT"
12
- license-files = ["LICENSE.txt"]
13
- requires-python = ">=3.7, <4"
14
- keywords = ["matrice", "inference", "utilities", "cython"] # Updated keyword from "common" to "inference"
12
+ requires-python = ">=3.8, <4"
13
+ keywords = ["matrice", "common", "utilities", "pyarmor", "obfuscated"]
15
14
  classifiers = [
16
15
  "Development Status :: 4 - Beta",
17
16
  "Intended Audience :: Developers",
17
+ "Operating System :: OS Independent",
18
18
  "Operating System :: POSIX :: Linux",
19
+ "Operating System :: Microsoft :: Windows",
20
+ "Operating System :: MacOS",
19
21
  "Topic :: Software Development :: Libraries :: Python Modules",
20
- "Programming Language :: Python :: 3",
21
- "Programming Language :: Python :: 3.7",
22
22
  "Programming Language :: Python :: 3.8",
23
23
  "Programming Language :: Python :: 3.9",
24
24
  "Programming Language :: Python :: 3.10",
25
25
  "Programming Language :: Python :: 3.11",
26
26
  "Programming Language :: Python :: 3.12",
27
27
  "Typing :: Typed",
28
- ]
28
+ ]
29
+
30
+
31
+ # PyArmor configuration is handled via pyarmor.yml file
32
+ # The [tool.pyarmor] section is not used in PyArmor 8.x
@@ -0,0 +1,322 @@
1
+ import os
2
+ import shutil
3
+ import subprocess
4
+ from pathlib import Path
5
+ from setuptools import setup, find_packages
6
+ from setuptools.command.build_py import build_py as _build_py
7
+ from setuptools.command.sdist import sdist as _sdist
8
+
9
+ # Configuration of package name and source directory
10
+ PACKAGE_NAME = "matrice_inference"
11
+ SOURCE_DIR = f"src/{PACKAGE_NAME}"
12
+ OBFUSCATED_DIR = f"{PACKAGE_NAME}_obfuscated"
13
+ BUILD_DIR = "build"
14
+
15
+ # Read version from appropriate version file based on environment
16
+ def get_version():
17
+ """Get version based on environment or git branch.
18
+ If environment is dev, append 'dev' suffix automatically."""
19
+ # Check environment variable first (set by CI/CD)
20
+ env_type = os.environ.get('BUILD_ENV', '').lower()
21
+ append_dev_suffix = False
22
+
23
+ if env_type == 'dev':
24
+ version_file = "version-dev.txt"
25
+ append_dev_suffix = True
26
+ elif env_type == 'staging':
27
+ version_file = "version-staging.txt"
28
+ elif env_type == 'prod':
29
+ version_file = "version-prod.txt"
30
+ else:
31
+ # Try to detect from git branch
32
+ try:
33
+ result = subprocess.run(
34
+ ['git', 'rev-parse', '--abbrev-ref', 'HEAD'],
35
+ capture_output=True, text=True, check=True
36
+ )
37
+ branch = result.stdout.strip()
38
+
39
+ if branch == 'dev':
40
+ version_file = "version-dev.txt"
41
+ append_dev_suffix = True
42
+ elif branch == 'staging':
43
+ version_file = "version-staging.txt"
44
+ elif branch in ['main', 'master', 'prod']:
45
+ version_file = "version-prod.txt"
46
+ else:
47
+ # Default to dev for unknown branches
48
+ version_file = "version-dev.txt"
49
+ append_dev_suffix = True
50
+ except (subprocess.CalledProcessError, FileNotFoundError):
51
+ # Default to dev if git detection fails
52
+ version_file = "version-dev.txt"
53
+ append_dev_suffix = True
54
+
55
+ # Read the determined version file
56
+ try:
57
+ with open(version_file, "r", encoding="utf-8") as f:
58
+ version = f.read().strip()
59
+ if append_dev_suffix and not version.endswith("dev"):
60
+ version = f"{version}dev"
61
+ print(f"Using version {version} from {version_file}")
62
+ return version
63
+ except FileNotFoundError:
64
+ raise FileNotFoundError(f"Version file not found: {version_file}")
65
+
66
+ VERSION = get_version()
67
+
68
+ class PyArmorBuild(_build_py):
69
+ """Custom build_py to obfuscate Python files using PyArmor."""
70
+
71
+ def run(self):
72
+ try:
73
+ # Clean up previous obfuscated files
74
+ if os.path.exists(OBFUSCATED_DIR):
75
+ shutil.rmtree(OBFUSCATED_DIR)
76
+
77
+ # Run PyArmor obfuscation
78
+ self._obfuscate_package()
79
+
80
+ # Copy obfuscated files to build directory
81
+ self._copy_obfuscated_files()
82
+
83
+ except Exception as e:
84
+ print(f"Error in PyArmorBuild: {e}")
85
+ raise
86
+
87
+ def _obfuscate_package(self):
88
+ """Obfuscate the package using PyArmor."""
89
+ print(f"Obfuscating package {PACKAGE_NAME}...")
90
+
91
+ # Check if we should skip obfuscation
92
+ skip_obfuscation = os.environ.get('SKIP_PYARMOR_OBFUSCATION', '').lower() == 'true'
93
+ if skip_obfuscation:
94
+ print("⚠ Skipping PyArmor obfuscation (SKIP_PYARMOR_OBFUSCATION=true)")
95
+ self._copy_source_files()
96
+ return
97
+
98
+ # Create output directory
99
+ os.makedirs(OBFUSCATED_DIR, exist_ok=True)
100
+
101
+ # Try obfuscating core files first (most important)
102
+ core_files = self._get_core_files()
103
+ if core_files:
104
+ print(f"Attempting to obfuscate {len(core_files)} core files first...")
105
+ success = self._obfuscate_selective(core_files)
106
+ if not success:
107
+ print("⚠ Core file obfuscation failed, falling back to copying source files")
108
+ self._copy_source_files()
109
+ return
110
+
111
+ # Try full obfuscation
112
+ cmd = [
113
+ "pyarmor",
114
+ "gen",
115
+ "--output", OBFUSCATED_DIR,
116
+ SOURCE_DIR
117
+ ]
118
+
119
+ try:
120
+ result = subprocess.run(cmd, capture_output=True, text=True, check=True)
121
+ print("✓ PyArmor obfuscation completed successfully")
122
+ if result.stdout:
123
+ print(f"PyArmor output: {result.stdout}")
124
+ except subprocess.CalledProcessError as e:
125
+ error_msg = e.stderr or str(e)
126
+ print(f"⚠ PyArmor obfuscation failed: {e}")
127
+ if e.stderr:
128
+ print(f"Error details: {e.stderr}")
129
+
130
+ # Handle specific license limitation error
131
+ if "out of license" in error_msg or "license" in error_msg.lower():
132
+ print("\n" + "="*60)
133
+ print("PyArmor Trial License Limitation Detected")
134
+ print("="*60)
135
+ print("The free trial version of PyArmor has a file limit.")
136
+ print("Your package has too many files to obfuscate with the trial version.")
137
+ print("\nOptions to resolve this:")
138
+ print("1. Purchase a PyArmor license: https://pyarmor.readthedocs.io/en/stable/licenses.html")
139
+ print("2. Reduce the number of files (exclude test files, examples, etc.)")
140
+ print("3. Set environment variable: SKIP_PYARMOR_OBFUSCATION=true")
141
+ print("4. Use selective obfuscation of core files only")
142
+ print("="*60)
143
+
144
+ # Fall back to copying source files without obfuscation
145
+ print("Falling back to building package without obfuscation...")
146
+ self._copy_source_files()
147
+ return
148
+ else:
149
+ raise
150
+ except FileNotFoundError:
151
+ print("PyArmor not found. Please install PyArmor: pip install pyarmor")
152
+ raise
153
+
154
+ def _get_core_files(self):
155
+ """Get list of core files to obfuscate (excluding tests, examples)."""
156
+ core_files = []
157
+ if not os.path.exists(SOURCE_DIR):
158
+ return core_files
159
+
160
+ for root, dirs, files in os.walk(SOURCE_DIR):
161
+ # Skip test directories and other non-essential directories
162
+ dirs[:] = [d for d in dirs if not d.startswith(('test', '__pycache__', 'example', 'demo'))]
163
+
164
+ for file in files:
165
+ if file.endswith('.py') and not file.startswith('test_'):
166
+ core_files.append(os.path.join(root, file))
167
+
168
+ return core_files
169
+
170
+ def _obfuscate_selective(self, file_list):
171
+ """Obfuscate only selected files."""
172
+ print(f"Attempting selective obfuscation of {len(file_list)} files...")
173
+
174
+ # Create a temporary directory with only core files
175
+ temp_source = f"{SOURCE_DIR}_temp"
176
+ try:
177
+ if os.path.exists(temp_source):
178
+ shutil.rmtree(temp_source)
179
+
180
+ # Copy only core files maintaining structure
181
+ for file_path in file_list:
182
+ rel_path = os.path.relpath(file_path, SOURCE_DIR)
183
+ dest_path = os.path.join(temp_source, rel_path)
184
+ os.makedirs(os.path.dirname(dest_path), exist_ok=True)
185
+ shutil.copy2(file_path, dest_path)
186
+
187
+ # Try to obfuscate the reduced set
188
+ cmd = ["pyarmor", "gen", "--output", OBFUSCATED_DIR, temp_source]
189
+ result = subprocess.run(cmd, capture_output=True, text=True, check=True)
190
+ print("✓ Selective obfuscation completed successfully")
191
+ return True
192
+
193
+ except subprocess.CalledProcessError as e:
194
+ print(f"✗ Selective obfuscation also failed: {e}")
195
+ return False
196
+ finally:
197
+ if os.path.exists(temp_source):
198
+ shutil.rmtree(temp_source)
199
+
200
+ def _copy_source_files(self):
201
+ """Copy source files without obfuscation as fallback."""
202
+ print("Copying source files without obfuscation...")
203
+
204
+ if os.path.exists(SOURCE_DIR):
205
+ dest_package_dir = os.path.join(OBFUSCATED_DIR, PACKAGE_NAME)
206
+ if os.path.exists(dest_package_dir):
207
+ shutil.rmtree(dest_package_dir)
208
+ shutil.copytree(SOURCE_DIR, dest_package_dir)
209
+ print(f"✓ Source files copied to {dest_package_dir}")
210
+ else:
211
+ print(f"✗ Source directory not found: {SOURCE_DIR}")
212
+
213
+ def _copy_obfuscated_files(self):
214
+ """Copy obfuscated files to build directory."""
215
+ build_package_dir = os.path.join(self.build_lib, PACKAGE_NAME)
216
+ os.makedirs(build_package_dir, exist_ok=True)
217
+
218
+ # Find the obfuscated package directory
219
+ obfuscated_package_dir = None
220
+ for root, dirs, files in os.walk(OBFUSCATED_DIR):
221
+ if PACKAGE_NAME in dirs:
222
+ obfuscated_package_dir = os.path.join(root, PACKAGE_NAME)
223
+ break
224
+
225
+ if not obfuscated_package_dir:
226
+ # Try direct path if PyArmor created it differently
227
+ obfuscated_package_dir = os.path.join(OBFUSCATED_DIR, PACKAGE_NAME)
228
+
229
+ if os.path.exists(obfuscated_package_dir):
230
+ # Copy all obfuscated files
231
+ for root, dirs, files in os.walk(obfuscated_package_dir):
232
+ for file in files:
233
+ src_path = os.path.join(root, file)
234
+ rel_path = os.path.relpath(src_path, obfuscated_package_dir)
235
+ dest_path = os.path.join(build_package_dir, rel_path)
236
+ os.makedirs(os.path.dirname(dest_path), exist_ok=True)
237
+ shutil.copy2(src_path, dest_path)
238
+
239
+ print(f"Copied obfuscated files to {build_package_dir}")
240
+ else:
241
+ print(f"Warning: Obfuscated package directory not found at {obfuscated_package_dir}")
242
+ print(f"Available directories in {OBFUSCATED_DIR}:")
243
+ if os.path.exists(OBFUSCATED_DIR):
244
+ for item in os.listdir(OBFUSCATED_DIR):
245
+ print(f" - {item}")
246
+
247
+ class PyArmorSdist(_sdist):
248
+ """Custom sdist to include obfuscated files."""
249
+
250
+ def run(self):
251
+ try:
252
+ # Run the build command first to generate obfuscated files
253
+ self.run_command("build_py")
254
+ super().run()
255
+ except Exception as e:
256
+ print(f"Error in PyArmorSdist: {e}")
257
+ raise
258
+
259
+ def find_original_packages():
260
+ """Find packages in the original source directory."""
261
+ packages = []
262
+ source_path = Path(SOURCE_DIR)
263
+ if source_path.exists():
264
+ for py_file in source_path.rglob("__init__.py"):
265
+ package_dir = py_file.parent
266
+ rel_path = package_dir.relative_to(SOURCE_DIR)
267
+ if rel_path == Path("."):
268
+ packages.append(PACKAGE_NAME)
269
+ else:
270
+ packages.append(f"{PACKAGE_NAME}.{str(rel_path).replace(os.sep, '.')}")
271
+ return packages
272
+
273
+ def get_package_data():
274
+ """Get package data for obfuscated files."""
275
+ return {
276
+ PACKAGE_NAME: [
277
+ "*.py",
278
+ "*.pyi",
279
+ "*.pyx",
280
+ "*.so",
281
+ "*.pyd",
282
+ "py.typed",
283
+ "**/*.py",
284
+ "**/*.pyi",
285
+ "**/*.pyx",
286
+ "**/*.so",
287
+ "**/*.pyd",
288
+ "**/py.typed",
289
+ "pytransform/*",
290
+ "**/*",
291
+ ],
292
+ }
293
+
294
+ # Ensure py.typed exists for type hints
295
+ def ensure_py_typed():
296
+ """Create py.typed file if it doesn't exist."""
297
+ src_py_typed = os.path.join(SOURCE_DIR, "py.typed")
298
+ if not os.path.exists(src_py_typed):
299
+ with open(src_py_typed, "w") as f:
300
+ f.write("")
301
+ print("Created py.typed file")
302
+
303
+ # Create py.typed file
304
+ ensure_py_typed()
305
+
306
+ setup(
307
+ name=PACKAGE_NAME,
308
+ version=VERSION,
309
+ packages=find_original_packages(),
310
+ package_dir={PACKAGE_NAME: SOURCE_DIR},
311
+ include_package_data=True,
312
+ package_data=get_package_data(),
313
+ cmdclass={
314
+ 'build_py': PyArmorBuild,
315
+ 'sdist': PyArmorSdist,
316
+ },
317
+ zip_safe=False,
318
+ python_requires=">=3.8",
319
+ setup_requires=[
320
+ "pyarmor>=8.0.0",
321
+ ],
322
+ )
@@ -0,0 +1,72 @@
1
+ """Module providing __init__ functionality."""
2
+
3
+ import os
4
+ import sys
5
+ from matrice_common.utils import dependencies_check
6
+
7
+ base = [
8
+ "httpx",
9
+ "fastapi",
10
+ "uvicorn",
11
+ "pillow",
12
+ "confluent_kafka[snappy]",
13
+ "aiokafka",
14
+ "aiohttp",
15
+ "filterpy",
16
+ "scipy",
17
+ "scikit-learn",
18
+ "matplotlib",
19
+ "scikit-image",
20
+ "python-snappy",
21
+ "pyyaml",
22
+ "imagehash",
23
+ "Pillow",
24
+ "transformers"
25
+ ]
26
+
27
+ # Install base dependencies first
28
+ dependencies_check(base)
29
+
30
+ # Helper to attempt installation and verify importability
31
+ def _install_and_verify(pkg: str, import_name: str):
32
+ """Install a package expression and return True if the import succeeds."""
33
+ if dependencies_check([pkg]):
34
+ try:
35
+ __import__(import_name)
36
+ return True
37
+ except ImportError:
38
+ return False
39
+ return False
40
+
41
+ if not dependencies_check(["opencv-python"]):
42
+ dependencies_check(["opencv-python-headless"])
43
+
44
+ # Attempt GPU-specific dependencies first
45
+ _gpu_ok = _install_and_verify("onnxruntime-gpu", "onnxruntime") and _install_and_verify(
46
+ "fast-plate-ocr[onnx-gpu]", "fast_plate_ocr"
47
+ )
48
+
49
+ if not _gpu_ok:
50
+ # Fallback to CPU variants
51
+ _cpu_ok = _install_and_verify("onnxruntime", "onnxruntime") and _install_and_verify(
52
+ "fast-plate-ocr[onnx]", "fast_plate_ocr"
53
+ )
54
+ if not _cpu_ok:
55
+ # Last-chance fallback without extras tag (PyPI sometimes lacks them)
56
+ _install_and_verify("fast-plate-ocr", "fast_plate_ocr")
57
+
58
+ # matrice_deps = ["matrice_common", "matrice_analytics", "matrice"]
59
+
60
+ # dependencies_check(matrice_deps)
61
+ sys.path.append(os.path.dirname(os.path.abspath(__file__)))
62
+ from server.server import MatriceDeployServer # noqa: E402
63
+ from server.server import MatriceDeployServer as MatriceDeploy # noqa: E402 # Keep this for backwards compatibility
64
+ from server.inference_interface import InferenceInterface # noqa: E402
65
+ from server.proxy_interface import MatriceProxyInterface # noqa: E402
66
+
67
+ __all__ = [
68
+ "MatriceDeploy",
69
+ "MatriceDeployServer",
70
+ "InferenceInterface",
71
+ "MatriceProxyInterface",
72
+ ]
@@ -0,0 +1,23 @@
1
+ import os
2
+ import logging
3
+
4
+ # Root logger
5
+ logging.basicConfig(level=logging.DEBUG)
6
+
7
+ # Console handler (INFO+)
8
+ console_handler = logging.StreamHandler()
9
+ console_handler.setLevel(logging.INFO)
10
+
11
+ # File handler (DEBUG+)
12
+ log_path = os.path.join(os.getcwd(), "deploy_server.log")
13
+ file_handler = logging.FileHandler(log_path)
14
+ file_handler.setLevel(logging.DEBUG)
15
+
16
+ # Formatter
17
+ formatter = logging.Formatter("%(asctime)s - %(levelname)s - %(message)s")
18
+ console_handler.setFormatter(formatter)
19
+ file_handler.setFormatter(formatter)
20
+
21
+ # Add handlers to root logger
22
+ logging.getLogger().addHandler(console_handler)
23
+ logging.getLogger().addHandler(file_handler)