compox 2.0.0.dev1__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.
Files changed (104) hide show
  1. compox-2.0.0.dev1/LICENSE +218 -0
  2. compox-2.0.0.dev1/NOTICE +14 -0
  3. compox-2.0.0.dev1/PKG-INFO +277 -0
  4. compox-2.0.0.dev1/README.md +243 -0
  5. compox-2.0.0.dev1/THIRD_PARTY_LICENSES.txt +27977 -0
  6. compox-2.0.0.dev1/pyproject.toml +70 -0
  7. compox-2.0.0.dev1/src/compox/__init__.py +0 -0
  8. compox-2.0.0.dev1/src/compox/algorithm_utils/AlgorithmConfigSchema.py +258 -0
  9. compox-2.0.0.dev1/src/compox/algorithm_utils/AlgorithmDeployer.py +1119 -0
  10. compox-2.0.0.dev1/src/compox/algorithm_utils/AlgorithmManager.py +167 -0
  11. compox-2.0.0.dev1/src/compox/algorithm_utils/BaseRunner.py +605 -0
  12. compox-2.0.0.dev1/src/compox/algorithm_utils/Image2AlignmentRunner.py +174 -0
  13. compox-2.0.0.dev1/src/compox/algorithm_utils/Image2EmbeddingRunner.py +175 -0
  14. compox-2.0.0.dev1/src/compox/algorithm_utils/Image2ImageRunner.py +194 -0
  15. compox-2.0.0.dev1/src/compox/algorithm_utils/Image2SegmentationRunner.py +191 -0
  16. compox-2.0.0.dev1/src/compox/algorithm_utils/Segmentation2SegmentationRunner.py +193 -0
  17. compox-2.0.0.dev1/src/compox/algorithm_utils/__init__.py +0 -0
  18. compox-2.0.0.dev1/src/compox/algorithm_utils/deployment_utils.py +76 -0
  19. compox-2.0.0.dev1/src/compox/algorithm_utils/io_schemas.py +80 -0
  20. compox-2.0.0.dev1/src/compox/algorithm_utils/runner_context.py +8 -0
  21. compox-2.0.0.dev1/src/compox/cli.py +386 -0
  22. compox-2.0.0.dev1/src/compox/components/api_builder.py +200 -0
  23. compox-2.0.0.dev1/src/compox/components/celery_builder.py +55 -0
  24. compox-2.0.0.dev1/src/compox/components/db_connection_builder.py +46 -0
  25. compox-2.0.0.dev1/src/compox/components/minio_wrapper.py +75 -0
  26. compox-2.0.0.dev1/src/compox/components/server_builder.py +97 -0
  27. compox-2.0.0.dev1/src/compox/config/server_settings.py +267 -0
  28. compox-2.0.0.dev1/src/compox/database_connection/BaseConnection.py +225 -0
  29. compox-2.0.0.dev1/src/compox/database_connection/InMemoryConnection.py +205 -0
  30. compox-2.0.0.dev1/src/compox/database_connection/S3Connection.py +452 -0
  31. compox-2.0.0.dev1/src/compox/database_connection/TempfileConnection.py +210 -0
  32. compox-2.0.0.dev1/src/compox/database_connection/__init__.py +0 -0
  33. compox-2.0.0.dev1/src/compox/database_connection/database_utils.py +179 -0
  34. compox-2.0.0.dev1/src/compox/deploy_algorithms.py +151 -0
  35. compox-2.0.0.dev1/src/compox/internal/CUDAMemoryManager.py +36 -0
  36. compox-2.0.0.dev1/src/compox/internal/JobPOpen.py +105 -0
  37. compox-2.0.0.dev1/src/compox/internal/ServerSystrayInterface.py +305 -0
  38. compox-2.0.0.dev1/src/compox/internal/__init__.py +0 -0
  39. compox-2.0.0.dev1/src/compox/internal/downloader.py +127 -0
  40. compox-2.0.0.dev1/src/compox/internal/logging.py +164 -0
  41. compox-2.0.0.dev1/src/compox/pydantic_models.py +363 -0
  42. compox-2.0.0.dev1/src/compox/routers/__init__.py +0 -0
  43. compox-2.0.0.dev1/src/compox/routers/algorithms_controller.py +285 -0
  44. compox-2.0.0.dev1/src/compox/routers/execution_controller.py +196 -0
  45. compox-2.0.0.dev1/src/compox/routers/execution_manager.py +120 -0
  46. compox-2.0.0.dev1/src/compox/routers/file_controller.py +188 -0
  47. compox-2.0.0.dev1/src/compox/routers/file_controller_v1.py +162 -0
  48. compox-2.0.0.dev1/src/compox/routers/root.py +64 -0
  49. compox-2.0.0.dev1/src/compox/run_server.py +103 -0
  50. compox-2.0.0.dev1/src/compox/run_worker.py +70 -0
  51. compox-2.0.0.dev1/src/compox/server_utils.py +410 -0
  52. compox-2.0.0.dev1/src/compox/session/DataCache.py +166 -0
  53. compox-2.0.0.dev1/src/compox/session/TaskSession.py +296 -0
  54. compox-2.0.0.dev1/src/compox/session/__init__.py +0 -0
  55. compox-2.0.0.dev1/src/compox/tasks/DebuggingTaskHandler.py +99 -0
  56. compox-2.0.0.dev1/src/compox/tasks/TaskHandler.py +1050 -0
  57. compox-2.0.0.dev1/src/compox/tasks/__init__.py +0 -0
  58. compox-2.0.0.dev1/src/compox/tasks/celery_task.py +92 -0
  59. compox-2.0.0.dev1/src/compox/tasks/context_task_handler.py +11 -0
  60. compox-2.0.0.dev1/src/compox/tasks/fastapi_background_task.py +87 -0
  61. compox-2.0.0.dev1/tests/.gitignore +1 -0
  62. compox-2.0.0.dev1/tests/__init__.py +0 -0
  63. compox-2.0.0.dev1/tests/algorithms/bar/Runner.py +79 -0
  64. compox-2.0.0.dev1/tests/algorithms/bar/__init__.py +0 -0
  65. compox-2.0.0.dev1/tests/algorithms/bar/dependencies/some_more_files/__init__.py +0 -0
  66. compox-2.0.0.dev1/tests/algorithms/bar/dependencies/some_more_files/layer.py +0 -0
  67. compox-2.0.0.dev1/tests/algorithms/bar/dependencies/some_more_files/layer2.py +0 -0
  68. compox-2.0.0.dev1/tests/algorithms/bar/dependencies/utils.py +8 -0
  69. compox-2.0.0.dev1/tests/algorithms/bar/main.py +23 -0
  70. compox-2.0.0.dev1/tests/algorithms/bar/pyproject.toml +31 -0
  71. compox-2.0.0.dev1/tests/algorithms/dummy/README.md +261 -0
  72. compox-2.0.0.dev1/tests/algorithms/dummy/Runner.py +79 -0
  73. compox-2.0.0.dev1/tests/algorithms/dummy/__init__.py +0 -0
  74. compox-2.0.0.dev1/tests/algorithms/dummy/pyproject.toml +32 -0
  75. compox-2.0.0.dev1/tests/algorithms/foo/Runner.py +81 -0
  76. compox-2.0.0.dev1/tests/algorithms/foo/__init__.py +0 -0
  77. compox-2.0.0.dev1/tests/algorithms/foo/dependencies/__init__.py +0 -0
  78. compox-2.0.0.dev1/tests/algorithms/foo/dependencies/some_more_files/__init__.py +0 -0
  79. compox-2.0.0.dev1/tests/algorithms/foo/dependencies/some_more_files/layer.py +0 -0
  80. compox-2.0.0.dev1/tests/algorithms/foo/dependencies/some_more_files/layer2.py +0 -0
  81. compox-2.0.0.dev1/tests/algorithms/foo/dependencies/utils.py +8 -0
  82. compox-2.0.0.dev1/tests/algorithms/foo/main.py +23 -0
  83. compox-2.0.0.dev1/tests/algorithms/foo/pyproject.toml +32 -0
  84. compox-2.0.0.dev1/tests/conftest.py +227 -0
  85. compox-2.0.0.dev1/tests/pytest.ini +6 -0
  86. compox-2.0.0.dev1/tests/test_algorithm_deployer.py +353 -0
  87. compox-2.0.0.dev1/tests/test_base_runner.py +125 -0
  88. compox-2.0.0.dev1/tests/test_child_runners.py +221 -0
  89. compox-2.0.0.dev1/tests/test_datacache.py +103 -0
  90. compox-2.0.0.dev1/tests/test_delete_file.py +49 -0
  91. compox-2.0.0.dev1/tests/test_execute_algorithm.py +134 -0
  92. compox-2.0.0.dev1/tests/test_file_controller_v1.py +63 -0
  93. compox-2.0.0.dev1/tests/test_get_algorithm.py +98 -0
  94. compox-2.0.0.dev1/tests/test_get_all_algorithms.py +50 -0
  95. compox-2.0.0.dev1/tests/test_get_execution_record.py +211 -0
  96. compox-2.0.0.dev1/tests/test_get_file.py +36 -0
  97. compox-2.0.0.dev1/tests/test_post_file.py +95 -0
  98. compox-2.0.0.dev1/tests/test_runner_attribute_behavior.py +246 -0
  99. compox-2.0.0.dev1/tests/test_server.yaml +33 -0
  100. compox-2.0.0.dev1/tests/test_server_utils.py +365 -0
  101. compox-2.0.0.dev1/tests/test_stress.py +192 -0
  102. compox-2.0.0.dev1/tests/test_task_handler.py +681 -0
  103. compox-2.0.0.dev1/tests/test_task_session.py +97 -0
  104. compox-2.0.0.dev1/tests/test_utils.py +320 -0
