mcli-framework 7.4.0__py3-none-any.whl → 7.5.1__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/lib/auth/aws_manager.py +9 -64
- mcli/lib/auth/azure_manager.py +9 -64
- mcli/lib/auth/credential_manager.py +70 -1
- mcli/lib/auth/gcp_manager.py +11 -64
- mcli/ml/dashboard/app.py +6 -39
- mcli/ml/dashboard/app_integrated.py +23 -101
- mcli/ml/dashboard/app_supabase.py +8 -57
- mcli/ml/dashboard/app_training.py +9 -11
- mcli/ml/dashboard/common.py +167 -0
- mcli/ml/dashboard/pages/cicd.py +4 -4
- mcli/ml/dashboard/pages/debug_dependencies.py +99 -57
- mcli/ml/dashboard/pages/gravity_viz.py +265 -47
- mcli/ml/dashboard/pages/predictions_enhanced.py +4 -2
- mcli/ml/dashboard/pages/scrapers_and_logs.py +3 -3
- mcli/ml/dashboard/styles.py +55 -0
- mcli/self/self_cmd.py +12 -806
- {mcli_framework-7.4.0.dist-info → mcli_framework-7.5.1.dist-info}/METADATA +1 -3
- {mcli_framework-7.4.0.dist-info → mcli_framework-7.5.1.dist-info}/RECORD +23 -84
- mcli/__init__.py +0 -160
- mcli/__main__.py +0 -14
- mcli/app/__init__.py +0 -23
- mcli/app/model/__init__.py +0 -0
- mcli/app/video/__init__.py +0 -5
- mcli/chat/__init__.py +0 -34
- mcli/lib/__init__.py +0 -0
- mcli/lib/api/__init__.py +0 -0
- mcli/lib/auth/__init__.py +0 -1
- mcli/lib/config/__init__.py +0 -1
- mcli/lib/erd/__init__.py +0 -25
- mcli/lib/files/__init__.py +0 -0
- mcli/lib/fs/__init__.py +0 -1
- mcli/lib/logger/__init__.py +0 -3
- mcli/lib/performance/__init__.py +0 -17
- mcli/lib/pickles/__init__.py +0 -1
- mcli/lib/shell/__init__.py +0 -0
- mcli/lib/toml/__init__.py +0 -1
- mcli/lib/watcher/__init__.py +0 -0
- mcli/ml/__init__.py +0 -16
- mcli/ml/api/__init__.py +0 -30
- mcli/ml/api/routers/__init__.py +0 -27
- mcli/ml/auth/__init__.py +0 -45
- mcli/ml/backtesting/__init__.py +0 -39
- mcli/ml/cli/__init__.py +0 -5
- mcli/ml/config/__init__.py +0 -33
- mcli/ml/configs/__init__.py +0 -16
- mcli/ml/dashboard/__init__.py +0 -12
- mcli/ml/dashboard/components/__init__.py +0 -7
- mcli/ml/dashboard/pages/__init__.py +0 -6
- mcli/ml/data_ingestion/__init__.py +0 -39
- mcli/ml/database/__init__.py +0 -47
- mcli/ml/experimentation/__init__.py +0 -29
- mcli/ml/features/__init__.py +0 -39
- mcli/ml/mlops/__init__.py +0 -33
- mcli/ml/models/__init__.py +0 -94
- mcli/ml/monitoring/__init__.py +0 -25
- mcli/ml/optimization/__init__.py +0 -27
- mcli/ml/predictions/__init__.py +0 -5
- mcli/ml/preprocessing/__init__.py +0 -28
- mcli/ml/scripts/__init__.py +0 -1
- mcli/ml/trading/__init__.py +0 -66
- mcli/ml/training/__init__.py +0 -10
- mcli/mygroup/__init__.py +0 -3
- mcli/public/__init__.py +0 -1
- mcli/public/commands/__init__.py +0 -2
- mcli/self/__init__.py +0 -3
- mcli/workflow/__init__.py +0 -0
- mcli/workflow/daemon/__init__.py +0 -15
- mcli/workflow/dashboard/__init__.py +0 -5
- mcli/workflow/docker/__init__.py +0 -0
- mcli/workflow/file/__init__.py +0 -0
- mcli/workflow/gcloud/__init__.py +0 -1
- mcli/workflow/git_commit/__init__.py +0 -0
- mcli/workflow/interview/__init__.py +0 -0
- mcli/workflow/politician_trading/__init__.py +0 -4
- mcli/workflow/registry/__init__.py +0 -0
- mcli/workflow/repo/__init__.py +0 -0
- mcli/workflow/scheduler/__init__.py +0 -25
- mcli/workflow/search/__init__.py +0 -0
- mcli/workflow/sync/__init__.py +0 -5
- mcli/workflow/videos/__init__.py +0 -1
- mcli/workflow/wakatime/__init__.py +0 -80
- /mcli/ml/dashboard/{pages/overview.py → overview.py} +0 -0
- {mcli_framework-7.4.0.dist-info → mcli_framework-7.5.1.dist-info}/WHEEL +0 -0
- {mcli_framework-7.4.0.dist-info → mcli_framework-7.5.1.dist-info}/entry_points.txt +0 -0
- {mcli_framework-7.4.0.dist-info → mcli_framework-7.5.1.dist-info}/licenses/LICENSE +0 -0
- {mcli_framework-7.4.0.dist-info → mcli_framework-7.5.1.dist-info}/top_level.txt +0 -0
|
@@ -12,24 +12,22 @@ from scipy import stats
|
|
|
12
12
|
|
|
13
13
|
from mcli.ml.database.models import Experiment, Model, ModelStatus
|
|
14
14
|
from mcli.ml.database.session import SessionLocal
|
|
15
|
+
from mcli.ml.dashboard.common import setup_page_config
|
|
16
|
+
from mcli.ml.dashboard.styles import apply_dashboard_styles
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
# Page config - must be first
|
|
19
|
+
setup_page_config(
|
|
17
20
|
page_title="MCLI Training Dashboard",
|
|
18
|
-
page_icon="🔬"
|
|
19
|
-
layout="wide",
|
|
20
|
-
initial_sidebar_state="expanded",
|
|
21
|
+
page_icon="🔬"
|
|
21
22
|
)
|
|
22
23
|
|
|
23
|
-
#
|
|
24
|
+
# Apply standard dashboard styles (includes metric-card)
|
|
25
|
+
apply_dashboard_styles()
|
|
26
|
+
|
|
27
|
+
# Add training-specific CSS
|
|
24
28
|
st.markdown(
|
|
25
29
|
"""
|
|
26
30
|
<style>
|
|
27
|
-
.metric-card {
|
|
28
|
-
background-color: #f0f2f6;
|
|
29
|
-
padding: 1rem;
|
|
30
|
-
border-radius: 0.5rem;
|
|
31
|
-
border-left: 4px solid #1f77b4;
|
|
32
|
-
}
|
|
33
31
|
.model-card {
|
|
34
32
|
background-color: #ffffff;
|
|
35
33
|
padding: 1.5rem;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Common utilities for MCLI ML Dashboards.
|
|
3
|
+
|
|
4
|
+
This module provides shared functionality across all dashboard variants to avoid code duplication.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import os
|
|
8
|
+
import warnings
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
from typing import Optional
|
|
11
|
+
|
|
12
|
+
import streamlit as st
|
|
13
|
+
from dotenv import load_dotenv
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def suppress_streamlit_warnings():
|
|
17
|
+
"""
|
|
18
|
+
Suppress common Streamlit, Plotly, and media file warnings.
|
|
19
|
+
|
|
20
|
+
Call this at the top of your dashboard file before importing other modules.
|
|
21
|
+
"""
|
|
22
|
+
# Suppress Streamlit warnings when used outside runtime context
|
|
23
|
+
warnings.filterwarnings("ignore", message=".*missing ScriptRunContext.*")
|
|
24
|
+
warnings.filterwarnings("ignore", message=".*No runtime found.*")
|
|
25
|
+
warnings.filterwarnings("ignore", message=".*Session state does not function.*")
|
|
26
|
+
warnings.filterwarnings("ignore", message=".*to view this Streamlit app.*")
|
|
27
|
+
|
|
28
|
+
# Suppress Plotly deprecation warnings
|
|
29
|
+
warnings.filterwarnings("ignore", message=".*keyword arguments have been deprecated.*")
|
|
30
|
+
warnings.filterwarnings("ignore", message=".*Use `config` instead.*")
|
|
31
|
+
|
|
32
|
+
# Suppress media file errors
|
|
33
|
+
warnings.filterwarnings("ignore", message=".*MediaFileHandler.*")
|
|
34
|
+
warnings.filterwarnings("ignore", message=".*Missing file.*")
|
|
35
|
+
warnings.filterwarnings("ignore", message=".*Bad filename.*")
|
|
36
|
+
|
|
37
|
+
# Suppress general warnings
|
|
38
|
+
warnings.filterwarnings("ignore", category=UserWarning)
|
|
39
|
+
warnings.filterwarnings("ignore", category=FutureWarning)
|
|
40
|
+
|
|
41
|
+
# Suppress specific Streamlit media file errors in logging
|
|
42
|
+
import logging
|
|
43
|
+
|
|
44
|
+
logging.getLogger("streamlit.runtime.media_file_storage").setLevel(logging.ERROR)
|
|
45
|
+
logging.getLogger("streamlit.web.server.media_file_handler").setLevel(logging.ERROR)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def setup_page_config(
|
|
49
|
+
page_title: str = "MCLI ML Dashboard",
|
|
50
|
+
page_icon: str = "📊",
|
|
51
|
+
layout: str = "wide",
|
|
52
|
+
initial_sidebar_state: str = "expanded",
|
|
53
|
+
):
|
|
54
|
+
"""
|
|
55
|
+
Configure Streamlit page with standard settings.
|
|
56
|
+
|
|
57
|
+
IMPORTANT: This must be called before any other Streamlit commands.
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
page_title: Title shown in browser tab
|
|
61
|
+
page_icon: Emoji or image icon
|
|
62
|
+
layout: "wide" or "centered"
|
|
63
|
+
initial_sidebar_state: "expanded" or "collapsed"
|
|
64
|
+
|
|
65
|
+
Example:
|
|
66
|
+
from mcli.ml.dashboard.common import setup_page_config
|
|
67
|
+
|
|
68
|
+
setup_page_config(page_title="ML Training Dashboard")
|
|
69
|
+
"""
|
|
70
|
+
st.set_page_config(
|
|
71
|
+
page_title=page_title,
|
|
72
|
+
page_icon=page_icon,
|
|
73
|
+
layout=layout,
|
|
74
|
+
initial_sidebar_state=initial_sidebar_state,
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
@st.cache_resource
|
|
79
|
+
def get_supabase_client():
|
|
80
|
+
"""
|
|
81
|
+
Get cached Supabase client with automatic credential detection.
|
|
82
|
+
|
|
83
|
+
Tries multiple sources in order:
|
|
84
|
+
1. Streamlit Cloud secrets (for deployed apps)
|
|
85
|
+
2. Environment variables (for local development)
|
|
86
|
+
3. .env.local file in supabase directory
|
|
87
|
+
|
|
88
|
+
Returns:
|
|
89
|
+
Supabase Client instance or None if credentials not found
|
|
90
|
+
|
|
91
|
+
Example:
|
|
92
|
+
from mcli.ml.dashboard.common import get_supabase_client
|
|
93
|
+
|
|
94
|
+
client = get_supabase_client()
|
|
95
|
+
if client:
|
|
96
|
+
data = client.table('politicians').select('*').execute()
|
|
97
|
+
"""
|
|
98
|
+
from supabase import Client, create_client
|
|
99
|
+
|
|
100
|
+
# Try Streamlit secrets first (for Streamlit Cloud)
|
|
101
|
+
url = ""
|
|
102
|
+
key = ""
|
|
103
|
+
|
|
104
|
+
try:
|
|
105
|
+
url = st.secrets.get("SUPABASE_URL", "")
|
|
106
|
+
key = st.secrets.get("SUPABASE_KEY", "") or st.secrets.get("SUPABASE_SERVICE_ROLE_KEY", "")
|
|
107
|
+
except (AttributeError, FileNotFoundError, KeyError):
|
|
108
|
+
pass
|
|
109
|
+
|
|
110
|
+
# Fall back to environment variables (for local dev)
|
|
111
|
+
if not url or not key:
|
|
112
|
+
url = os.getenv("SUPABASE_URL", "")
|
|
113
|
+
key = os.getenv("SUPABASE_KEY", "") or os.getenv("SUPABASE_SERVICE_ROLE_KEY", "")
|
|
114
|
+
|
|
115
|
+
# Try loading from .env.local in supabase directory
|
|
116
|
+
if not url or not key:
|
|
117
|
+
env_path = Path(__file__).parent.parent.parent.parent.parent / "supabase" / ".env.local"
|
|
118
|
+
if env_path.exists():
|
|
119
|
+
load_dotenv(env_path)
|
|
120
|
+
url = os.getenv("SUPABASE_URL", "")
|
|
121
|
+
key = os.getenv("SUPABASE_KEY", "") or os.getenv("SUPABASE_SERVICE_ROLE_KEY", "")
|
|
122
|
+
|
|
123
|
+
if not url or not key:
|
|
124
|
+
st.warning(
|
|
125
|
+
"⚠️ Supabase credentials not found. Configure SUPABASE_URL and SUPABASE_KEY "
|
|
126
|
+
"in Streamlit Cloud secrets or environment variables."
|
|
127
|
+
)
|
|
128
|
+
return None
|
|
129
|
+
|
|
130
|
+
try:
|
|
131
|
+
client = create_client(url, key)
|
|
132
|
+
|
|
133
|
+
# Test connection with a simple query
|
|
134
|
+
try:
|
|
135
|
+
# Try politicians table first (most common)
|
|
136
|
+
client.table("politicians").select("id").limit(1).execute()
|
|
137
|
+
except Exception:
|
|
138
|
+
# If politicians table doesn't exist, try another table
|
|
139
|
+
pass
|
|
140
|
+
|
|
141
|
+
return client
|
|
142
|
+
except Exception as e:
|
|
143
|
+
st.error(f"❌ Failed to create Supabase client: {e}")
|
|
144
|
+
return None
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def load_environment_variables():
|
|
148
|
+
"""
|
|
149
|
+
Load environment variables from various sources.
|
|
150
|
+
|
|
151
|
+
Tries loading from:
|
|
152
|
+
1. Current directory .env file
|
|
153
|
+
2. Parent supabase/.env.local file
|
|
154
|
+
|
|
155
|
+
Example:
|
|
156
|
+
from mcli.ml.dashboard.common import load_environment_variables
|
|
157
|
+
|
|
158
|
+
load_environment_variables()
|
|
159
|
+
api_key = os.getenv("API_KEY")
|
|
160
|
+
"""
|
|
161
|
+
# Try current directory
|
|
162
|
+
load_dotenv()
|
|
163
|
+
|
|
164
|
+
# Try supabase directory
|
|
165
|
+
env_path = Path(__file__).parent.parent.parent.parent.parent / "supabase" / ".env.local"
|
|
166
|
+
if env_path.exists():
|
|
167
|
+
load_dotenv(env_path)
|
mcli/ml/dashboard/pages/cicd.py
CHANGED
|
@@ -121,12 +121,12 @@ def show_cicd_dashboard():
|
|
|
121
121
|
if st.button("🔄 Refresh"):
|
|
122
122
|
st.rerun()
|
|
123
123
|
with col2:
|
|
124
|
-
auto_refresh = st.checkbox("Auto-refresh", value=
|
|
124
|
+
auto_refresh = st.checkbox("Auto-refresh (30s)", value=False)
|
|
125
125
|
|
|
126
126
|
if auto_refresh:
|
|
127
|
-
import
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
from streamlit_autorefresh import st_autorefresh
|
|
128
|
+
# Auto-refresh every 30 seconds
|
|
129
|
+
st_autorefresh(interval=30000, key="cicd_refresh")
|
|
130
130
|
|
|
131
131
|
st.divider()
|
|
132
132
|
|
|
@@ -126,74 +126,116 @@ Platform: {sys.platform}
|
|
|
126
126
|
# List installed packages
|
|
127
127
|
st.header("📋 Installed Packages")
|
|
128
128
|
|
|
129
|
+
# Check if uv is being used
|
|
130
|
+
uv_available = False
|
|
129
131
|
try:
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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)}")
|
|
156
179
|
|
|
157
|
-
|
|
158
|
-
st.error("
|
|
159
|
-
except Exception as e:
|
|
160
|
-
st.error(f"Error running pip list: {str(e)}")
|
|
180
|
+
if not packages_found:
|
|
181
|
+
st.error("❌ Could not list packages from any package manager")
|
|
161
182
|
|
|
162
183
|
# Check for specific alpaca-py installation
|
|
163
184
|
st.header("🔎 Alpaca-py Installation Check")
|
|
164
185
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
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!")
|
|
187
234
|
|
|
188
235
|
# Suggest installation
|
|
189
236
|
st.markdown("### 💡 Suggested Fix")
|
|
190
237
|
st.code("pip install alpaca-py>=0.20.0", language="bash")
|
|
191
238
|
|
|
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
239
|
# Check requirements.txt
|
|
198
240
|
st.header("📄 Requirements.txt Check")
|
|
199
241
|
|