compox 2.0.0.dev1__tar.gz → 2.0.0.dev3__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 (108) hide show
  1. compox-2.0.0.dev3/PKG-INFO +151 -0
  2. compox-2.0.0.dev3/README.md +116 -0
  3. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/pyproject.toml +4 -1
  4. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/config/server_settings.py +3 -2
  5. compox-2.0.0.dev3/src/compox/resources/compoxbackend.ico +0 -0
  6. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/routers/root.py +4 -2
  7. compox-2.0.0.dev3/src/compox/version.py +7 -0
  8. compox-2.0.0.dev1/PKG-INFO +0 -277
  9. compox-2.0.0.dev1/README.md +0 -243
  10. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/LICENSE +0 -0
  11. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/NOTICE +0 -0
  12. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/THIRD_PARTY_LICENSES.txt +0 -0
  13. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/__init__.py +0 -0
  14. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/algorithm_utils/AlgorithmConfigSchema.py +0 -0
  15. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/algorithm_utils/AlgorithmDeployer.py +0 -0
  16. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/algorithm_utils/AlgorithmManager.py +0 -0
  17. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/algorithm_utils/BaseRunner.py +0 -0
  18. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/algorithm_utils/Image2AlignmentRunner.py +0 -0
  19. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/algorithm_utils/Image2EmbeddingRunner.py +0 -0
  20. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/algorithm_utils/Image2ImageRunner.py +0 -0
  21. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/algorithm_utils/Image2SegmentationRunner.py +0 -0
  22. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/algorithm_utils/Segmentation2SegmentationRunner.py +0 -0
  23. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/algorithm_utils/__init__.py +0 -0
  24. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/algorithm_utils/deployment_utils.py +0 -0
  25. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/algorithm_utils/io_schemas.py +0 -0
  26. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/algorithm_utils/runner_context.py +0 -0
  27. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/cli.py +0 -0
  28. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/components/api_builder.py +0 -0
  29. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/components/celery_builder.py +0 -0
  30. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/components/db_connection_builder.py +0 -0
  31. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/components/minio_wrapper.py +0 -0
  32. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/components/server_builder.py +0 -0
  33. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/database_connection/BaseConnection.py +0 -0
  34. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/database_connection/InMemoryConnection.py +0 -0
  35. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/database_connection/S3Connection.py +0 -0
  36. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/database_connection/TempfileConnection.py +0 -0
  37. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/database_connection/__init__.py +0 -0
  38. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/database_connection/database_utils.py +0 -0
  39. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/deploy_algorithms.py +0 -0
  40. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/internal/CUDAMemoryManager.py +0 -0
  41. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/internal/JobPOpen.py +0 -0
  42. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/internal/ServerSystrayInterface.py +0 -0
  43. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/internal/__init__.py +0 -0
  44. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/internal/downloader.py +0 -0
  45. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/internal/logging.py +0 -0
  46. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/pydantic_models.py +0 -0
  47. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/routers/__init__.py +0 -0
  48. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/routers/algorithms_controller.py +0 -0
  49. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/routers/execution_controller.py +0 -0
  50. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/routers/execution_manager.py +0 -0
  51. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/routers/file_controller.py +0 -0
  52. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/routers/file_controller_v1.py +0 -0
  53. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/run_server.py +0 -0
  54. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/run_worker.py +0 -0
  55. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/server_utils.py +0 -0
  56. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/session/DataCache.py +0 -0
  57. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/session/TaskSession.py +0 -0
  58. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/session/__init__.py +0 -0
  59. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/tasks/DebuggingTaskHandler.py +0 -0
  60. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/tasks/TaskHandler.py +0 -0
  61. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/tasks/__init__.py +0 -0
  62. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/tasks/celery_task.py +0 -0
  63. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/tasks/context_task_handler.py +0 -0
  64. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/src/compox/tasks/fastapi_background_task.py +0 -0
  65. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/.gitignore +0 -0
  66. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/__init__.py +0 -0
  67. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/algorithms/bar/Runner.py +0 -0
  68. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/algorithms/bar/__init__.py +0 -0
  69. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/algorithms/bar/dependencies/some_more_files/__init__.py +0 -0
  70. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/algorithms/bar/dependencies/some_more_files/layer.py +0 -0
  71. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/algorithms/bar/dependencies/some_more_files/layer2.py +0 -0
  72. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/algorithms/bar/dependencies/utils.py +0 -0
  73. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/algorithms/bar/main.py +0 -0
  74. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/algorithms/bar/pyproject.toml +0 -0
  75. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/algorithms/dummy/README.md +0 -0
  76. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/algorithms/dummy/Runner.py +0 -0
  77. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/algorithms/dummy/__init__.py +0 -0
  78. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/algorithms/dummy/pyproject.toml +0 -0
  79. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/algorithms/foo/Runner.py +0 -0
  80. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/algorithms/foo/__init__.py +0 -0
  81. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/algorithms/foo/dependencies/__init__.py +0 -0
  82. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/algorithms/foo/dependencies/some_more_files/__init__.py +0 -0
  83. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/algorithms/foo/dependencies/some_more_files/layer.py +0 -0
  84. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/algorithms/foo/dependencies/some_more_files/layer2.py +0 -0
  85. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/algorithms/foo/dependencies/utils.py +0 -0
  86. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/algorithms/foo/main.py +0 -0
  87. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/algorithms/foo/pyproject.toml +0 -0
  88. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/conftest.py +0 -0
  89. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/pytest.ini +0 -0
  90. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/test_algorithm_deployer.py +0 -0
  91. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/test_base_runner.py +0 -0
  92. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/test_child_runners.py +0 -0
  93. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/test_datacache.py +0 -0
  94. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/test_delete_file.py +0 -0
  95. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/test_execute_algorithm.py +0 -0
  96. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/test_file_controller_v1.py +0 -0
  97. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/test_get_algorithm.py +0 -0
  98. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/test_get_all_algorithms.py +0 -0
  99. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/test_get_execution_record.py +0 -0
  100. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/test_get_file.py +0 -0
  101. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/test_post_file.py +0 -0
  102. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/test_runner_attribute_behavior.py +0 -0
  103. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/test_server.yaml +0 -0
  104. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/test_server_utils.py +0 -0
  105. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/test_stress.py +0 -0
  106. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/test_task_handler.py +0 -0
  107. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/test_task_session.py +0 -0
  108. {compox-2.0.0.dev1 → compox-2.0.0.dev3}/tests/test_utils.py +0 -0
