mcli-framework 7.0.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.

Potentially problematic release.


This version of mcli-framework might be problematic. Click here for more details.

Files changed (186) hide show
  1. mcli/app/chat_cmd.py +42 -0
  2. mcli/app/commands_cmd.py +226 -0
  3. mcli/app/completion_cmd.py +216 -0
  4. mcli/app/completion_helpers.py +288 -0
  5. mcli/app/cron_test_cmd.py +697 -0
  6. mcli/app/logs_cmd.py +419 -0
  7. mcli/app/main.py +492 -0
  8. mcli/app/model/model.py +1060 -0
  9. mcli/app/model_cmd.py +227 -0
  10. mcli/app/redis_cmd.py +269 -0
  11. mcli/app/video/video.py +1114 -0
  12. mcli/app/visual_cmd.py +303 -0
  13. mcli/chat/chat.py +2409 -0
  14. mcli/chat/command_rag.py +514 -0
  15. mcli/chat/enhanced_chat.py +652 -0
  16. mcli/chat/system_controller.py +1010 -0
  17. mcli/chat/system_integration.py +1016 -0
  18. mcli/cli.py +25 -0
  19. mcli/config.toml +20 -0
  20. mcli/lib/api/api.py +586 -0
  21. mcli/lib/api/daemon_client.py +203 -0
  22. mcli/lib/api/daemon_client_local.py +44 -0
  23. mcli/lib/api/daemon_decorator.py +217 -0
  24. mcli/lib/api/mcli_decorators.py +1032 -0
  25. mcli/lib/auth/auth.py +85 -0
  26. mcli/lib/auth/aws_manager.py +85 -0
  27. mcli/lib/auth/azure_manager.py +91 -0
  28. mcli/lib/auth/credential_manager.py +192 -0
  29. mcli/lib/auth/gcp_manager.py +93 -0
  30. mcli/lib/auth/key_manager.py +117 -0
  31. mcli/lib/auth/mcli_manager.py +93 -0
  32. mcli/lib/auth/token_manager.py +75 -0
  33. mcli/lib/auth/token_util.py +1011 -0
  34. mcli/lib/config/config.py +47 -0
  35. mcli/lib/discovery/__init__.py +1 -0
  36. mcli/lib/discovery/command_discovery.py +274 -0
  37. mcli/lib/erd/erd.py +1345 -0
  38. mcli/lib/erd/generate_graph.py +453 -0
  39. mcli/lib/files/files.py +76 -0
  40. mcli/lib/fs/fs.py +109 -0
  41. mcli/lib/lib.py +29 -0
  42. mcli/lib/logger/logger.py +611 -0
  43. mcli/lib/performance/optimizer.py +409 -0
  44. mcli/lib/performance/rust_bridge.py +502 -0
  45. mcli/lib/performance/uvloop_config.py +154 -0
  46. mcli/lib/pickles/pickles.py +50 -0
  47. mcli/lib/search/cached_vectorizer.py +479 -0
  48. mcli/lib/services/data_pipeline.py +460 -0
  49. mcli/lib/services/lsh_client.py +441 -0
  50. mcli/lib/services/redis_service.py +387 -0
  51. mcli/lib/shell/shell.py +137 -0
  52. mcli/lib/toml/toml.py +33 -0
  53. mcli/lib/ui/styling.py +47 -0
  54. mcli/lib/ui/visual_effects.py +634 -0
  55. mcli/lib/watcher/watcher.py +185 -0
  56. mcli/ml/api/app.py +215 -0
  57. mcli/ml/api/middleware.py +224 -0
  58. mcli/ml/api/routers/admin_router.py +12 -0
  59. mcli/ml/api/routers/auth_router.py +244 -0
  60. mcli/ml/api/routers/backtest_router.py +12 -0
  61. mcli/ml/api/routers/data_router.py +12 -0
  62. mcli/ml/api/routers/model_router.py +302 -0
  63. mcli/ml/api/routers/monitoring_router.py +12 -0
  64. mcli/ml/api/routers/portfolio_router.py +12 -0
  65. mcli/ml/api/routers/prediction_router.py +267 -0
  66. mcli/ml/api/routers/trade_router.py +12 -0
  67. mcli/ml/api/routers/websocket_router.py +76 -0
  68. mcli/ml/api/schemas.py +64 -0
  69. mcli/ml/auth/auth_manager.py +425 -0
  70. mcli/ml/auth/models.py +154 -0
  71. mcli/ml/auth/permissions.py +302 -0
  72. mcli/ml/backtesting/backtest_engine.py +502 -0
  73. mcli/ml/backtesting/performance_metrics.py +393 -0
  74. mcli/ml/cache.py +400 -0
  75. mcli/ml/cli/main.py +398 -0
  76. mcli/ml/config/settings.py +394 -0
  77. mcli/ml/configs/dvc_config.py +230 -0
  78. mcli/ml/configs/mlflow_config.py +131 -0
  79. mcli/ml/configs/mlops_manager.py +293 -0
  80. mcli/ml/dashboard/app.py +532 -0
  81. mcli/ml/dashboard/app_integrated.py +738 -0
  82. mcli/ml/dashboard/app_supabase.py +560 -0
  83. mcli/ml/dashboard/app_training.py +615 -0
  84. mcli/ml/dashboard/cli.py +51 -0
  85. mcli/ml/data_ingestion/api_connectors.py +501 -0
  86. mcli/ml/data_ingestion/data_pipeline.py +567 -0
  87. mcli/ml/data_ingestion/stream_processor.py +512 -0
  88. mcli/ml/database/migrations/env.py +94 -0
  89. mcli/ml/database/models.py +667 -0
  90. mcli/ml/database/session.py +200 -0
  91. mcli/ml/experimentation/ab_testing.py +845 -0
  92. mcli/ml/features/ensemble_features.py +607 -0
  93. mcli/ml/features/political_features.py +676 -0
  94. mcli/ml/features/recommendation_engine.py +809 -0
  95. mcli/ml/features/stock_features.py +573 -0
  96. mcli/ml/features/test_feature_engineering.py +346 -0
  97. mcli/ml/logging.py +85 -0
  98. mcli/ml/mlops/data_versioning.py +518 -0
  99. mcli/ml/mlops/experiment_tracker.py +377 -0
  100. mcli/ml/mlops/model_serving.py +481 -0
  101. mcli/ml/mlops/pipeline_orchestrator.py +614 -0
  102. mcli/ml/models/base_models.py +324 -0
  103. mcli/ml/models/ensemble_models.py +675 -0
  104. mcli/ml/models/recommendation_models.py +474 -0
  105. mcli/ml/models/test_models.py +487 -0
  106. mcli/ml/monitoring/drift_detection.py +676 -0
  107. mcli/ml/monitoring/metrics.py +45 -0
  108. mcli/ml/optimization/portfolio_optimizer.py +834 -0
  109. mcli/ml/preprocessing/data_cleaners.py +451 -0
  110. mcli/ml/preprocessing/feature_extractors.py +491 -0
  111. mcli/ml/preprocessing/ml_pipeline.py +382 -0
  112. mcli/ml/preprocessing/politician_trading_preprocessor.py +569 -0
  113. mcli/ml/preprocessing/test_preprocessing.py +294 -0
  114. mcli/ml/scripts/populate_sample_data.py +200 -0
  115. mcli/ml/tasks.py +400 -0
  116. mcli/ml/tests/test_integration.py +429 -0
  117. mcli/ml/tests/test_training_dashboard.py +387 -0
  118. mcli/public/oi/oi.py +15 -0
  119. mcli/public/public.py +4 -0
  120. mcli/self/self_cmd.py +1246 -0
  121. mcli/workflow/daemon/api_daemon.py +800 -0
  122. mcli/workflow/daemon/async_command_database.py +681 -0
  123. mcli/workflow/daemon/async_process_manager.py +591 -0
  124. mcli/workflow/daemon/client.py +530 -0
  125. mcli/workflow/daemon/commands.py +1196 -0
  126. mcli/workflow/daemon/daemon.py +905 -0
  127. mcli/workflow/daemon/daemon_api.py +59 -0
  128. mcli/workflow/daemon/enhanced_daemon.py +571 -0
  129. mcli/workflow/daemon/process_cli.py +244 -0
  130. mcli/workflow/daemon/process_manager.py +439 -0
  131. mcli/workflow/daemon/test_daemon.py +275 -0
  132. mcli/workflow/dashboard/dashboard_cmd.py +113 -0
  133. mcli/workflow/docker/docker.py +0 -0
  134. mcli/workflow/file/file.py +100 -0
  135. mcli/workflow/gcloud/config.toml +21 -0
  136. mcli/workflow/gcloud/gcloud.py +58 -0
  137. mcli/workflow/git_commit/ai_service.py +328 -0
  138. mcli/workflow/git_commit/commands.py +430 -0
  139. mcli/workflow/lsh_integration.py +355 -0
  140. mcli/workflow/model_service/client.py +594 -0
  141. mcli/workflow/model_service/download_and_run_efficient_models.py +288 -0
  142. mcli/workflow/model_service/lightweight_embedder.py +397 -0
  143. mcli/workflow/model_service/lightweight_model_server.py +714 -0
  144. mcli/workflow/model_service/lightweight_test.py +241 -0
  145. mcli/workflow/model_service/model_service.py +1955 -0
  146. mcli/workflow/model_service/ollama_efficient_runner.py +425 -0
  147. mcli/workflow/model_service/pdf_processor.py +386 -0
  148. mcli/workflow/model_service/test_efficient_runner.py +234 -0
  149. mcli/workflow/model_service/test_example.py +315 -0
  150. mcli/workflow/model_service/test_integration.py +131 -0
  151. mcli/workflow/model_service/test_new_features.py +149 -0
  152. mcli/workflow/openai/openai.py +99 -0
  153. mcli/workflow/politician_trading/commands.py +1790 -0
  154. mcli/workflow/politician_trading/config.py +134 -0
  155. mcli/workflow/politician_trading/connectivity.py +490 -0
  156. mcli/workflow/politician_trading/data_sources.py +395 -0
  157. mcli/workflow/politician_trading/database.py +410 -0
  158. mcli/workflow/politician_trading/demo.py +248 -0
  159. mcli/workflow/politician_trading/models.py +165 -0
  160. mcli/workflow/politician_trading/monitoring.py +413 -0
  161. mcli/workflow/politician_trading/scrapers.py +966 -0
  162. mcli/workflow/politician_trading/scrapers_california.py +412 -0
  163. mcli/workflow/politician_trading/scrapers_eu.py +377 -0
  164. mcli/workflow/politician_trading/scrapers_uk.py +350 -0
  165. mcli/workflow/politician_trading/scrapers_us_states.py +438 -0
  166. mcli/workflow/politician_trading/supabase_functions.py +354 -0
  167. mcli/workflow/politician_trading/workflow.py +852 -0
  168. mcli/workflow/registry/registry.py +180 -0
  169. mcli/workflow/repo/repo.py +223 -0
  170. mcli/workflow/scheduler/commands.py +493 -0
  171. mcli/workflow/scheduler/cron_parser.py +238 -0
  172. mcli/workflow/scheduler/job.py +182 -0
  173. mcli/workflow/scheduler/monitor.py +139 -0
  174. mcli/workflow/scheduler/persistence.py +324 -0
  175. mcli/workflow/scheduler/scheduler.py +679 -0
  176. mcli/workflow/sync/sync_cmd.py +437 -0
  177. mcli/workflow/sync/test_cmd.py +314 -0
  178. mcli/workflow/videos/videos.py +242 -0
  179. mcli/workflow/wakatime/wakatime.py +11 -0
  180. mcli/workflow/workflow.py +37 -0
  181. mcli_framework-7.0.0.dist-info/METADATA +479 -0
  182. mcli_framework-7.0.0.dist-info/RECORD +186 -0
  183. mcli_framework-7.0.0.dist-info/WHEEL +5 -0
  184. mcli_framework-7.0.0.dist-info/entry_points.txt +7 -0
  185. mcli_framework-7.0.0.dist-info/licenses/LICENSE +21 -0
  186. mcli_framework-7.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,241 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Test script for the lightweight model server.
