mcli-framework 7.3.1__py3-none-any.whl → 7.5.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 (96) hide show
  1. mcli/app/commands_cmd.py +741 -0
  2. mcli/lib/auth/aws_manager.py +9 -64
  3. mcli/lib/auth/azure_manager.py +9 -64
  4. mcli/lib/auth/credential_manager.py +70 -1
  5. mcli/lib/auth/gcp_manager.py +11 -64
  6. mcli/ml/dashboard/app.py +6 -39
  7. mcli/ml/dashboard/app_integrated.py +288 -117
  8. mcli/ml/dashboard/app_supabase.py +8 -57
  9. mcli/ml/dashboard/app_training.py +10 -12
  10. mcli/ml/dashboard/common.py +167 -0
  11. mcli/ml/dashboard/overview.py +378 -0
  12. mcli/ml/dashboard/pages/cicd.py +4 -4
  13. mcli/ml/dashboard/pages/debug_dependencies.py +406 -0
  14. mcli/ml/dashboard/pages/gravity_viz.py +783 -0
  15. mcli/ml/dashboard/pages/monte_carlo_predictions.py +555 -0
  16. mcli/ml/dashboard/pages/predictions_enhanced.py +4 -2
  17. mcli/ml/dashboard/pages/scrapers_and_logs.py +25 -9
  18. mcli/ml/dashboard/pages/test_portfolio.py +54 -4
  19. mcli/ml/dashboard/pages/trading.py +80 -26
  20. mcli/ml/dashboard/streamlit_extras_utils.py +297 -0
  21. mcli/ml/dashboard/styles.py +55 -0
  22. mcli/ml/dashboard/utils.py +7 -0
  23. mcli/ml/dashboard/warning_suppression.py +34 -0
  24. mcli/ml/database/session.py +169 -16
  25. mcli/ml/predictions/monte_carlo.py +428 -0
  26. mcli/ml/trading/alpaca_client.py +82 -18
  27. mcli/self/self_cmd.py +182 -737
  28. {mcli_framework-7.3.1.dist-info → mcli_framework-7.5.0.dist-info}/METADATA +2 -3
  29. {mcli_framework-7.3.1.dist-info → mcli_framework-7.5.0.dist-info}/RECORD +33 -87
  30. mcli/__init__.py +0 -160
  31. mcli/__main__.py +0 -14
  32. mcli/app/__init__.py +0 -23
  33. mcli/app/model/__init__.py +0 -0
  34. mcli/app/video/__init__.py +0 -5
  35. mcli/chat/__init__.py +0 -34
  36. mcli/lib/__init__.py +0 -0
  37. mcli/lib/api/__init__.py +0 -0
  38. mcli/lib/auth/__init__.py +0 -1
  39. mcli/lib/config/__init__.py +0 -1
  40. mcli/lib/erd/__init__.py +0 -25
  41. mcli/lib/files/__init__.py +0 -0
  42. mcli/lib/fs/__init__.py +0 -1
  43. mcli/lib/logger/__init__.py +0 -3
  44. mcli/lib/performance/__init__.py +0 -17
  45. mcli/lib/pickles/__init__.py +0 -1
  46. mcli/lib/shell/__init__.py +0 -0
  47. mcli/lib/toml/__init__.py +0 -1
  48. mcli/lib/watcher/__init__.py +0 -0
  49. mcli/ml/__init__.py +0 -16
  50. mcli/ml/api/__init__.py +0 -30
  51. mcli/ml/api/routers/__init__.py +0 -27
  52. mcli/ml/auth/__init__.py +0 -45
  53. mcli/ml/backtesting/__init__.py +0 -39
  54. mcli/ml/cli/__init__.py +0 -5
  55. mcli/ml/config/__init__.py +0 -33
  56. mcli/ml/configs/__init__.py +0 -16
  57. mcli/ml/dashboard/__init__.py +0 -12
  58. mcli/ml/dashboard/components/__init__.py +0 -7
  59. mcli/ml/dashboard/pages/__init__.py +0 -6
  60. mcli/ml/data_ingestion/__init__.py +0 -39
  61. mcli/ml/database/__init__.py +0 -47
  62. mcli/ml/experimentation/__init__.py +0 -29
  63. mcli/ml/features/__init__.py +0 -39
  64. mcli/ml/mlops/__init__.py +0 -33
  65. mcli/ml/models/__init__.py +0 -94
  66. mcli/ml/monitoring/__init__.py +0 -25
  67. mcli/ml/optimization/__init__.py +0 -27
  68. mcli/ml/predictions/__init__.py +0 -5
  69. mcli/ml/preprocessing/__init__.py +0 -28
  70. mcli/ml/scripts/__init__.py +0 -1
  71. mcli/ml/trading/__init__.py +0 -60
  72. mcli/ml/training/__init__.py +0 -10
  73. mcli/mygroup/__init__.py +0 -3
  74. mcli/public/__init__.py +0 -1
  75. mcli/public/commands/__init__.py +0 -2
  76. mcli/self/__init__.py +0 -3
  77. mcli/workflow/__init__.py +0 -0
  78. mcli/workflow/daemon/__init__.py +0 -15
  79. mcli/workflow/dashboard/__init__.py +0 -5
  80. mcli/workflow/docker/__init__.py +0 -0
  81. mcli/workflow/file/__init__.py +0 -0
  82. mcli/workflow/gcloud/__init__.py +0 -1
  83. mcli/workflow/git_commit/__init__.py +0 -0
  84. mcli/workflow/interview/__init__.py +0 -0
  85. mcli/workflow/politician_trading/__init__.py +0 -4
  86. mcli/workflow/registry/__init__.py +0 -0
  87. mcli/workflow/repo/__init__.py +0 -0
  88. mcli/workflow/scheduler/__init__.py +0 -25
  89. mcli/workflow/search/__init__.py +0 -0
  90. mcli/workflow/sync/__init__.py +0 -5
  91. mcli/workflow/videos/__init__.py +0 -1
  92. mcli/workflow/wakatime/__init__.py +0 -80
  93. {mcli_framework-7.3.1.dist-info → mcli_framework-7.5.0.dist-info}/WHEEL +0 -0
  94. {mcli_framework-7.3.1.dist-info → mcli_framework-7.5.0.dist-info}/entry_points.txt +0 -0
  95. {mcli_framework-7.3.1.dist-info → mcli_framework-7.5.0.dist-info}/licenses/LICENSE +0 -0
  96. {mcli_framework-7.3.1.dist-info → mcli_framework-7.5.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,406 @@
1
+ """Debug Dependencies - Diagnostic page for troubleshooting installation issues"""
2
+
3
+ import streamlit as st
4
+ import sys
5
+ import subprocess
6
+ from pathlib import Path
7
+ from typing import Dict, List, Tuple
8
+
9
+
10
+ def show_debug_dependencies():
11
+ """Diagnostic page for dependency debugging"""
12
+
13
+ st.title("🔍 Dependency Diagnostics")
14
+ st.markdown("""
15
+ This page helps diagnose why certain dependencies (like alpaca-py) may not be installing correctly.
16
+ """)
17
+
18
+ # Python environment info
19
+ st.header("🐍 Python Environment")
20
+
21
+ col1, col2 = st.columns(2)
22
+ with col1:
23
+ st.metric("Python Version", f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}")
24
+ with col2:
25
+ st.metric("Platform", sys.platform)
26
+
27
+ with st.expander("📋 Detailed Python Info", expanded=False):
28
+ st.code(f"""
29
+ Python Version: {sys.version}
30
+ Python Path: {sys.executable}
31
+ Prefix: {sys.prefix}
32
+ Platform: {sys.platform}
33
+ """)
34
+
35
+ # Check Python paths
36
+ st.header("📁 Python Paths")
37
+ with st.expander("View all Python paths", expanded=False):
38
+ for i, path in enumerate(sys.path, 1):
39
+ st.code(f"{i}. {path}")
40
+
41
+ # Test critical imports
42
+ st.header("📦 Critical Import Tests")
43
+
44
+ critical_imports = [
45
+ ("streamlit", "Streamlit core"),
46
+ ("pandas", "Data processing"),
47
+ ("numpy", "Numerical computing"),
48
+ ("plotly", "Visualizations"),
49
+ ("requests", "HTTP requests"),
50
+ ("supabase", "Database client"),
51
+ ("yfinance", "Yahoo Finance API"),
52
+ ("alpaca", "Alpaca Trading API - Main module"),
53
+ ("alpaca.trading", "Alpaca Trading client"),
54
+ ("alpaca.data", "Alpaca Data client"),
55
+ ("alpaca.broker", "Alpaca Broker client"),
56
+ ]
57
+
58
+ import_results: List[Tuple[str, str, bool, str]] = []
59
+
60
+ for module_name, description in critical_imports:
61
+ try:
62
+ module = __import__(module_name)
63
+ version = getattr(module, "__version__", "Unknown")
64
+ import_results.append((module_name, description, True, version))
65
+ except ImportError as e:
66
+ import_results.append((module_name, description, False, str(e)))
67
+ except Exception as e:
68
+ import_results.append((module_name, description, False, f"Unexpected error: {str(e)}"))
69
+
70
+ # Display results in a nice table
71
+ success_count = sum(1 for _, _, success, _ in import_results if success)
72
+ fail_count = len(import_results) - success_count
73
+
74
+ col1, col2 = st.columns(2)
75
+ with col1:
76
+ st.metric("✅ Successful Imports", success_count)
77
+ with col2:
78
+ st.metric("❌ Failed Imports", fail_count)
79
+
80
+ st.markdown("---")
81
+
82
+ for module_name, description, success, info in import_results:
83
+ if success:
84
+ with st.expander(f"✅ **{module_name}** - {description}", expanded=False):
85
+ st.success(f"Successfully imported")
86
+ st.code(f"Version: {info}")
87
+ else:
88
+ with st.expander(f"❌ **{module_name}** - {description}", expanded=True):
89
+ st.error(f"Import failed")
90
+ st.code(info)
91
+
92
+ # Detailed alpaca-py investigation
93
+ st.header("🔬 Alpaca-py Deep Dive")
94
+
95
+ st.markdown("""
96
+ Attempting to import alpaca-py components individually to identify specific failure points.
97
+ """)
98
+
99
+ alpaca_submodules = [
100
+ "alpaca",
101
+ "alpaca.common",
102
+ "alpaca.trading",
103
+ "alpaca.trading.client",
104
+ "alpaca.trading.requests",
105
+ "alpaca.trading.models",
106
+ "alpaca.data",
107
+ "alpaca.data.historical",
108
+ "alpaca.broker",
109
+ ]
110
+
111
+ for submodule in alpaca_submodules:
112
+ try:
113
+ mod = __import__(submodule)
114
+ st.success(f"✅ {submodule}")
115
+ if hasattr(mod, "__file__"):
116
+ st.caption(f"Location: {mod.__file__}")
117
+ except ImportError as e:
118
+ st.error(f"❌ {submodule}")
119
+ with st.expander("Error details"):
120
+ st.code(str(e))
121
+ except Exception as e:
122
+ st.warning(f"⚠️ {submodule}")
123
+ with st.expander("Error details"):
124
+ st.code(f"Unexpected error: {str(e)}")
125
+
126
+ # List installed packages
127
+ st.header("📋 Installed Packages")
128
+
129
+ # Check if uv is being used
130
+ uv_available = False
131
+ try:
132
+ uv_check = subprocess.run(["uv", "--version"], capture_output=True, text=True, timeout=5)
133
+ uv_available = uv_check.returncode == 0
134
+ if uv_available:
135
+ st.info(f"🚀 Detected `uv` package manager: {uv_check.stdout.strip()}")
136
+ except:
137
+ pass
138
+
139
+ # Try uv pip list first (for Streamlit Cloud), fallback to pip
140
+ package_managers = []
141
+ if uv_available:
142
+ package_managers.append(("uv", ["uv", "pip", "list", "--format=columns"]))
143
+ package_managers.append(("pip", ["pip", "list", "--format=columns"]))
144
+
145
+ packages_found = False
146
+
147
+ for pm_name, pm_command in package_managers:
148
+ try:
149
+ result = subprocess.run(
150
+ pm_command,
151
+ capture_output=True,
152
+ text=True,
153
+ timeout=10
154
+ )
155
+
156
+ if result.returncode == 0:
157
+ packages_found = True
158
+
159
+ # Search for alpaca-related packages
160
+ alpaca_packages = [
161
+ line for line in result.stdout.split("\n")
162
+ if "alpaca" in line.lower()
163
+ ]
164
+
165
+ if alpaca_packages:
166
+ st.success(f"✅ Found alpaca packages in `{pm_name}` list:")
167
+ for pkg in alpaca_packages:
168
+ st.code(pkg)
169
+
170
+ with st.expander(f"📦 All Installed Packages from `{pm_name}` (click to expand)"):
171
+ st.code(result.stdout)
172
+
173
+ break # Stop after first successful listing
174
+
175
+ except subprocess.TimeoutExpired:
176
+ st.warning(f"`{pm_name} list` command timed out")
177
+ except Exception as e:
178
+ st.warning(f"Could not run `{pm_name} list`: {str(e)}")
179
+
180
+ if not packages_found:
181
+ st.error("❌ Could not list packages from any package manager")
182
+
183
+ # Check for specific alpaca-py installation
184
+ st.header("🔎 Alpaca-py Installation Check")
185
+
186
+ # Try both uv and pip
187
+ show_commands = []
188
+ if uv_available:
189
+ show_commands.append(("uv", ["uv", "pip", "show", "alpaca-py"]))
190
+ show_commands.append(("pip", ["pip", "show", "alpaca-py"]))
191
+
192
+ package_info_found = False
193
+
194
+ for pm_name, pm_command in show_commands:
195
+ try:
196
+ result = subprocess.run(
197
+ pm_command,
198
+ capture_output=True,
199
+ text=True,
200
+ timeout=10
201
+ )
202
+
203
+ if result.returncode == 0:
204
+ package_info_found = True
205
+ st.success(f"✅ alpaca-py package details from `{pm_name}`:")
206
+ st.code(result.stdout)
207
+
208
+ # Try to get the version from import
209
+ try:
210
+ import alpaca
211
+ if hasattr(alpaca, "__version__"):
212
+ st.info(f"📦 Alpaca version from import: {alpaca.__version__}")
213
+ except:
214
+ pass
215
+
216
+ break # Stop after first successful show
217
+
218
+ except subprocess.TimeoutExpired:
219
+ st.warning(f"`{pm_name} show` command timed out")
220
+ except Exception as e:
221
+ st.warning(f"Could not run `{pm_name} show`: {str(e)}")
222
+
223
+ if not package_info_found:
224
+ # Check if imports work anyway
225
+ try:
226
+ import alpaca
227
+ st.success("✅ Alpaca module imports successfully!")
228
+ if hasattr(alpaca, "__version__"):
229
+ st.info(f"📦 Version from import: {alpaca.__version__}")
230
+ if hasattr(alpaca, "__file__"):
231
+ st.info(f"📁 Location: {alpaca.__file__}")
232
+ except ImportError:
233
+ st.error("❌ alpaca-py package NOT installed and imports fail!")
234
+
235
+ # Suggest installation
236
+ st.markdown("### 💡 Suggested Fix")
237
+ st.code("pip install alpaca-py>=0.20.0", language="bash")
238
+
239
+ # Check requirements.txt
240
+ st.header("📄 Requirements.txt Check")
241
+
242
+ requirements_path = Path(__file__).parent.parent.parent.parent.parent / "requirements.txt"
243
+
244
+ if requirements_path.exists():
245
+ with open(requirements_path, "r") as f:
246
+ requirements_content = f.read()
247
+
248
+ # Check if alpaca-py is in requirements
249
+ if "alpaca-py" in requirements_content.lower():
250
+ st.success("✅ alpaca-py found in requirements.txt")
251
+ else:
252
+ st.error("❌ alpaca-py NOT found in requirements.txt!")
253
+
254
+ # Show relevant lines
255
+ st.markdown("### Alpaca-related lines:")
256
+ for line in requirements_content.split("\n"):
257
+ if "alpaca" in line.lower() and not line.strip().startswith("#"):
258
+ st.code(line)
259
+
260
+ with st.expander("📋 Full requirements.txt"):
261
+ st.code(requirements_content)
262
+ else:
263
+ st.warning(f"requirements.txt not found at {requirements_path}")
264
+
265
+ # Environment variables check
266
+ st.header("🔐 Environment Variables")
267
+
268
+ env_vars_to_check = [
269
+ "ALPACA_API_KEY",
270
+ "ALPACA_SECRET_KEY",
271
+ "ALPACA_BASE_URL",
272
+ "PYTHONPATH",
273
+ "PATH",
274
+ ]
275
+
276
+ st.markdown("Checking for relevant environment variables:")
277
+
278
+ import os
279
+ for var in env_vars_to_check:
280
+ value = os.environ.get(var)
281
+ if value:
282
+ if "KEY" in var or "SECRET" in var:
283
+ # Mask sensitive values
284
+ masked = value[:4] + "..." + value[-4:] if len(value) > 8 else "***"
285
+ st.success(f"✅ {var} = {masked}")
286
+ else:
287
+ with st.expander(f"✅ {var}", expanded=False):
288
+ st.code(value)
289
+ else:
290
+ st.info(f"ℹ️ {var} = Not set")
291
+
292
+ # Streamlit Cloud specific checks
293
+ st.header("☁️ Streamlit Cloud Detection")
294
+
295
+ is_cloud = os.environ.get("STREAMLIT_RUNTIME_ENVIRONMENT") == "cloud"
296
+
297
+ if is_cloud:
298
+ st.success("✅ Running on Streamlit Cloud")
299
+ st.info("""
300
+ **Note:** On Streamlit Cloud, packages are installed from requirements.txt during deployment.
301
+ If alpaca-py is not installed, check:
302
+ 1. requirements.txt has correct package name and version
303
+ 2. Package has no conflicting dependencies
304
+ 3. Deployment logs for installation errors
305
+ """)
306
+ else:
307
+ st.info("ℹ️ Running locally (not Streamlit Cloud)")
308
+
309
+ # System information
310
+ st.header("💻 System Information")
311
+
312
+ import platform
313
+
314
+ sys_info = {
315
+ "System": platform.system(),
316
+ "Release": platform.release(),
317
+ "Version": platform.version(),
318
+ "Machine": platform.machine(),
319
+ "Processor": platform.processor(),
320
+ "Python Implementation": platform.python_implementation(),
321
+ "Python Compiler": platform.python_compiler(),
322
+ }
323
+
324
+ for key, value in sys_info.items():
325
+ st.text(f"{key}: {value}")
326
+
327
+ # Troubleshooting guide
328
+ st.header("🛠️ Troubleshooting Guide")
329
+
330
+ with st.expander("🔧 Common Solutions", expanded=True):
331
+ st.markdown("""
332
+ ### If alpaca-py import fails:
333
+
334
+ #### 1. Check Requirements.txt
335
+ - Ensure `alpaca-py>=0.20.0` is present
336
+ - No conflicting version constraints
337
+ - No explicit sub-dependencies (websockets, msgpack, etc.)
338
+
339
+ #### 2. Check Python Version
340
+ - alpaca-py requires Python 3.8+
341
+ - Best tested on Python 3.11
342
+ - Create `.python-version` file with `3.11`
343
+
344
+ #### 3. Dependency Conflicts
345
+ - Remove explicit version pins for sub-dependencies
346
+ - Let pip resolve dependencies automatically
347
+ - Check for conflicts with other packages
348
+
349
+ #### 4. Streamlit Cloud Deployment
350
+ - Check deployment logs for installation errors
351
+ - Verify requirements.txt is in repo root
352
+ - Ensure no typos in package names
353
+ - Check for timeout during installation
354
+
355
+ #### 5. Alternative Approaches
356
+ - Try pinning to specific version: `alpaca-py==0.20.0`
357
+ - Try older stable version: `alpaca-py==0.15.0`
358
+ - Check alpaca-py GitHub issues for known problems
359
+
360
+ ### Debug Commands (local)
361
+ ```bash
362
+ # Verify installation
363
+ pip show alpaca-py
364
+
365
+ # Test import
366
+ python -c "import alpaca; print(alpaca.__version__)"
367
+
368
+ # Check for conflicts
369
+ pip check
370
+
371
+ # Reinstall clean
372
+ pip uninstall alpaca-py -y
373
+ pip install alpaca-py>=0.20.0
374
+ ```
375
+ """)
376
+
377
+ # Export diagnostics
378
+ st.header("💾 Export Diagnostics")
379
+
380
+ if st.button("📋 Copy Diagnostics to Clipboard"):
381
+ diagnostics = f"""
382
+ # Dependency Diagnostics Report
383
+ Generated: {pd.Timestamp.now()}
384
+
385
+ ## Python Environment
386
+ - Version: {sys.version}
387
+ - Platform: {sys.platform}
388
+ - Executable: {sys.executable}
389
+
390
+ ## Import Test Results
391
+ """
392
+ for module_name, description, success, info in import_results:
393
+ status = "✅ SUCCESS" if success else "❌ FAILED"
394
+ diagnostics += f"\n- {module_name}: {status}\n Info: {info}\n"
395
+
396
+ diagnostics += "\n## Installed Packages\n"
397
+ if 'result' in locals() and result.returncode == 0:
398
+ diagnostics += result.stdout
399
+
400
+ st.code(diagnostics)
401
+ st.success("Diagnostics generated! Copy the text above.")
402
+
403
+
404
+ if __name__ == "__main__":
405
+ import pandas as pd
406
+ show_debug_dependencies()