@@ -0,0 +1,151 @@
1
+ Metadata-Version: 2.4
2
+ Name: compox
3
+ Version: 2.0.0.dev3
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
+ Requires-Dist: pdm-backend>=2.4.5
34
+ Description-Content-Type: text/markdown
35
+
36
+ # Compox
37
+ Compox is a simple Python execution engine for Tescan applications. It's purpose is to run data processing algorithms written in Python on the server and report the results to the client application such as Tescan 3D Viewer or Picannto.
38
+ ## Installation
39
+ Compox can be installed through PyPI:
40
+ ```bash
41
+ pip install compox
42
+ ```
43
+
44
+ You can also install the server by cloning this repository and installing it from source.
45
+
46
+ Note that some additional dependencies, such as MinIO executable for your operating system, will be downloaded on the first run of the server.
47
+
48
+ ## Running the server
49
+ Once installed into your Python environment, Compox can be run using the `compox` command. This command is available in the virtual environment
50
+ created during the setup process. Run the following command to list the available commands:
51
+
52
+ ```bash
53
+ compox --help
54
+ ```
55
+
56
+ It's recommended to start with generating an initial configuration file with `compox generate-config`. See the configuration options section below.
57
+ To see the usage of the `generate-config` command, you can run:
58
+
59
+ ```bash
60
+ compox generate-config --help
61
+ ```
62
+
63
+ To run the Compox, use the following command:
64
+
65
+ ```bash
66
+ compox run --config /path/to/config.yaml
67
+ ```
68
+
69
+ ### Deploying algorithms
70
+ See Algorithm development tutorial for information about target structure of the deployable algorithms.
71
+
72
+ Once your algorithm is ready, you can use the `compox deploy-algorithms` command to deploy it to your server.
73
+ To see the usage of the `deploy-algorithms` command, you can run:
74
+
75
+ ```bash
76
+ compox deploy-algorithms --help
77
+ ```
78
+
79
+ This command will read the algorithm definitions from the folder specified in your configuration file with the `deploy_algorithms_from` key
80
+ and deploy them to the server. For example:
81
+
82
+ ```bash
83
+ compox deploy-algorithms --config /path/to/config.yaml
84
+ ```
85
+
86
+ Note that the server does not need to be running in order to deploy the algorithms.
87
+
88
+
89
+ ## Configuration
90
+ The server uses pydantic settings for configuration. The options can be either set as runtime arguments, in a yaml file, or using the `COMPOX__` environment variables, in corresponding order of precedence.
91
+
92
+ - Ensure all paths and URLs are correctly set before running the application.
93
+ - Adjust CUDA settings based on hardware capabilities.
94
+ - Logging paths should be accessible by the application to prevent errors.
95
+ - See the [configuration reference](#configuration-reference) below for detailed configuration options.
96
+
97
+ <details><summary>Configuration reference</summary>
98
+
99
+ <br>
100
+
101
+ ### Compox Configuration Reference
102
+
103
+ | Section | Field | Default | Description |
104
+ |----------------------------------|-----------------------------|------------------------------------|-----------------------------------------------------------------------------|
105
+ | | `port` | `5461` | The main server port used to make requests |
106
+ | | `deploy_algorithms_from` | `"./algorithms"` | Directory for algorithm deployment sources. |
107
+ | | `log_path` | `"LOG_DEFAULT:compox.log"` | Path to the main log file (supports dynamic prefixes). |
108
+ | | `config` | `None` | Optional config path override. |
109
+ | `info` | `product_name` | `"TESCAN 3D Backend"` | Product display name. |
110
+ | `info` | `server_tags` | `[]` → auto appends `"compox"` | Tags attached to the server. `"compox"` is added automatically. |
111
+ | `info` | `group_name` | `"TESCAN GROUP, a.s."` | Name of the corporate group. |
112
+ | `info` | `organization_name` | `"TESCAN 3DIM, s.r.o."` | Full name of the organization. |
113
+ | `info` | `organization_domain` | `"tescan3dim.com"` | Domain used in server configuration. |
114
+ | `gui` | `algorithm_add_remove_in_menus` | `False` | Enables/disables GUI menu for algorithm management. |
115
+ | `gui` | `use_systray` | `False` | Enables/disables systray GUI integration. |
116
+ | `gui` | `icon_path` | Path to the installed package resource | Path to the systray icon (supports dynamic prefixes) |
117
+ | `inference` | `device` | `"cuda"` | Device used for model inference (`"cpu"`, `"cuda"`, `"mps"`). |
118
+ | `inference` | `cuda_visible_devices` | `"0"` | Comma-separated list of visible CUDA GPUs. |
119
+ | `storage` | `collection_prefix` | `""` | Prefix applied to object store collections. (useful for AWS s3 store, where unique bucket names are needed)|
120
+ | `storage` | `data_store_expire_days` | `1` | Number of days until stored datasets expire. |
121
+ | `storage` | `access_key_id` | generated with `UUIDv4` | Generated access key for storage backend. If `null` is provided, random UUIDv4 is generated. |
122
+ | `storage` | `secret_access_key` | generated with `UUIDv4` | Generated secret key for storage backend. If `null` is provided, random UUIDv4 is generated. |S
123
+ | `storage.backend_settings` (minio) | `provider` | `"minio"` | Selected backend provider. |
124
+ | `storage.backend_settings` (minio) | `start_instance` | `True` | Whether to start a local MinIO server. |
125
+ | `storage.backend_settings` (minio) | `port` | `9091` | MinIO service port. |
126
+ | `storage.backend_settings` (minio) | `console_port` | `9090` | MinIO admin console port. |
127
+ | `storage.backend_settings` (minio) | `executable_path` | `"minio/minio_bin"` | Path to the MinIO binary (accepts dynamic prefixes). |
128
+ | `storage.backend_settings` (minio) | `storage_path` | `"minio/compox_store"` | Storage directory used by MinIO (accepts dynamic prefixes). |
129
+ | `storage.backend_settings` (minio) | `aws_region` | `None` | Optional AWS compatibility region. |
130
+ | `storage.backend_settings` (minio) | `s3_domain_name` | `None` | Optional domain override for S3 compatibility. |
131
+ | `storage.backend_settings` (minio) | `s3_endpoint_url` | Derived from `port` | Computed as `http://localhost:{port}`. |
132
+ | `storage.backend_settings` (aws) | `provider` | `"aws"` | AWS backend selection. |
133
+ | `storage.backend_settings` (aws) | `s3_endpoint_url` | `None` | Optional override for S3 endpoint URL. |
134
+ | `storage.backend_settings` (aws) | `aws_region` | `None` | AWS region (e.g. `us-east-1`). |
135
+ | `storage.backend_settings` (aws) | `s3_domain_name` | `None` | Domain used for S3-style URLs. |
136
+
137
+
138
+ Some fields in the Compox configuration (such as `log_path`, `icon_path`, 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.
139
+
140
+ #### Supported Prefixes
141
+
142
+ | Prefix | Meaning (Resolved To...) |
143
+ |--------------------------|------------------------------------------------------------------------------------------|
144
+ | `LOG_DEFAULT:` | A platform-dependent log directory: |
145
+ | | - Windows: `%TEMP%/<organization>/<product>` |
146
+ | | - Linux/macOS: `/var/log/<organization>/<product>` |
147
+ | `PROGRAMDATA_DEFAULT:` | A system-wide data directory (Windows only): |
148
+ | | - e.g., `%PROGRAMDATA%/<organization>/<product>` |
149
+ | | - On Linux/macOS, defaults to `"."` (current dir) |
150
+
151
+ These are resolved **at runtime** in the `Settings.parse_paths()` validator method.
@@ -0,0 +1,116 @@
1
+ # Compox
2
+ Compox is a simple Python execution engine for Tescan applications. It's purpose is to run data processing algorithms written in Python on the server and report the results to the client application such as Tescan 3D Viewer or Picannto.
3
+ ## Installation
4
+ Compox can be installed through PyPI:
5
+ ```bash
6
+ pip install compox
7
+ ```
8
+
9
+ You can also install the server by cloning this repository and installing it from source.
10
+
11
+ Note that some additional dependencies, such as MinIO executable for your operating system, will be downloaded on the first run of the server.
12
+
13
+ ## Running the server
14
+ Once installed into your Python environment, Compox can be run using the `compox` command. This command is available in the virtual environment
15
+ created during the setup process. Run the following command to list the available commands:
16
+
17
+ ```bash
18
+ compox --help
19
+ ```
20
+
21
+ It's recommended to start with generating an initial configuration file with `compox generate-config`. See the configuration options section below.
22
+ To see the usage of the `generate-config` command, you can run:
23
+
24
+ ```bash
25
+ compox generate-config --help
26
+ ```
27
+
28
+ To run the Compox, use the following command:
29
+
30
+ ```bash
31
+ compox run --config /path/to/config.yaml
32
+ ```
33
+
34
+ ### Deploying algorithms
35
+ See Algorithm development tutorial for information about target structure of the deployable algorithms.
36
+
37
+ Once your algorithm is ready, you can use the `compox deploy-algorithms` command to deploy it to your server.
38
+ To see the usage of the `deploy-algorithms` command, you can run:
39
+
40
+ ```bash
41
+ compox deploy-algorithms --help
42
+ ```
43
+
44
+ This command will read the algorithm definitions from the folder specified in your configuration file with the `deploy_algorithms_from` key
45
+ and deploy them to the server. For example:
46
+
47
+ ```bash
48
+ compox deploy-algorithms --config /path/to/config.yaml
49
+ ```
50
+
51
+ Note that the server does not need to be running in order to deploy the algorithms.
52
+
53
+
54
+ ## Configuration
55
+ The server uses pydantic settings for configuration. The options can be either set as runtime arguments, in a yaml file, or using the `COMPOX__` environment variables, in corresponding order of precedence.
56
+
57
+ - Ensure all paths and URLs are correctly set before running the application.
58
+ - Adjust CUDA settings based on hardware capabilities.
59
+ - Logging paths should be accessible by the application to prevent errors.
60
+ - See the [configuration reference](#configuration-reference) below for detailed configuration options.
61
+
62
+ <details><summary>Configuration reference</summary>
63
+
64
+ <br>
65
+
66
+ ### Compox Configuration Reference
67
+
68
+ | Section | Field | Default | Description |
69
+ |----------------------------------|-----------------------------|------------------------------------|-----------------------------------------------------------------------------|
70
+ | | `port` | `5461` | The main server port used to make requests |
71
+ | | `deploy_algorithms_from` | `"./algorithms"` | Directory for algorithm deployment sources. |
72
+ | | `log_path` | `"LOG_DEFAULT:compox.log"` | Path to the main log file (supports dynamic prefixes). |
73
+ | | `config` | `None` | Optional config path override. |
74
+ | `info` | `product_name` | `"TESCAN 3D Backend"` | Product display name. |
75
+ | `info` | `server_tags` | `[]` → auto appends `"compox"` | Tags attached to the server. `"compox"` is added automatically. |
76
+ | `info` | `group_name` | `"TESCAN GROUP, a.s."` | Name of the corporate group. |
77
+ | `info` | `organization_name` | `"TESCAN 3DIM, s.r.o."` | Full name of the organization. |
78
+ | `info` | `organization_domain` | `"tescan3dim.com"` | Domain used in server configuration. |
79
+ | `gui` | `algorithm_add_remove_in_menus` | `False` | Enables/disables GUI menu for algorithm management. |
80
+ | `gui` | `use_systray` | `False` | Enables/disables systray GUI integration. |
81
+ | `gui` | `icon_path` | Path to the installed package resource | Path to the systray icon (supports dynamic prefixes) |
82
+ | `inference` | `device` | `"cuda"` | Device used for model inference (`"cpu"`, `"cuda"`, `"mps"`). |
83
+ | `inference` | `cuda_visible_devices` | `"0"` | Comma-separated list of visible CUDA GPUs. |
84
+ | `storage` | `collection_prefix` | `""` | Prefix applied to object store collections. (useful for AWS s3 store, where unique bucket names are needed)|
85
+ | `storage` | `data_store_expire_days` | `1` | Number of days until stored datasets expire. |
86
+ | `storage` | `access_key_id` | generated with `UUIDv4` | Generated access key for storage backend. If `null` is provided, random UUIDv4 is generated. |
87
+ | `storage` | `secret_access_key` | generated with `UUIDv4` | Generated secret key for storage backend. If `null` is provided, random UUIDv4 is generated. |S
88
+ | `storage.backend_settings` (minio) | `provider` | `"minio"` | Selected backend provider. |
89
+ | `storage.backend_settings` (minio) | `start_instance` | `True` | Whether to start a local MinIO server. |
90
+ | `storage.backend_settings` (minio) | `port` | `9091` | MinIO service port. |
91
+ | `storage.backend_settings` (minio) | `console_port` | `9090` | MinIO admin console port. |
92
+ | `storage.backend_settings` (minio) | `executable_path` | `"minio/minio_bin"` | Path to the MinIO binary (accepts dynamic prefixes). |
93
+ | `storage.backend_settings` (minio) | `storage_path` | `"minio/compox_store"` | Storage directory used by MinIO (accepts dynamic prefixes). |
94
+ | `storage.backend_settings` (minio) | `aws_region` | `None` | Optional AWS compatibility region. |
95
+ | `storage.backend_settings` (minio) | `s3_domain_name` | `None` | Optional domain override for S3 compatibility. |
96
+ | `storage.backend_settings` (minio) | `s3_endpoint_url` | Derived from `port` | Computed as `http://localhost:{port}`. |
97
+ | `storage.backend_settings` (aws) | `provider` | `"aws"` | AWS backend selection. |
98
+ | `storage.backend_settings` (aws) | `s3_endpoint_url` | `None` | Optional override for S3 endpoint URL. |
99
+ | `storage.backend_settings` (aws) | `aws_region` | `None` | AWS region (e.g. `us-east-1`). |
100
+ | `storage.backend_settings` (aws) | `s3_domain_name` | `None` | Domain used for S3-style URLs. |
101
+
102
+
103
+ Some fields in the Compox configuration (such as `log_path`, `icon_path`, 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.
104
+
105
+ #### Supported Prefixes
106
+
107
+ | Prefix | Meaning (Resolved To...) |
108
+ |--------------------------|------------------------------------------------------------------------------------------|
109
+ | `LOG_DEFAULT:` | A platform-dependent log directory: |
110
+ | | - Windows: `%TEMP%/<organization>/<product>` |
111
+ | | - Linux/macOS: `/var/log/<organization>/<product>` |
112
+ | `PROGRAMDATA_DEFAULT:` | A system-wide data directory (Windows only): |
113
+ | | - e.g., `%PROGRAMDATA%/<organization>/<product>` |
114
+ | | - On Linux/macOS, defaults to `"."` (current dir) |
115
+
116
+ These are resolved **at runtime** in the `Settings.parse_paths()` validator method.
@@ -36,6 +36,7 @@ dependencies = [
36
36
  "typer>=0.16.0",
37
37
  "pip>=25.2",
38
38
  "build>=1.3.0",
39
+ "pdm-backend>=2.4.5",
39
40
  ]
40
41
  requires-python = ">=3.10.0"
41
42
  readme = "README.md"
@@ -45,7 +46,7 @@ license-files = [
45
46
  "NOTICE",
46
47
  "THIRD_PARTY_LICENSES.txt",
47
48
  ]
48
- version = "2.0.0.dev1"
49
+ version = "2.0.0.dev3"
49
50
 
50
51
  [project.scripts]
51
52
  compox = "compox.cli:app"
@@ -53,6 +54,8 @@ compox = "compox.cli:app"
53
54
  [tool.pdm.version]
54
55
  source = "scm"
55
56
  tag_filter = "compox-v*"
57
+ version_format = "src.compox.version:format_version"
58
+ fallback_version = "0.0.0"
56
59
 
57
60
  [tool.uv]
58
61
  package = true
@@ -6,6 +6,7 @@ All rights reserved
6
6
  import os
7
7
  import sys
8
8
  from typing import Literal, Union, Annotated
9
+ from importlib.resources import files
9
10
  import json
10
11
 
11
12
  import yaml
@@ -47,7 +48,7 @@ class GUISettings(BaseModel):
47
48
  model_config = ConfigDict(extra='forbid')
48
49
  algorithm_add_remove_in_menus: bool = False
49
50
  use_systray: bool = False
50
- icon_path: str = "../compox/resources/compoxbackend.ico"
51
+ icon_path: str = os.path.join(files("compox"),"resources", "compoxbackend.ico")
51
52
 
52
53
 
53
54
  class MinioSettings(BaseModel):
@@ -62,7 +63,7 @@ class MinioSettings(BaseModel):
62
63
  start_instance: bool = True
63
64
  port: int = 9091
64
65
  console_port: int = 9090
65
- executable_path: str = os.path.join("minio", "minio_bin")
66
+ executable_path: str = os.path.join("minio", "minio_bin") if os.name != "nt" else os.path.join("minio", "minio.exe")
66
67
  storage_path: str = os.path.join("minio", "compox_store")
67
68
  # derived attributes
68
69
  aws_region: str | None = None
@@ -3,11 +3,13 @@ Copyright 2024 TESCAN 3DIM, s.r.o.
3
3
  All rights reserved
4
4
  """
5
5
 
6
+ import importlib.metadata
6
7
  from fastapi import APIRouter, Request
7
8
  from typing import Union
8
9
 
9
10
  from compox.pydantic_models import RootMessage, ResponseMessage
10
11
  from compox.server_utils import check_system_gpu_availability
12
+ import compox
11
13
 
12
14
  router = APIRouter(prefix="", tags=["root"])
13
15
 
@@ -44,8 +46,8 @@ def read_root(request: Request) -> Union[RootMessage, ResponseMessage]:
44
46
  group = settings.info.group_name
45
47
  organization = settings.info.organization_name
46
48
  domain = settings.info.organization_domain
47
- version = settings.info.version
48
-
49
+
50
+ version = importlib.metadata.version('compox')
49
51
  cuda_available, cuda_capable_device_count = (
50
52
  check_system_gpu_availability()
51
53
  )
@@ -0,0 +1,7 @@
1
+ from pdm.backend.hooks.version import SCMVersion
2
+
3
+ def format_version(version: SCMVersion) -> str:
4
+ if version.distance is None:
5
+ return str(version.version)
6
+ else:
7
+ return f"{version.version}+{version.node[1:9]}"
@@ -1,277 +0,0 @@
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
- ```