mcli-framework 7.2.0__py3-none-any.whl â 7.4.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.
- mcli/__init__.py +160 -0
- mcli/__main__.py +14 -0
- mcli/app/__init__.py +23 -0
- mcli/app/commands_cmd.py +741 -0
- mcli/app/model/__init__.py +0 -0
- mcli/app/video/__init__.py +5 -0
- mcli/chat/__init__.py +34 -0
- mcli/lib/__init__.py +0 -0
- mcli/lib/api/__init__.py +0 -0
- mcli/lib/auth/__init__.py +1 -0
- mcli/lib/config/__init__.py +1 -0
- mcli/lib/erd/__init__.py +25 -0
- mcli/lib/files/__init__.py +0 -0
- mcli/lib/fs/__init__.py +1 -0
- mcli/lib/logger/__init__.py +3 -0
- mcli/lib/performance/__init__.py +17 -0
- mcli/lib/pickles/__init__.py +1 -0
- mcli/lib/shell/__init__.py +0 -0
- mcli/lib/toml/__init__.py +1 -0
- mcli/lib/watcher/__init__.py +0 -0
- mcli/ml/__init__.py +16 -0
- mcli/ml/api/__init__.py +30 -0
- mcli/ml/api/routers/__init__.py +27 -0
- mcli/ml/api/schemas.py +2 -2
- mcli/ml/auth/__init__.py +45 -0
- mcli/ml/auth/models.py +2 -2
- mcli/ml/backtesting/__init__.py +39 -0
- mcli/ml/cli/__init__.py +5 -0
- mcli/ml/cli/main.py +1 -1
- mcli/ml/config/__init__.py +33 -0
- mcli/ml/configs/__init__.py +16 -0
- mcli/ml/dashboard/__init__.py +12 -0
- mcli/ml/dashboard/app_integrated.py +296 -30
- mcli/ml/dashboard/app_training.py +1 -1
- mcli/ml/dashboard/components/__init__.py +7 -0
- mcli/ml/dashboard/pages/__init__.py +6 -0
- mcli/ml/dashboard/pages/cicd.py +1 -1
- mcli/ml/dashboard/pages/debug_dependencies.py +364 -0
- mcli/ml/dashboard/pages/gravity_viz.py +565 -0
- mcli/ml/dashboard/pages/monte_carlo_predictions.py +555 -0
- mcli/ml/dashboard/pages/overview.py +378 -0
- mcli/ml/dashboard/pages/predictions_enhanced.py +20 -6
- mcli/ml/dashboard/pages/scrapers_and_logs.py +22 -6
- mcli/ml/dashboard/pages/test_portfolio.py +423 -0
- mcli/ml/dashboard/pages/trading.py +768 -0
- mcli/ml/dashboard/streamlit_extras_utils.py +297 -0
- mcli/ml/dashboard/utils.py +161 -0
- mcli/ml/dashboard/warning_suppression.py +34 -0
- mcli/ml/data_ingestion/__init__.py +39 -0
- mcli/ml/database/__init__.py +47 -0
- mcli/ml/database/session.py +169 -16
- mcli/ml/experimentation/__init__.py +29 -0
- mcli/ml/features/__init__.py +39 -0
- mcli/ml/mlops/__init__.py +33 -0
- mcli/ml/models/__init__.py +94 -0
- mcli/ml/monitoring/__init__.py +25 -0
- mcli/ml/optimization/__init__.py +27 -0
- mcli/ml/predictions/__init__.py +5 -0
- mcli/ml/predictions/monte_carlo.py +428 -0
- mcli/ml/preprocessing/__init__.py +28 -0
- mcli/ml/scripts/__init__.py +1 -0
- mcli/ml/trading/__init__.py +66 -0
- mcli/ml/trading/alpaca_client.py +417 -0
- mcli/ml/trading/migrations.py +164 -0
- mcli/ml/trading/models.py +418 -0
- mcli/ml/trading/paper_trading.py +326 -0
- mcli/ml/trading/risk_management.py +370 -0
- mcli/ml/trading/trading_service.py +480 -0
- mcli/ml/training/__init__.py +10 -0
- mcli/mygroup/__init__.py +3 -0
- mcli/public/__init__.py +1 -0
- mcli/public/commands/__init__.py +2 -0
- mcli/self/__init__.py +3 -0
- mcli/self/self_cmd.py +514 -15
- mcli/workflow/__init__.py +0 -0
- mcli/workflow/daemon/__init__.py +15 -0
- mcli/workflow/daemon/daemon.py +21 -3
- mcli/workflow/dashboard/__init__.py +5 -0
- mcli/workflow/docker/__init__.py +0 -0
- mcli/workflow/file/__init__.py +0 -0
- mcli/workflow/gcloud/__init__.py +1 -0
- mcli/workflow/git_commit/__init__.py +0 -0
- mcli/workflow/interview/__init__.py +0 -0
- mcli/workflow/politician_trading/__init__.py +4 -0
- mcli/workflow/registry/__init__.py +0 -0
- mcli/workflow/repo/__init__.py +0 -0
- mcli/workflow/scheduler/__init__.py +25 -0
- mcli/workflow/search/__init__.py +0 -0
- mcli/workflow/sync/__init__.py +5 -0
- mcli/workflow/videos/__init__.py +1 -0
- mcli/workflow/wakatime/__init__.py +80 -0
- {mcli_framework-7.2.0.dist-info â mcli_framework-7.4.0.dist-info}/METADATA +4 -1
- {mcli_framework-7.2.0.dist-info â mcli_framework-7.4.0.dist-info}/RECORD +97 -18
- {mcli_framework-7.2.0.dist-info â mcli_framework-7.4.0.dist-info}/WHEEL +0 -0
- {mcli_framework-7.2.0.dist-info â mcli_framework-7.4.0.dist-info}/entry_points.txt +0 -0
- {mcli_framework-7.2.0.dist-info â mcli_framework-7.4.0.dist-info}/licenses/LICENSE +0 -0
- {mcli_framework-7.2.0.dist-info â mcli_framework-7.4.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,364 @@
|
|
|
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
|
+
try:
|
|
130
|
+
result = subprocess.run(
|
|
131
|
+
["pip", "list", "--format=columns"],
|
|
132
|
+
capture_output=True,
|
|
133
|
+
text=True,
|
|
134
|
+
timeout=10
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
if result.returncode == 0:
|
|
138
|
+
# Search for alpaca-related packages
|
|
139
|
+
alpaca_packages = [
|
|
140
|
+
line for line in result.stdout.split("\n")
|
|
141
|
+
if "alpaca" in line.lower()
|
|
142
|
+
]
|
|
143
|
+
|
|
144
|
+
if alpaca_packages:
|
|
145
|
+
st.success("Found alpaca-related packages:")
|
|
146
|
+
for pkg in alpaca_packages:
|
|
147
|
+
st.code(pkg)
|
|
148
|
+
else:
|
|
149
|
+
st.error("â ī¸ No alpaca-related packages found in pip list!")
|
|
150
|
+
|
|
151
|
+
with st.expander("đĻ All Installed Packages (click to expand)"):
|
|
152
|
+
st.code(result.stdout)
|
|
153
|
+
else:
|
|
154
|
+
st.error("Failed to run pip list")
|
|
155
|
+
st.code(result.stderr)
|
|
156
|
+
|
|
157
|
+
except subprocess.TimeoutExpired:
|
|
158
|
+
st.error("pip list command timed out")
|
|
159
|
+
except Exception as e:
|
|
160
|
+
st.error(f"Error running pip list: {str(e)}")
|
|
161
|
+
|
|
162
|
+
# Check for specific alpaca-py installation
|
|
163
|
+
st.header("đ Alpaca-py Installation Check")
|
|
164
|
+
|
|
165
|
+
try:
|
|
166
|
+
result = subprocess.run(
|
|
167
|
+
["pip", "show", "alpaca-py"],
|
|
168
|
+
capture_output=True,
|
|
169
|
+
text=True,
|
|
170
|
+
timeout=10
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
if result.returncode == 0:
|
|
174
|
+
st.success("â
alpaca-py package is installed!")
|
|
175
|
+
st.code(result.stdout)
|
|
176
|
+
|
|
177
|
+
# Try to get the version
|
|
178
|
+
try:
|
|
179
|
+
import alpaca
|
|
180
|
+
if hasattr(alpaca, "__version__"):
|
|
181
|
+
st.info(f"Alpaca version from import: {alpaca.__version__}")
|
|
182
|
+
except:
|
|
183
|
+
pass
|
|
184
|
+
else:
|
|
185
|
+
st.error("â alpaca-py package NOT found!")
|
|
186
|
+
st.code(result.stderr)
|
|
187
|
+
|
|
188
|
+
# Suggest installation
|
|
189
|
+
st.markdown("### đĄ Suggested Fix")
|
|
190
|
+
st.code("pip install alpaca-py>=0.20.0", language="bash")
|
|
191
|
+
|
|
192
|
+
except subprocess.TimeoutExpired:
|
|
193
|
+
st.error("pip show command timed out")
|
|
194
|
+
except Exception as e:
|
|
195
|
+
st.error(f"Error running pip show: {str(e)}")
|
|
196
|
+
|
|
197
|
+
# Check requirements.txt
|
|
198
|
+
st.header("đ Requirements.txt Check")
|
|
199
|
+
|
|
200
|
+
requirements_path = Path(__file__).parent.parent.parent.parent.parent / "requirements.txt"
|
|
201
|
+
|
|
202
|
+
if requirements_path.exists():
|
|
203
|
+
with open(requirements_path, "r") as f:
|
|
204
|
+
requirements_content = f.read()
|
|
205
|
+
|
|
206
|
+
# Check if alpaca-py is in requirements
|
|
207
|
+
if "alpaca-py" in requirements_content.lower():
|
|
208
|
+
st.success("â
alpaca-py found in requirements.txt")
|
|
209
|
+
else:
|
|
210
|
+
st.error("â alpaca-py NOT found in requirements.txt!")
|
|
211
|
+
|
|
212
|
+
# Show relevant lines
|
|
213
|
+
st.markdown("### Alpaca-related lines:")
|
|
214
|
+
for line in requirements_content.split("\n"):
|
|
215
|
+
if "alpaca" in line.lower() and not line.strip().startswith("#"):
|
|
216
|
+
st.code(line)
|
|
217
|
+
|
|
218
|
+
with st.expander("đ Full requirements.txt"):
|
|
219
|
+
st.code(requirements_content)
|
|
220
|
+
else:
|
|
221
|
+
st.warning(f"requirements.txt not found at {requirements_path}")
|
|
222
|
+
|
|
223
|
+
# Environment variables check
|
|
224
|
+
st.header("đ Environment Variables")
|
|
225
|
+
|
|
226
|
+
env_vars_to_check = [
|
|
227
|
+
"ALPACA_API_KEY",
|
|
228
|
+
"ALPACA_SECRET_KEY",
|
|
229
|
+
"ALPACA_BASE_URL",
|
|
230
|
+
"PYTHONPATH",
|
|
231
|
+
"PATH",
|
|
232
|
+
]
|
|
233
|
+
|
|
234
|
+
st.markdown("Checking for relevant environment variables:")
|
|
235
|
+
|
|
236
|
+
import os
|
|
237
|
+
for var in env_vars_to_check:
|
|
238
|
+
value = os.environ.get(var)
|
|
239
|
+
if value:
|
|
240
|
+
if "KEY" in var or "SECRET" in var:
|
|
241
|
+
# Mask sensitive values
|
|
242
|
+
masked = value[:4] + "..." + value[-4:] if len(value) > 8 else "***"
|
|
243
|
+
st.success(f"â
{var} = {masked}")
|
|
244
|
+
else:
|
|
245
|
+
with st.expander(f"â
{var}", expanded=False):
|
|
246
|
+
st.code(value)
|
|
247
|
+
else:
|
|
248
|
+
st.info(f"âšī¸ {var} = Not set")
|
|
249
|
+
|
|
250
|
+
# Streamlit Cloud specific checks
|
|
251
|
+
st.header("âī¸ Streamlit Cloud Detection")
|
|
252
|
+
|
|
253
|
+
is_cloud = os.environ.get("STREAMLIT_RUNTIME_ENVIRONMENT") == "cloud"
|
|
254
|
+
|
|
255
|
+
if is_cloud:
|
|
256
|
+
st.success("â
Running on Streamlit Cloud")
|
|
257
|
+
st.info("""
|
|
258
|
+
**Note:** On Streamlit Cloud, packages are installed from requirements.txt during deployment.
|
|
259
|
+
If alpaca-py is not installed, check:
|
|
260
|
+
1. requirements.txt has correct package name and version
|
|
261
|
+
2. Package has no conflicting dependencies
|
|
262
|
+
3. Deployment logs for installation errors
|
|
263
|
+
""")
|
|
264
|
+
else:
|
|
265
|
+
st.info("âšī¸ Running locally (not Streamlit Cloud)")
|
|
266
|
+
|
|
267
|
+
# System information
|
|
268
|
+
st.header("đģ System Information")
|
|
269
|
+
|
|
270
|
+
import platform
|
|
271
|
+
|
|
272
|
+
sys_info = {
|
|
273
|
+
"System": platform.system(),
|
|
274
|
+
"Release": platform.release(),
|
|
275
|
+
"Version": platform.version(),
|
|
276
|
+
"Machine": platform.machine(),
|
|
277
|
+
"Processor": platform.processor(),
|
|
278
|
+
"Python Implementation": platform.python_implementation(),
|
|
279
|
+
"Python Compiler": platform.python_compiler(),
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
for key, value in sys_info.items():
|
|
283
|
+
st.text(f"{key}: {value}")
|
|
284
|
+
|
|
285
|
+
# Troubleshooting guide
|
|
286
|
+
st.header("đ ī¸ Troubleshooting Guide")
|
|
287
|
+
|
|
288
|
+
with st.expander("đ§ Common Solutions", expanded=True):
|
|
289
|
+
st.markdown("""
|
|
290
|
+
### If alpaca-py import fails:
|
|
291
|
+
|
|
292
|
+
#### 1. Check Requirements.txt
|
|
293
|
+
- Ensure `alpaca-py>=0.20.0` is present
|
|
294
|
+
- No conflicting version constraints
|
|
295
|
+
- No explicit sub-dependencies (websockets, msgpack, etc.)
|
|
296
|
+
|
|
297
|
+
#### 2. Check Python Version
|
|
298
|
+
- alpaca-py requires Python 3.8+
|
|
299
|
+
- Best tested on Python 3.11
|
|
300
|
+
- Create `.python-version` file with `3.11`
|
|
301
|
+
|
|
302
|
+
#### 3. Dependency Conflicts
|
|
303
|
+
- Remove explicit version pins for sub-dependencies
|
|
304
|
+
- Let pip resolve dependencies automatically
|
|
305
|
+
- Check for conflicts with other packages
|
|
306
|
+
|
|
307
|
+
#### 4. Streamlit Cloud Deployment
|
|
308
|
+
- Check deployment logs for installation errors
|
|
309
|
+
- Verify requirements.txt is in repo root
|
|
310
|
+
- Ensure no typos in package names
|
|
311
|
+
- Check for timeout during installation
|
|
312
|
+
|
|
313
|
+
#### 5. Alternative Approaches
|
|
314
|
+
- Try pinning to specific version: `alpaca-py==0.20.0`
|
|
315
|
+
- Try older stable version: `alpaca-py==0.15.0`
|
|
316
|
+
- Check alpaca-py GitHub issues for known problems
|
|
317
|
+
|
|
318
|
+
### Debug Commands (local)
|
|
319
|
+
```bash
|
|
320
|
+
# Verify installation
|
|
321
|
+
pip show alpaca-py
|
|
322
|
+
|
|
323
|
+
# Test import
|
|
324
|
+
python -c "import alpaca; print(alpaca.__version__)"
|
|
325
|
+
|
|
326
|
+
# Check for conflicts
|
|
327
|
+
pip check
|
|
328
|
+
|
|
329
|
+
# Reinstall clean
|
|
330
|
+
pip uninstall alpaca-py -y
|
|
331
|
+
pip install alpaca-py>=0.20.0
|
|
332
|
+
```
|
|
333
|
+
""")
|
|
334
|
+
|
|
335
|
+
# Export diagnostics
|
|
336
|
+
st.header("đž Export Diagnostics")
|
|
337
|
+
|
|
338
|
+
if st.button("đ Copy Diagnostics to Clipboard"):
|
|
339
|
+
diagnostics = f"""
|
|
340
|
+
# Dependency Diagnostics Report
|
|
341
|
+
Generated: {pd.Timestamp.now()}
|
|
342
|
+
|
|
343
|
+
## Python Environment
|
|
344
|
+
- Version: {sys.version}
|
|
345
|
+
- Platform: {sys.platform}
|
|
346
|
+
- Executable: {sys.executable}
|
|
347
|
+
|
|
348
|
+
## Import Test Results
|
|
349
|
+
"""
|
|
350
|
+
for module_name, description, success, info in import_results:
|
|
351
|
+
status = "â
SUCCESS" if success else "â FAILED"
|
|
352
|
+
diagnostics += f"\n- {module_name}: {status}\n Info: {info}\n"
|
|
353
|
+
|
|
354
|
+
diagnostics += "\n## Installed Packages\n"
|
|
355
|
+
if 'result' in locals() and result.returncode == 0:
|
|
356
|
+
diagnostics += result.stdout
|
|
357
|
+
|
|
358
|
+
st.code(diagnostics)
|
|
359
|
+
st.success("Diagnostics generated! Copy the text above.")
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
if __name__ == "__main__":
|
|
363
|
+
import pandas as pd
|
|
364
|
+
show_debug_dependencies()
|