julee 0.1.0__py3-none-any.whl
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.
- julee/__init__.py +3 -0
- julee/api/__init__.py +20 -0
- julee/api/app.py +180 -0
- julee/api/dependencies.py +257 -0
- julee/api/requests.py +175 -0
- julee/api/responses.py +43 -0
- julee/api/routers/__init__.py +43 -0
- julee/api/routers/assembly_specifications.py +212 -0
- julee/api/routers/documents.py +182 -0
- julee/api/routers/knowledge_service_configs.py +79 -0
- julee/api/routers/knowledge_service_queries.py +293 -0
- julee/api/routers/system.py +137 -0
- julee/api/routers/workflows.py +234 -0
- julee/api/services/__init__.py +20 -0
- julee/api/services/system_initialization.py +214 -0
- julee/api/tests/__init__.py +14 -0
- julee/api/tests/routers/__init__.py +17 -0
- julee/api/tests/routers/test_assembly_specifications.py +749 -0
- julee/api/tests/routers/test_documents.py +301 -0
- julee/api/tests/routers/test_knowledge_service_configs.py +234 -0
- julee/api/tests/routers/test_knowledge_service_queries.py +738 -0
- julee/api/tests/routers/test_system.py +179 -0
- julee/api/tests/routers/test_workflows.py +393 -0
- julee/api/tests/test_app.py +285 -0
- julee/api/tests/test_dependencies.py +245 -0
- julee/api/tests/test_requests.py +250 -0
- julee/domain/__init__.py +22 -0
- julee/domain/models/__init__.py +49 -0
- julee/domain/models/assembly/__init__.py +17 -0
- julee/domain/models/assembly/assembly.py +103 -0
- julee/domain/models/assembly/tests/__init__.py +0 -0
- julee/domain/models/assembly/tests/factories.py +37 -0
- julee/domain/models/assembly/tests/test_assembly.py +430 -0
- julee/domain/models/assembly_specification/__init__.py +24 -0
- julee/domain/models/assembly_specification/assembly_specification.py +172 -0
- julee/domain/models/assembly_specification/knowledge_service_query.py +123 -0
- julee/domain/models/assembly_specification/tests/__init__.py +0 -0
- julee/domain/models/assembly_specification/tests/factories.py +78 -0
- julee/domain/models/assembly_specification/tests/test_assembly_specification.py +490 -0
- julee/domain/models/assembly_specification/tests/test_knowledge_service_query.py +310 -0
- julee/domain/models/custom_fields/__init__.py +0 -0
- julee/domain/models/custom_fields/content_stream.py +68 -0
- julee/domain/models/custom_fields/tests/__init__.py +0 -0
- julee/domain/models/custom_fields/tests/test_custom_fields.py +53 -0
- julee/domain/models/document/__init__.py +17 -0
- julee/domain/models/document/document.py +150 -0
- julee/domain/models/document/tests/__init__.py +0 -0
- julee/domain/models/document/tests/factories.py +76 -0
- julee/domain/models/document/tests/test_document.py +297 -0
- julee/domain/models/knowledge_service_config/__init__.py +17 -0
- julee/domain/models/knowledge_service_config/knowledge_service_config.py +86 -0
- julee/domain/models/policy/__init__.py +15 -0
- julee/domain/models/policy/document_policy_validation.py +220 -0
- julee/domain/models/policy/policy.py +203 -0
- julee/domain/models/policy/tests/__init__.py +0 -0
- julee/domain/models/policy/tests/factories.py +47 -0
- julee/domain/models/policy/tests/test_document_policy_validation.py +420 -0
- julee/domain/models/policy/tests/test_policy.py +546 -0
- julee/domain/repositories/__init__.py +27 -0
- julee/domain/repositories/assembly.py +45 -0
- julee/domain/repositories/assembly_specification.py +52 -0
- julee/domain/repositories/base.py +146 -0
- julee/domain/repositories/document.py +49 -0
- julee/domain/repositories/document_policy_validation.py +52 -0
- julee/domain/repositories/knowledge_service_config.py +54 -0
- julee/domain/repositories/knowledge_service_query.py +44 -0
- julee/domain/repositories/policy.py +49 -0
- julee/domain/use_cases/__init__.py +17 -0
- julee/domain/use_cases/decorators.py +107 -0
- julee/domain/use_cases/extract_assemble_data.py +649 -0
- julee/domain/use_cases/initialize_system_data.py +842 -0
- julee/domain/use_cases/tests/__init__.py +7 -0
- julee/domain/use_cases/tests/test_extract_assemble_data.py +548 -0
- julee/domain/use_cases/tests/test_initialize_system_data.py +455 -0
- julee/domain/use_cases/tests/test_validate_document.py +1228 -0
- julee/domain/use_cases/validate_document.py +736 -0
- julee/fixtures/assembly_specifications.yaml +70 -0
- julee/fixtures/documents.yaml +178 -0
- julee/fixtures/knowledge_service_configs.yaml +37 -0
- julee/fixtures/knowledge_service_queries.yaml +27 -0
- julee/repositories/__init__.py +17 -0
- julee/repositories/memory/__init__.py +31 -0
- julee/repositories/memory/assembly.py +84 -0
- julee/repositories/memory/assembly_specification.py +125 -0
- julee/repositories/memory/base.py +227 -0
- julee/repositories/memory/document.py +149 -0
- julee/repositories/memory/document_policy_validation.py +104 -0
- julee/repositories/memory/knowledge_service_config.py +123 -0
- julee/repositories/memory/knowledge_service_query.py +120 -0
- julee/repositories/memory/policy.py +87 -0
- julee/repositories/memory/tests/__init__.py +0 -0
- julee/repositories/memory/tests/test_document.py +212 -0
- julee/repositories/memory/tests/test_document_policy_validation.py +161 -0
- julee/repositories/memory/tests/test_policy.py +443 -0
- julee/repositories/minio/__init__.py +31 -0
- julee/repositories/minio/assembly.py +103 -0
- julee/repositories/minio/assembly_specification.py +170 -0
- julee/repositories/minio/client.py +570 -0
- julee/repositories/minio/document.py +530 -0
- julee/repositories/minio/document_policy_validation.py +120 -0
- julee/repositories/minio/knowledge_service_config.py +187 -0
- julee/repositories/minio/knowledge_service_query.py +211 -0
- julee/repositories/minio/policy.py +106 -0
- julee/repositories/minio/tests/__init__.py +0 -0
- julee/repositories/minio/tests/fake_client.py +213 -0
- julee/repositories/minio/tests/test_assembly.py +374 -0
- julee/repositories/minio/tests/test_assembly_specification.py +391 -0
- julee/repositories/minio/tests/test_client_protocol.py +57 -0
- julee/repositories/minio/tests/test_document.py +591 -0
- julee/repositories/minio/tests/test_document_policy_validation.py +192 -0
- julee/repositories/minio/tests/test_knowledge_service_config.py +374 -0
- julee/repositories/minio/tests/test_knowledge_service_query.py +438 -0
- julee/repositories/minio/tests/test_policy.py +559 -0
- julee/repositories/temporal/__init__.py +38 -0
- julee/repositories/temporal/activities.py +114 -0
- julee/repositories/temporal/activity_names.py +34 -0
- julee/repositories/temporal/proxies.py +159 -0
- julee/services/__init__.py +18 -0
- julee/services/knowledge_service/__init__.py +48 -0
- julee/services/knowledge_service/anthropic/__init__.py +12 -0
- julee/services/knowledge_service/anthropic/knowledge_service.py +331 -0
- julee/services/knowledge_service/anthropic/tests/test_knowledge_service.py +318 -0
- julee/services/knowledge_service/factory.py +138 -0
- julee/services/knowledge_service/knowledge_service.py +160 -0
- julee/services/knowledge_service/memory/__init__.py +13 -0
- julee/services/knowledge_service/memory/knowledge_service.py +278 -0
- julee/services/knowledge_service/memory/test_knowledge_service.py +345 -0
- julee/services/knowledge_service/test_factory.py +112 -0
- julee/services/temporal/__init__.py +38 -0
- julee/services/temporal/activities.py +86 -0
- julee/services/temporal/activity_names.py +22 -0
- julee/services/temporal/proxies.py +41 -0
- julee/util/__init__.py +0 -0
- julee/util/domain.py +119 -0
- julee/util/repos/__init__.py +0 -0
- julee/util/repos/minio/__init__.py +0 -0
- julee/util/repos/minio/file_storage.py +213 -0
- julee/util/repos/temporal/__init__.py +11 -0
- julee/util/repos/temporal/client_proxies/file_storage.py +68 -0
- julee/util/repos/temporal/data_converter.py +123 -0
- julee/util/repos/temporal/minio_file_storage.py +12 -0
- julee/util/repos/temporal/proxies/__init__.py +0 -0
- julee/util/repos/temporal/proxies/file_storage.py +58 -0
- julee/util/repositories.py +55 -0
- julee/util/temporal/__init__.py +22 -0
- julee/util/temporal/activities.py +123 -0
- julee/util/temporal/decorators.py +473 -0
- julee/util/tests/__init__.py +1 -0
- julee/util/tests/test_decorators.py +770 -0
- julee/util/validation/__init__.py +29 -0
- julee/util/validation/repository.py +100 -0
- julee/util/validation/type_guards.py +369 -0
- julee/worker.py +211 -0
- julee/workflows/__init__.py +26 -0
- julee/workflows/extract_assemble.py +215 -0
- julee/workflows/validate_document.py +228 -0
- julee-0.1.0.dist-info/METADATA +195 -0
- julee-0.1.0.dist-info/RECORD +161 -0
- julee-0.1.0.dist-info/WHEEL +5 -0
- julee-0.1.0.dist-info/licenses/LICENSE +674 -0
- julee-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"""
|
|
2
|
+
System Initialization Service for the julee CEAP system.
|
|
3
|
+
|
|
4
|
+
This module provides the service layer for system initialization,
|
|
5
|
+
orchestrating the use cases needed to ensure required system data
|
|
6
|
+
exists on application startup.
|
|
7
|
+
|
|
8
|
+
The service acts as a facade between the API layer and domain use cases,
|
|
9
|
+
handling application-level concerns while delegating business logic
|
|
10
|
+
to the appropriate use cases.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import logging
|
|
14
|
+
from typing import Dict, Any
|
|
15
|
+
|
|
16
|
+
from julee.domain.use_cases.initialize_system_data import (
|
|
17
|
+
InitializeSystemDataUseCase,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
logger = logging.getLogger(__name__)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class SystemInitializationService:
|
|
24
|
+
"""
|
|
25
|
+
Service for orchestrating system initialization on application startup.
|
|
26
|
+
|
|
27
|
+
This service coordinates the execution of use cases needed to initialize
|
|
28
|
+
required system data, such as knowledge service configurations and
|
|
29
|
+
other essential data needed for the application to function properly.
|
|
30
|
+
|
|
31
|
+
The service provides error handling, logging, and coordination between
|
|
32
|
+
multiple initialization tasks while keeping the business logic in
|
|
33
|
+
the domain use cases.
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
def __init__(
|
|
37
|
+
self,
|
|
38
|
+
initialize_system_data_use_case: InitializeSystemDataUseCase,
|
|
39
|
+
) -> None:
|
|
40
|
+
"""Initialize the service with required use cases.
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
initialize_system_data_use_case: Use case for initializing
|
|
44
|
+
system data
|
|
45
|
+
"""
|
|
46
|
+
self.initialize_system_data_use_case = initialize_system_data_use_case
|
|
47
|
+
self.logger = logging.getLogger("SystemInitializationService")
|
|
48
|
+
|
|
49
|
+
async def initialize(self) -> Dict[str, Any]:
|
|
50
|
+
"""
|
|
51
|
+
Initialize all required system data and configuration.
|
|
52
|
+
|
|
53
|
+
This method orchestrates all initialization tasks needed for the
|
|
54
|
+
application to start successfully. It coordinates multiple use cases
|
|
55
|
+
and provides comprehensive error handling and logging.
|
|
56
|
+
|
|
57
|
+
Returns:
|
|
58
|
+
Dict containing initialization results and metadata
|
|
59
|
+
|
|
60
|
+
Raises:
|
|
61
|
+
Exception: If any critical initialization step fails
|
|
62
|
+
"""
|
|
63
|
+
self.logger.info("Starting system initialization")
|
|
64
|
+
|
|
65
|
+
initialization_results: Dict[str, Any] = {
|
|
66
|
+
"status": "in_progress",
|
|
67
|
+
"tasks_completed": [],
|
|
68
|
+
"tasks_failed": [],
|
|
69
|
+
"metadata": {},
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
try:
|
|
73
|
+
# Execute system data initialization
|
|
74
|
+
await self._execute_system_data_initialization(initialization_results)
|
|
75
|
+
|
|
76
|
+
# Future initialization tasks can be added here
|
|
77
|
+
# await self._execute_additional_initialization_tasks(
|
|
78
|
+
# initialization_results
|
|
79
|
+
# )
|
|
80
|
+
|
|
81
|
+
# Mark initialization as successful
|
|
82
|
+
initialization_results["status"] = "completed"
|
|
83
|
+
|
|
84
|
+
self.logger.info(
|
|
85
|
+
"System initialization completed successfully",
|
|
86
|
+
extra={
|
|
87
|
+
"tasks_completed": initialization_results["tasks_completed"],
|
|
88
|
+
"total_tasks": len(initialization_results["tasks_completed"]),
|
|
89
|
+
},
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
return initialization_results
|
|
93
|
+
|
|
94
|
+
except Exception as e:
|
|
95
|
+
initialization_results["status"] = "failed"
|
|
96
|
+
initialization_results["error"] = {
|
|
97
|
+
"type": type(e).__name__,
|
|
98
|
+
"message": str(e),
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
self.logger.error(
|
|
102
|
+
"System initialization failed",
|
|
103
|
+
exc_info=True,
|
|
104
|
+
extra={
|
|
105
|
+
"tasks_completed": initialization_results["tasks_completed"],
|
|
106
|
+
"tasks_failed": initialization_results["tasks_failed"],
|
|
107
|
+
"error_type": type(e).__name__,
|
|
108
|
+
"error_message": str(e),
|
|
109
|
+
},
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
raise
|
|
113
|
+
|
|
114
|
+
async def _execute_system_data_initialization(
|
|
115
|
+
self, results: Dict[str, Any]
|
|
116
|
+
) -> None:
|
|
117
|
+
"""
|
|
118
|
+
Execute system data initialization use case.
|
|
119
|
+
|
|
120
|
+
Args:
|
|
121
|
+
results: Dictionary to track initialization results
|
|
122
|
+
|
|
123
|
+
Raises:
|
|
124
|
+
Exception: If system data initialization fails
|
|
125
|
+
"""
|
|
126
|
+
task_name = "system_data_initialization"
|
|
127
|
+
|
|
128
|
+
try:
|
|
129
|
+
self.logger.debug("Starting task: %s", task_name)
|
|
130
|
+
|
|
131
|
+
await self.initialize_system_data_use_case.execute()
|
|
132
|
+
|
|
133
|
+
results["tasks_completed"].append(task_name)
|
|
134
|
+
results["metadata"][task_name] = {
|
|
135
|
+
"status": "completed",
|
|
136
|
+
"description": "System data initialization completed",
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
self.logger.debug("Completed task: %s", task_name)
|
|
140
|
+
|
|
141
|
+
except Exception as e:
|
|
142
|
+
results["tasks_failed"].append(
|
|
143
|
+
{
|
|
144
|
+
"task": task_name,
|
|
145
|
+
"error": str(e),
|
|
146
|
+
"error_type": type(e).__name__,
|
|
147
|
+
}
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
self.logger.error(
|
|
151
|
+
f"Failed task: {task_name}",
|
|
152
|
+
exc_info=True,
|
|
153
|
+
extra={
|
|
154
|
+
"task_name": task_name,
|
|
155
|
+
"error_type": type(e).__name__,
|
|
156
|
+
"error_message": str(e),
|
|
157
|
+
},
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
raise
|
|
161
|
+
|
|
162
|
+
async def get_initialization_status(self) -> Dict[str, Any]:
|
|
163
|
+
"""
|
|
164
|
+
Get the current initialization status.
|
|
165
|
+
|
|
166
|
+
This method can be used to check if the system has been properly
|
|
167
|
+
initialized, useful for health checks or debugging.
|
|
168
|
+
|
|
169
|
+
Returns:
|
|
170
|
+
Dict containing current initialization status and metadata
|
|
171
|
+
"""
|
|
172
|
+
# This is a simple implementation - in a more complex system,
|
|
173
|
+
# you might want to persist initialization status
|
|
174
|
+
return {
|
|
175
|
+
"system_initialized": True,
|
|
176
|
+
"last_initialization": None, # Could track timestamps
|
|
177
|
+
"required_components": [
|
|
178
|
+
"knowledge_service_configs",
|
|
179
|
+
],
|
|
180
|
+
"status": "ready",
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
async def reinitialize(self) -> Dict[str, Any]:
|
|
184
|
+
"""
|
|
185
|
+
Reinitialize system data.
|
|
186
|
+
|
|
187
|
+
This method can be used to force reinitalization of system data,
|
|
188
|
+
useful for development, testing, or recovery scenarios.
|
|
189
|
+
|
|
190
|
+
Returns:
|
|
191
|
+
Dict containing reinitialization results
|
|
192
|
+
|
|
193
|
+
Raises:
|
|
194
|
+
Exception: If reinitialization fails
|
|
195
|
+
"""
|
|
196
|
+
self.logger.info("Starting system reinitialization")
|
|
197
|
+
|
|
198
|
+
try:
|
|
199
|
+
results = await self.initialize()
|
|
200
|
+
results["reinitialization"] = True
|
|
201
|
+
|
|
202
|
+
self.logger.info("System reinitialization completed successfully")
|
|
203
|
+
return results
|
|
204
|
+
|
|
205
|
+
except Exception as e:
|
|
206
|
+
self.logger.error(
|
|
207
|
+
"System reinitialization failed",
|
|
208
|
+
exc_info=True,
|
|
209
|
+
extra={
|
|
210
|
+
"error_type": type(e).__name__,
|
|
211
|
+
"error_message": str(e),
|
|
212
|
+
},
|
|
213
|
+
)
|
|
214
|
+
raise
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Tests for the julee API layer.
|
|
3
|
+
|
|
4
|
+
This package contains tests for the FastAPI interface adapters including:
|
|
5
|
+
- Request model validation tests
|
|
6
|
+
- Response model serialization tests
|
|
7
|
+
- API endpoint integration tests
|
|
8
|
+
- Dependency injection tests
|
|
9
|
+
|
|
10
|
+
Following the testing patterns from the sample project with unit tests
|
|
11
|
+
for individual components and integration tests for full API flows.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
__all__: list[str] = []
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Tests for API routers in the julee CEAP system.
|
|
3
|
+
|
|
4
|
+
This package contains test modules organized by router, following the same
|
|
5
|
+
structure as the main routers package. Each test module focuses on testing
|
|
6
|
+
the endpoints and behavior of a specific router.
|
|
7
|
+
|
|
8
|
+
Organization:
|
|
9
|
+
- test_knowledge_service_queries: Tests for knowledge service query endpoints
|
|
10
|
+
- test_system: Tests for system endpoints (health, status)
|
|
11
|
+
|
|
12
|
+
Test modules follow consistent patterns:
|
|
13
|
+
1. Use TestClient with dependency overrides
|
|
14
|
+
2. Test both success and error cases
|
|
15
|
+
3. Verify proper HTTP status codes and response formats
|
|
16
|
+
4. Include integration tests where appropriate
|
|
17
|
+
"""
|