@@ -0,0 +1,218 @@
1
+ Compox License
2
+ Copyright 2025 TESCAN 3DIM, s.r.o.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License") modified
5
+ with Commons Clause Restriction; you may not use this file except in
6
+ compliance with the License. You may obtain a copy of the License at:
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, the software
11
+ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ License for the specific language governing permissions and limitations
14
+ under the License.
15
+
16
+ ---- Commons Clause License Condition v1.0 ----
17
+
18
+ The Software is provided to you by the Licensor under the License, as
19
+ defined below, subject to the following condition.
20
+
21
+ Without limiting other conditions in the License, the grant of rights under
22
+ the License will not include, and the License does not grant to you, the
23
+ right to Sell the Software.
24
+
25
+ For purposes of the foregoing, “Sell” means practicing any or all of the
26
+ rights granted to you under the License to provide to third parties, for a
27
+ fee or other consideration (including without limitation fees for hosting or
28
+ consulting/ support services related to the Software), a product or service
29
+ whose value derives, entirely or substantially, from the functionality of the
30
+ Software. Any license notice or attribution required by the License must also
31
+ include this Commons Clause License Condition notice.
32
+
33
+ Software: Compox
34
+
35
+ License: Apache 2.0
36
+
37
+ Licensor: TESCAN 3DIM, s.r.o.
38
+
39
+ ---- End of Commons Clause ----
40
+
41
+ ---- Full Apache License, Version 2.0 Text ----
42
+
43
+ Apache License
44
+ Version 2.0, January 2004
45
+ http://www.apache.org/licenses/
46
+
47
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
48
+
49
+ 1. Definitions.
50
+
51
+ "License" shall mean the terms and conditions for use, reproduction,
52
+ and distribution as defined by Sections 1 through 9 of this document.
53
+
54
+ "Licensor" shall mean the copyright owner or entity authorized by
55
+ the copyright owner that is granting the License.
56
+
57
+ "Legal Entity" shall mean the union of the acting entity and all
58
+ other entities that control, are controlled by, or are under common
59
+ control with that entity. For the purposes of this definition,
60
+ "control" means (i) the power, direct or indirect, to cause the
61
+ direction or management of such entity, whether by contract or
62
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
63
+ outstanding shares, or (iii) beneficial ownership of such entity.
64
+
65
+ "You" (or "Your") shall mean an individual or Legal Entity
66
+ exercising permissions granted by this License.
67
+
68
+ "Source" form shall mean the preferred form for making modifications,
69
+ including but not limited to software source code, documentation
70
+ source, and configuration files.
71
+
72
+ "Object" form shall mean any form resulting from mechanical
73
+ transformation or translation of a Source form, including but
74
+ not limited to compiled object code, generated documentation,
75
+ and conversions to other media types.
76
+
77
+ "Work" shall mean the work of authorship, whether in Source or
78
+ Object form, made available under the License, as indicated by a
79
+ copyright notice that is included in or attached to the work
80
+ (an example is provided in the Appendix below).
81
+
82
+ "Derivative Works" shall mean any work, whether in Source or Object
83
+ form, that is based on (or derived from) the Work and for which the
84
+ editorial revisions, annotations, elaborations, or other modifications
85
+ represent, as a whole, an original work of authorship. For the purposes
86
+ of this License, Derivative Works shall not include works that remain
87
+ separable from, or merely link (or bind by name) to the interfaces of,
88
+ the Work and Derivative Works thereof.
89
+
90
+ "Contribution" shall mean any work of authorship, including
91
+ the original version of the Work and any modifications or additions
92
+ to that Work or Derivative Works thereof, that is intentionally
93
+ submitted to Licensor for inclusion in the Work by the copyright owner
94
+ or by an individual or Legal Entity authorized to submit on behalf of
95
+ the copyright owner. For the purposes of this definition, "submitted"
96
+ means any form of electronic, verbal, or written communication sent
97
+ to the Licensor or its representatives, including but not limited to
98
+ communication on electronic mailing lists, source code control systems,
99
+ and issue tracking systems that are managed by, or on behalf of, the
100
+ Licensor for the purpose of discussing and improving the Work, but
101
+ excluding communication that is conspicuously marked or otherwise
102
+ designated in writing by the copyright owner as "Not a Contribution."
103
+
104
+ "Contributor" shall mean Licensor and any individual or Legal Entity
105
+ on behalf of whom a Contribution has been received by Licensor and
106
+ subsequently incorporated within the Work.
107
+
108
+ 2. Grant of Copyright License. Subject to the terms and conditions of
109
+ this License, each Contributor hereby grants to You a perpetual,
110
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
111
+ copyright license to reproduce, prepare Derivative Works of,
112
+ publicly display, publicly perform, sublicense, and distribute the
113
+ Work and such Derivative Works in Source or Object form.
114
+
115
+ 3. Grant of Patent License. Subject to the terms and conditions of
116
+ this License, each Contributor hereby grants to You a perpetual,
117
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
118
+ (except as stated in this section) patent license to make, have made,
119
+ use, offer to sell, sell, import, and otherwise transfer the Work,
120
+ where such license applies only to those patent claims licensable
121
+ by such Contributor that are necessarily infringed by their
122
+ Contribution(s) alone or by combination of their Contribution(s)
123
+ with the Work to which such Contribution(s) was submitted. If You
124
+ institute patent litigation against any entity (including a
125
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
126
+ or a Contribution incorporated within the Work constitutes direct
127
+ or contributory patent infringement, then any patent licenses
128
+ granted to You under this License for that Work shall terminate
129
+ as of the date such litigation is filed.
130
+
131
+ 4. Redistribution. You may reproduce and distribute copies of the
132
+ Work or Derivative Works thereof in any medium, with or without
133
+ modifications, and in Source or Object form, provided that You
134
+ meet the following conditions:
135
+
136
+ (a) You must give any other recipients of the Work or
137
+ Derivative Works a copy of this License; and
138
+
139
+ (b) You must cause any modified files to carry prominent notices
140
+ stating that You changed the files; and
141
+
142
+ (c) You must retain, in the Source form of any Derivative Works
143
+ that You distribute, all copyright, patent, trademark, and
144
+ attribution notices from the Source form of the Work,
145
+ excluding those notices that do not pertain to any part of
146
+ the Derivative Works; and
147
+
148
+ (d) If the Work includes a "NOTICE" text file as part of its
149
+ distribution, then any Derivative Works that You distribute must
150
+ include a readable copy of the attribution notices contained
151
+ within such NOTICE file, excluding those notices that do not
152
+ pertain to any part of the Derivative Works, in at least one
153
+ of the following places: within a NOTICE text file distributed
154
+ as part of the Derivative Works; within the Source form or
155
+ documentation, if provided along with the Derivative Works; or,
156
+ within a display generated by the Derivative Works, if and
157
+ wherever such third-party notices normally appear. The contents
158
+ of the NOTICE file are for informational purposes only and
159
+ do not modify the License. You may add Your own attribution
160
+ notices within Derivative Works that You distribute, alongside
161
+ or as an addendum to the NOTICE text from the Work, provided
162
+ that such additional attribution notices cannot be construed
163
+ as modifying the License.
164
+
165
+ You may add Your own copyright statement to Your modifications and
166
+ may provide additional or different license terms and conditions
167
+ for use, reproduction, or distribution of Your modifications, or
168
+ for any such Derivative Works as a whole, provided Your use,
169
+ reproduction, and distribution of the Work otherwise complies with
170
+ the conditions stated in this License.
171
+
172
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
173
+ any Contribution intentionally submitted for inclusion in the Work
174
+ by You to the Licensor shall be under the terms and conditions of
175
+ this License, without any additional terms or conditions.
176
+ Notwithstanding the above, nothing herein shall supersede or modify
177
+ the terms of any separate license agreement you may have executed
178
+ with Licensor regarding such Contributions.
179
+
180
+ 6. Trademarks. This License does not grant permission to use the trade
181
+ names, trademarks, service marks, or product names of the Licensor,
182
+ except as required for reasonable and customary use in describing the
183
+ origin of the Work and reproducing the content of the NOTICE file.
184
+
185
+ 7. Disclaimer of Warranty. Unless required by applicable law or
186
+ agreed to in writing, Licensor provides the Work (and each
187
+ Contributor provides its Contributions) on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
189
+ implied, including, without limitation, any warranties or conditions
190
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
191
+ PARTICULAR PURPOSE. You are solely responsible for determining the
192
+ appropriateness of using or redistributing the Work and assume any
193
+ risks associated with Your exercise of permissions under this License.
194
+
195
+ 8. Limitation of Liability. In no event and under no legal theory,
196
+ whether in tort (including negligence), contract, or otherwise,
197
+ unless required by applicable law (such as deliberate and grossly
198
+ negligent acts) or agreed to in writing, shall any Contributor be
199
+ liable to You for damages, including any direct, indirect, special,
200
+ incidental, or consequential damages of any character arising as a
201
+ result of this License or out of the use or inability to use the
202
+ Work (including but not limited to damages for loss of goodwill,
203
+ work stoppage, computer failure or malfunction, or any and all
204
+ other commercial damages or losses), even if such Contributor
205
+ has been advised of the possibility of such damages.
206
+
207
+ 9. Accepting Warranty or Additional Liability. While redistributing
208
+ the Work or Derivative Works thereof, You may choose to offer,
209
+ and charge a fee for, acceptance of support, warranty, indemnity,
210
+ or other liability obligations and/or rights consistent with this
211
+ License. However, in accepting such obligations, You may act only
212
+ on Your own behalf and on Your sole responsibility, not on behalf
213
+ of any other Contributor, and only if You agree to indemnify,
214
+ defend, and hold each Contributor harmless for any liability
215
+ incurred by, or claims asserted against, such Contributor by reason
216
+ of your accepting any such warranty or additional liability.
217
+
218
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,14 @@
1
+ Compox
2
+ Copyright 2025 TESCAN 3DIM, s.r.o.
3
+
4
+ This project includes the following dependencies which carry NOTICE files:
5
+
6
+ ------------------------------------------------------------------------
7
+ **requests** (licensed under Apache-2.0)
8
+ NOTICE content included verbatim:
9
+ “Copyright 2019 Kenneth Reitz”
10
+ ------------------------------------------------------------------------
11
+ **boto3** (licensed under Apache-2.0)
12
+ NOTICE content included verbatim:
13
+ “Copyright 2013–2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.”
14
+ ------------------------------------------------------------------------
@@ -0,0 +1,277 @@
1
+ Metadata-Version: 2.4
2
+ Name: compox
3
+ Version: 2.0.0.dev1
4
+ Author-Email: Jan Matula <jan.matula@tescan.com>, =?utf-8?q?Old=C5=99ich_Kodym?= <oldrich.kodym@tescan.com>
5
+ License-Expression: Apache-2.0 AND LicenseRef-Commons-Clause-1.0
6
+ License-File: LICENSE
7
+ License-File: NOTICE
8
+ License-File: THIRD_PARTY_LICENSES.txt
9
+ Requires-Python: >=3.10.0
10
+ Requires-Dist: fastapi>=0.100.1
11
+ Requires-Dist: boto3>=1.36.0
12
+ Requires-Dist: celery==5.3.1
13
+ Requires-Dist: uvicorn>=0.25.0
14
+ Requires-Dist: h5py>=3.9.0
15
+ Requires-Dist: numpy<2.0.0
16
+ Requires-Dist: natsort==8.4.0
17
+ Requires-Dist: pytest>=7.4.2
18
+ Requires-Dist: pydantic-settings>=2.0.3
19
+ Requires-Dist: python-minifier>=2.9.0
20
+ Requires-Dist: pystray>=0.19.5
21
+ Requires-Dist: pywin32>=306; platform_system == "Windows"
22
+ Requires-Dist: pyyaml>=6.0.2
23
+ Requires-Dist: toml>=0.10.2
24
+ Requires-Dist: flower>=2.0.1
25
+ Requires-Dist: python-multipart>=0.0.20
26
+ Requires-Dist: mangum>=0.19.0
27
+ Requires-Dist: requests==2.32.3
28
+ Requires-Dist: pycurl>=7.45.4
29
+ Requires-Dist: loguru>=0.7.3
30
+ Requires-Dist: typer>=0.16.0
31
+ Requires-Dist: pip>=25.2
32
+ Requires-Dist: build>=1.3.0
33
+ Description-Content-Type: text/markdown
34
+
35
+ # Compox
36
+ Compox is a simple Python execution engine based on FastAPI with a MinIO object storage and Celery task queue. The app is designed to run algorithms written in Python on the server and report the results to the user.
37
+ ## Installation
38
+ Compox can be installed through PyPI:
39
+ ```bash
40
+ pip install compox
41
+ ```
42
+
43
+ You can also install the server by cloning this repository and installing it from source.
44
+
45
+ Note that some additional dependencies, such as MinIO executable for your operating system, will be downloaded on the first run of the server.
46
+
47
+ ## Running the server
48
+ Once installed into your Python environment, it's recommended to generate an initial configuration file with `compox generate-config`.
49
+ To see the available options for the `generate-config` command, you can run:
50
+
51
+ ```bash
52
+ compox generate-config --help
53
+ ```
54
+
55
+ The Compox can be run using the `compox` command. This command is available in the virtual environment created during the setup process. Run the following command to list the available commands:
56
+
57
+ ```bash
58
+ compox --help
59
+ ```
60
+
61
+ To run the Compox, use the following command:
62
+
63
+ ```bash
64
+ compox run --config /path/to/config.yaml
65
+ ```
66
+
67
+ ### Deploying algorithms
68
+ A future release of this package will include a detailed tutorial on how to prepare a data processing algorithm for T3D applications.
69
+
70
+ Once your algorithm is ready, you can use the `compox deploy-algorithms` command to deploy it to your server. This command will read the algorithm definitions from the specified configuration file and deploy them to the server. For example:
71
+
72
+ ```bash
73
+ compox deploy-algorithms --config /path/to/config.yaml
74
+ ```
75
+
76
+ To see the available options for the `deploy-algorithms` command, you can run:
77
+
78
+ ```bash
79
+ compox deploy-algorithms --help
80
+ ```
81
+
82
+ ## Configuration
83
+ The server uses pydantic settings for configuration. The configuration can be either set in a yaml file or as arguments when running the server.
84
+
85
+ - Ensure all paths and URLs are correctly set before running the application.
86
+ - Adjust CUDA settings based on hardware capabilities.
87
+ - Logging paths should be accessible by the application to prevent errors.
88
+ - MinIO settings must align with whether it is run locally or through an external S3 service.
89
+ - See the [configuration reference](#configuration-reference) below for detailed configuration options.
90
+
91
+ <details><summary>Configuration reference</summary>
92
+
93
+ <br>
94
+
95
+ ### Compox Configuration Reference
96
+
97
+ | Section | Field | Default | Description |
98
+ |----------------------------------|-----------------------------|------------------------------------|-----------------------------------------------------------------------------|
99
+ | | `port` | `5461` | The main server port used to make requests |
100
+ | | `deploy_algorithms_from` | `"./algorithms"` | Directory for algorithm deployment sources. |
101
+ | | `log_path` | `"LOG_DEFAULT:compox.log"` | Path to the main log file (supports dynamic prefixes). |
102
+ | | `config` | `None` | Optional config path override. |
103
+ | `info` | `product_name` | `"TESCAN 3D Backend"` | Product display name. |
104
+ | `info` | `server_tags` | `[]` → auto appends `"compox"` | Tags attached to the server. `"compox"` is added automatically. |
105
+ | `info` | `group_name` | `"TESCAN GROUP, a.s."` | Name of the corporate group. |
106
+ | `info` | `organization_name` | `"TESCAN 3DIM, s.r.o."` | Full name of the organization. |
107
+ | `info` | `organization_domain` | `"tescan3dim.com"` | Domain used in server configuration. |
108
+ | `info` | `version` | `"0.1"` | Semantic version of the server release. |
109
+ | `gui` | `algorithm_add_remove_in_menus` | `False` | Enables/disables GUI menu for algorithm management. |
110
+ | `gui` | `use_systray` | `False` | Enables/disables systray GUI integration. |
111
+ | `gui` | `icon_path` | `"../compox/resources/compoxbackend.ico"` | Path to the systray icon (supports dynamic prefixes) |
112
+ | `storage` | `collection_prefix` | `""` | Prefix applied to object store collections. (useful for AWS s3 store, where unique bucket names are needed)|
113
+ | `storage` | `data_store_expire_days` | `1` | Number of days until stored datasets expire. |
114
+ | `storage` | `access_key_id` | `UUIDv4` | Generated access key for storage backend. If `null` is provided, random UUIDv4 is generated. |
115
+ | `storage` | `secret_access_key` | `UUIDv4` | Generated secret key for storage backend. If `null` is provided, random UUIDv4 is generated. |S
116
+ | `storage.backend_settings` (minio) | `provider` | `"minio"` | Selected backend provider. |
117
+ | `storage.backend_settings` (minio) | `start_instance` | `True` | Whether to start a local MinIO server. |
118
+ | `storage.backend_settings` (minio) | `port` | `9091` | MinIO service port. |
119
+ | `storage.backend_settings` (minio) | `console_port` | `9090` | MinIO admin console port. |
120
+ | `storage.backend_settings` (minio) | `executable_path` | `"minio/minio_bin"` | Path to the MinIO binary (accepts dynamic prefixes). |
121
+ | `storage.backend_settings` (minio) | `storage_path` | `"minio/compox_store"` | Storage directory used by MinIO (accepts dynamic prefixes). |
122
+ | `storage.backend_settings` (minio) | `aws_region` | `None` | Optional AWS compatibility region. |
123
+ | `storage.backend_settings` (minio) | `s3_domain_name` | `None` | Optional domain override for S3 compatibility. |
124
+ | `storage.backend_settings` (minio) | `s3_endpoint_url` | Derived from `port` | Computed as `http://localhost:{port}`. |
125
+ | `storage.backend_settings` (aws) | `provider` | `"aws"` | AWS backend selection. |
126
+ | `storage.backend_settings` (aws) | `s3_endpoint_url` | `None` | Optional override for S3 endpoint URL. |
127
+ | `storage.backend_settings` (aws) | `aws_region` | `None` | AWS region (e.g. `us-east-1`). |
128
+ | `storage.backend_settings` (aws) | `s3_domain_name` | `None` | Domain used for S3-style URLs. |
129
+ | `inference` | `device` | `"cuda"` | Device used for model inference (`"cpu"`, `"cuda"`, `"mps"`). |
130
+ | `inference` | `cuda_visible_devices` | `"0"` | Comma-separated list of visible CUDA GPUs. |
131
+ | `inference.backend_settings` (fastapi) | `executor` | `"fastapi_background_tasks"` | Task executor type. |
132
+ | `inference.backend_settings` (fastapi) | `worker_number` | `1` | Number of worker threads for FastAPI tasks. |
133
+ | `inference.backend_settings` (celery) | `executor` | `"celery"` | Task executor type. |
134
+ | `inference.backend_settings` (celery) | `worker_name` | `"compox_worker"` | Name of the Celery worker. |
135
+ | `inference.backend_settings` (celery) | `broker_url` | **Required** | URL of the message broker (e.g. `amqp://`, `redis://`). |
136
+ | `inference.backend_settings` (celery) | `result_backend` | `"rpc://"` | Backend used to store task results. |
137
+ | `inference.backend_settings` (celery) | `run_flower` | `False` | Whether to start a Flower dashboard. |
138
+ | `inference.backend_settings` (celery) | `flower_port` | `None` | Port for Flower UI (if `run_flower` is True). |
139
+ | `ssl` | `use_ssl` | `False` | Enables HTTPS if True. |
140
+ | `ssl` | `ssl_keyfile` | `None` | Optional path to the SSL key file (accepts dynamic prefixes). |
141
+ | `ssl` | `ssl_certfile` | `None` | Optional path to the SSL certificate file (accepts dynamic prefixes). |
142
+ | `middleware` | `allow_origins` | `[]` | List of allowed CORS origins. |
143
+ | `middleware` | `allow_methods` | `["GET"]` | HTTP methods permitted in CORS. |
144
+ | `middleware` | `allow_headers` | `[]` | Custom headers permitted in CORS. |
145
+ | `middleware` | `allow_credentials` | `False` | Whether to allow credentials in CORS. |
146
+ | `middleware` | `expose_headers` | `[]` | Headers exposed to browsers. |
147
+ | `middleware` | `max_age` | `3600` | Cache time (in seconds) for CORS preflight. |
148
+
149
+
150
+ Some fields in the Compox configuration (such as `log_path`, `icon_path`, `ssl_keyfile`, etc.) support **dynamic prefixes** that resolve to OS-specific or runtime-specific paths. This allows for portability across platforms (e.g., Windows, Linux) and between development and production environments.
151
+
152
+ #### Supported Prefixes
153
+
154
+ | Prefix | Meaning (Resolved To...) |
155
+ |--------------------------|------------------------------------------------------------------------------------------|
156
+ | `LOG_DEFAULT:` | A platform-dependent log directory: |
157
+ | | - Windows: `%TEMP%/<organization>/<product>` |
158
+ | | - Linux/macOS: `/var/log/<organization>/<product>` |
159
+ | `PROGRAMDATA_DEFAULT:` | A system-wide data directory (Windows only): |
160
+ | | - e.g., `%PROGRAMDATA%/<organization>/<product>` |
161
+ | | - On Linux/macOS, defaults to `"."` (current dir) |
162
+ | `RELATIVE_DEFAULT:` | A relative path to the current executable (PyInstaller compatible): |
163
+ | | - If bundled: `sys._MEIPASS/<path>` |
164
+ | | - Otherwise: `"./<path>"` |
165
+
166
+ > These are resolved **at runtime** in the `Settings.parse_paths()` validator method.
167
+
168
+ #### Example
169
+
170
+ ```yaml
171
+ log_path: "LOG_DEFAULT:compox.log"
172
+ ssl:
173
+ use_ssl: true
174
+ ssl_keyfile: "PROGRAMDATA_DEFAULT:ssl/server.key"
175
+ ssl_certfile: "PROGRAMDATA_DEFAULT:ssl/server.crt"
176
+ gui:
177
+ icon_path: "RELATIVE_DEFAULT:resources/icon.ico"
178
+ ```
179
+
180
+ ## Server Execution and Tooling
181
+
182
+ Compox can be run using the `compox` command. This command is available in the virtual environment created during the setup process. Run the following command to list the available commands:
183
+
184
+ ```bash
185
+ compox --help
186
+ ```
187
+
188
+ ### Running the Server
189
+ To run the Compox, use the following command:
190
+
191
+ ```bash
192
+ compox run --config config.yaml
193
+ ```
194
+
195
+ Replace `config.yaml` with the path to your configuration file. The server will start and listen on the port specified in the configuration.
196
+ You can also specify the configuration file directly in the command line, which will override the default configs and the configuarion field in the config file. Nested configuration fields can be specified using dot notation. For example, to set the executor to `celery` and the worker name to `my_worker`, you can run:
197
+
198
+ ```bash
199
+ compox run --config config.yaml --inference.backend_settings.executor celery --inference.backend_settings.worker_name my_worker
200
+ ```
201
+
202
+ To see the available options for the `run` command, you can run:
203
+
204
+ ```bash
205
+ compox run --help
206
+ ```
207
+
208
+ ### Worker spawning (for Celery)
209
+ To spawn a Celery worker, you can use the `compox spawn-worker` command. This command will start a Celery worker with the specified configuration. You can specify the worker name and other settings as needed. For example:
210
+
211
+ ```bash
212
+ compox spawn-worker --config config.yaml --inference.backend_settings.worker_name my_worker
213
+ ```
214
+
215
+ To see the available options for the `spawn-worker` command, you can run:
216
+
217
+ ```bash
218
+ compox spawn-worker --help
219
+ ```
220
+
221
+ ### Running tests
222
+ To run the tests, you can use the `compox test` command. This command will run the tests defined in the `tests` directory. You should provide the path to the folder containing the tests (`--test-path`), which is `tests` by default. You can either provide a path to a specific configuration file (`--config`), which will spawn a server instance and run the tests against it, or you can run the tests against a running server instance by providing the `--server-url` argument. For example:
223
+
224
+ ```bash
225
+ compox test --test-path tests --config config.yaml
226
+ ```
227
+
228
+ To see the available options for the `test` command, you can run:
229
+
230
+ ```bash
231
+ compox test --help
232
+ ```
233
+
234
+ ### Deploy algorithms
235
+ To deploy algorithms to the server, you can use the `compox deploy-algorithms` command. This command will read the algorithm definitions from the specified configuration file and deploy them to the server. For example:
236
+
237
+ ```bash
238
+ compox deploy-algorithms --config app_server.yaml
239
+ ```
240
+
241
+ To see the available options for the `deploy-algorithms` command, you can run:
242
+
243
+ ```bash
244
+ compox deploy-algorithms --help
245
+ ```
246
+
247
+ ### Generate configuration
248
+ If you don't have a configuration file, you can generate a default configuration file using the `compox generate-config` command. This command will create a default configuration file in the specified path. You can also override the default fields in the configuration file by providing them as command line arguments. You will be prompted if you try to generate a configuration file that already exists. For example:
249
+
250
+ ```bash
251
+ compox generate-config --path app_server.yaml --port 8888 --gui.use_systray True
252
+ ```
253
+
254
+ To see the available options for the `generate-config` command, you can run:
255
+
256
+ ```bash
257
+ compox generate-config --help
258
+ ```
259
+
260
+ ### Serving documentation
261
+ You can update documentation by navigating to the `python-computing-backend/compox/docs` directory and running the following command:
262
+
263
+ ```bash
264
+ make.bat html
265
+ ```
266
+
267
+ This will generate the documentation in the `_build/html` directory. After the documentation is built, you can serve it using the `compox serve-docs` command. This command will start a simple HTTP server to serve the documentation files. You can specify the directory where the documentation is located and the port on which to serve it. For example:
268
+
269
+ ```
270
+ compox serve-docs --directory docs/_build/html --port 8000
271
+ ```
272
+
273
+ To see the available options for the `serve-docs` command, you can run:
274
+
275
+ ```bash
276
+ compox serve-docs --help
277
+ ```