4
+ """
5
+
6
+ import os
7
+ import sys
8
+ import time
9
+ from pathlib import Path
10
+
11
+ import requests
12
+
13
+ # Add the parent directory to the path so we can import the modules
14
+ sys.path.insert(0, str(Path(__file__).parent.parent.parent.parent))
15
+
16
+
17
+ def test_lightweight_models():
18
+ """Test the lightweight models configuration"""
19
+ print("๐Ÿงช Testing lightweight models configuration...")
20
+
21
+ try:
22
+ from mcli.workflow.model_service.lightweight_model_server import LIGHTWEIGHT_MODELS
23
+
24
+ print(f"โœ… Found {len(LIGHTWEIGHT_MODELS)} lightweight models:")
25
+
26
+ total_size = 0
27
+ for key, info in LIGHTWEIGHT_MODELS.items():
28
+ print(f" - {key}: {info['name']} ({info['parameters']}) - {info['size_mb']} MB")
29
+ total_size += info["size_mb"]
30
+
31
+ print(f"\n๐Ÿ“Š Total size if all downloaded: {total_size:.1f} MB")
32
+ print(
33
+ f"๐ŸŽฏ Smallest model: {min(LIGHTWEIGHT_MODELS.items(), key=lambda x: x[1]['size_mb'])[1]['name']}"
34
+ )
35
+ print(
36
+ f"โšก Most efficient: {max(LIGHTWEIGHT_MODELS.items(), key=lambda x: x[1]['efficiency_score'])[1]['name']}"
37
+ )
38
+
39
+ return True
40
+
41
+ except Exception as e:
42
+ print(f"โŒ Lightweight models test failed: {e}")
43
+ return False
44
+
45
+
46
+ def test_downloader():
47
+ """Test the downloader functionality"""
48
+ print("\n๐Ÿงช Testing downloader functionality...")
49
+
50
+ try:
51
+ from mcli.workflow.model_service.lightweight_model_server import LightweightModelDownloader
52
+
53
+ # Create downloader
54
+ downloader = LightweightModelDownloader("./test_models")
55
+ print("โœ… Downloader created")
56
+
57
+ # Test session
58
+ if downloader.session:
59
+ print("โœ… HTTP session configured")
60
+ else:
61
+ print("โŒ HTTP session not configured")
62
+ return False
63
+
64
+ # Test models directory
65
+ if downloader.models_dir.exists():
66
+ print("โœ… Models directory exists")
67
+ else:
68
+ print("โŒ Models directory not created")
69
+ return False
70
+
71
+ return True
72
+
73
+ except Exception as e:
74
+ print(f"โŒ Downloader test failed: {e}")
75
+ return False
76
+
77
+
78
+ def test_server():
79
+ """Test the server functionality"""
80
+ print("\n๐Ÿงช Testing server functionality...")
81
+
82
+ try:
83
+ from mcli.workflow.model_service.lightweight_model_server import LightweightModelServer
84
+
85
+ # Create server
86
+ server = LightweightModelServer(port=8081) # Use different port for testing
87
+ print("โœ… Server created")
88
+
89
+ # Test system info
90
+ system_info = server.get_system_info()
91
+ print(f"โœ… System info collected:")
92
+ print(f" - CPU cores: {system_info['cpu_count']}")
93
+ print(f" - Memory: {system_info['memory_gb']:.1f} GB")
94
+ print(f" - Free disk: {system_info['disk_free_gb']:.1f} GB")
95
+
96
+ # Test model recommendation
97
+ recommended = server.recommend_model()
98
+ print(f"โœ… Recommended model: {recommended}")
99
+
100
+ return True
101
+
102
+ except Exception as e:
103
+ print(f"โŒ Server test failed: {e}")
104
+ return False
105
+
106
+
107
+ def test_http_server():
108
+ """Test the HTTP server functionality"""
109
+ print("\n๐Ÿงช Testing HTTP server...")
110
+
111
+ try:
112
+ import threading
113
+ import time
114
+
115
+ from mcli.workflow.model_service.lightweight_model_server import LightweightModelServer
116
+
117
+ # Create server
118
+ server = LightweightModelServer(port=8082)
119
+
120
+ # Start server in background
121
+ server.start_server()
122
+ time.sleep(2) # Wait for server to start
123
+
124
+ # Test server endpoints
125
+ try:
126
+ # Health check
127
+ response = requests.get("http://localhost:8082/health", timeout=5)
128
+ if response.status_code == 200:
129
+ print("โœ… Health endpoint working")
130
+ else:
131
+ print("โŒ Health endpoint failed")
132
+ return False
133
+
134
+ # Models endpoint
135
+ response = requests.get("http://localhost:8082/models", timeout=5)
136
+ if response.status_code == 200:
137
+ print("โœ… Models endpoint working")
138
+ else:
139
+ print("โŒ Models endpoint failed")
140
+ return False
141
+
142
+ # Root endpoint
143
+ response = requests.get("http://localhost:8082/", timeout=5)
144
+ if response.status_code == 200:
145
+ print("โœ… Root endpoint working")
146
+ else:
147
+ print("โŒ Root endpoint failed")
148
+ return False
149
+
150
+ return True
151
+
152
+ except requests.exceptions.ConnectionError:
153
+ print("โŒ Could not connect to test server")
154
+ return False
155
+ except Exception as e:
156
+ print(f"โŒ HTTP server test failed: {e}")
157
+ return False
158
+
159
+ except Exception as e:
160
+ print(f"โŒ HTTP server test failed: {e}")
161
+ return False
162
+
163
+
164
+ def test_model_download():
165
+ """Test model download functionality"""
166
+ print("\n๐Ÿงช Testing model download...")
167
+
168
+ try:
169
+ from mcli.workflow.model_service.lightweight_model_server import (
170
+ LIGHTWEIGHT_MODELS,
171
+ LightweightModelDownloader,
172
+ )
173
+
174
+ # Create downloader
175
+ downloader = LightweightModelDownloader("./test_download")
176
+
177
+ # Test with smallest model
178
+ smallest_model = min(LIGHTWEIGHT_MODELS.items(), key=lambda x: x[1]["size_mb"])[0]
179
+ print(f"๐Ÿ“ฅ Testing download of smallest model: {smallest_model}")
180
+
181
+ # This would actually download the model, so we'll just test the method exists
182
+ if hasattr(downloader, "download_model"):
183
+ print("โœ… Download method exists")
184
+ else:
185
+ print("โŒ Download method not found")
186
+ return False
187
+
188
+ if hasattr(downloader, "download_file"):
189
+ print("โœ… File download method exists")
190
+ else:
191
+ print("โŒ File download method not found")
192
+ return False
193
+
194
+ return True
195
+
196
+ except Exception as e:
197
+ print(f"โŒ Model download test failed: {e}")
198
+ return False
199
+
200
+
201
+ def main():
202
+ """Run all tests"""
203
+ print("๐Ÿš€ Testing Lightweight Model Server")
204
+ print("=" * 50)
205
+
206
+ tests = [
207
+ ("Lightweight Models", test_lightweight_models),
208
+ ("Downloader", test_downloader),
209
+ ("Server", test_server),
210
+ ("HTTP Server", test_http_server),
211
+ ("Model Download", test_model_download),
212
+ ]
213
+
214
+ passed = 0
215
+ total = len(tests)
216
+
217
+ for test_name, test_func in tests:
218
+ print(f"\n๐Ÿ“‹ Running {test_name} test...")
219
+ if test_func():
220
+ passed += 1
221
+ print(f"โœ… {test_name} test passed")
222
+ else:
223
+ print(f"โŒ {test_name} test failed")
224
+
225
+ print("\n" + "=" * 50)
226
+ print(f"๐Ÿ“Š Test Results: {passed}/{total} tests passed")
227
+
228
+ if passed == total:
229
+ print("๐ŸŽ‰ All tests passed! The lightweight model server is ready to use.")
230
+ print("\n๐Ÿ“ Next steps:")
231
+ print("1. Run: python lightweight_model_server.py")
232
+ print("2. Choose a model to download")
233
+ print("3. Test with: python lightweight_client.py")
234
+ return 0
235
+ else:
236
+ print("โŒ Some tests failed. Please check the errors above.")
237
+ return 1
238
+
239
+
240
+ if __name__ == "__main__":
241
+ sys.exit(main())