mcli-framework 7.0.6__py3-none-any.whl → 7.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.

Potentially problematic release.


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

mcli/app/model_cmd.py CHANGED
@@ -100,15 +100,24 @@ def download(model_name: str):
100
100
 
101
101
  @model.command()
102
102
  @click.option("--model", "-m", help="Specific model to use")
103
- @click.option("--port", "-p", default=8080, help="Port to run server on")
103
+ @click.option("--port", "-p", default=None, help="Port to run server on (default: from config or 51234)")
104
104
  @click.option(
105
105
  "--auto-download",
106
106
  is_flag=True,
107
107
  default=True,
108
108
  help="Automatically download model if not available",
109
109
  )
110
- def start(model: Optional[str], port: int, auto_download: bool):
110
+ def start(model: Optional[str], port: Optional[int], auto_download: bool):
111
111
  """Start the lightweight model server."""
112
+ # Load port from config if not specified
113
+ if port is None:
114
+ try:
115
+ from mcli.lib.config.config import load_config
116
+ config = load_config()
117
+ port = config.get("model", {}).get("server_port", 51234)
118
+ except Exception:
119
+ port = 51234 # Default ephemeral port
120
+
112
121
  server = LightweightModelServer(port=port)
113
122
 
114
123
  # Determine which model to use
@@ -192,9 +201,18 @@ def recommend():
192
201
 
193
202
 
194
203
  @model.command()
195
- @click.option("--port", "-p", default=8080, help="Port where server is running")
196
- def status(port: int):
204
+ @click.option("--port", "-p", default=None, help="Port where server is running (default: from config or 51234)")
205
+ def status(port: Optional[int]):
197
206
  """Check status of the lightweight model server."""
207
+ # Load port from config if not specified
208
+ if port is None:
209
+ try:
210
+ from mcli.lib.config.config import load_config
211
+ config = load_config()
212
+ port = config.get("model", {}).get("server_port", 51234)
213
+ except Exception:
214
+ port = 51234 # Default ephemeral port
215
+
198
216
  import requests
199
217
 
200
218
  try:
@@ -225,9 +243,18 @@ def status(port: int):
225
243
 
226
244
 
227
245
  @model.command()
228
- @click.option("--port", "-p", default=8080, help="Port where server is running")
229
- def stop(port: int):
246
+ @click.option("--port", "-p", default=None, help="Port where server is running (default: from config or 51234)")
247
+ def stop(port: Optional[int]):
230
248
  """Stop the lightweight model server."""
249
+ # Load port from config if not specified
250
+ if port is None:
251
+ try:
252
+ from mcli.lib.config.config import load_config
253
+ config = load_config()
254
+ port = config.get("model", {}).get("server_port", 51234)
255
+ except Exception:
256
+ port = 51234 # Default ephemeral port
257
+
231
258
  import requests
232
259
  import psutil
233
260
 
@@ -15,11 +15,20 @@ import json
15
15
  from pathlib import Path
16
16
  import subprocess
17
17
  import pickle
18
+ from dotenv import load_dotenv
19
+
20
+ # Load environment variables from .env file
21
+ load_dotenv()
18
22
 
19
23
  # Add ML pipeline imports
20
- from mcli.ml.preprocessing.data_preprocessor import DataPreprocessor
21
- from mcli.ml.features.feature_engineering import FeatureEngineering
22
- from mcli.ml.models import get_model_by_id
24
+ try:
25
+ from mcli.ml.preprocessing import PoliticianTradingPreprocessor, MLDataPipeline
26
+ from mcli.ml.models import get_model_by_id
27
+ HAS_ML_PIPELINE = True
28
+ except ImportError:
29
+ HAS_ML_PIPELINE = False
30
+ PoliticianTradingPreprocessor = None
31
+ MLDataPipeline = None
23
32
 
24
33
  # Page config
25
34
  st.set_page_config(
@@ -72,13 +81,17 @@ def get_supabase_client() -> Client:
72
81
  @st.cache_resource
73
82
  def get_preprocessor():
74
83
  """Get data preprocessor instance"""
75
- return DataPreprocessor()
84
+ if HAS_ML_PIPELINE and PoliticianTradingPreprocessor:
85
+ return PoliticianTradingPreprocessor()
86
+ return None
76
87
 
77
88
 
78
89
  @st.cache_resource
79
- def get_feature_engineer():
80
- """Get feature engineering instance"""
81
- return FeatureEngineering()
90
+ def get_ml_pipeline():
91
+ """Get ML data pipeline instance"""
92
+ if HAS_ML_PIPELINE and MLDataPipeline:
93
+ return MLDataPipeline()
94
+ return None
82
95
 
83
96
 
84
97
  def check_lsh_daemon():
@@ -128,11 +141,18 @@ def run_ml_pipeline(df_disclosures):
128
141
  try:
129
142
  # 1. Preprocess data
130
143
  preprocessor = get_preprocessor()
131
- processed_data = preprocessor.preprocess(df_disclosures)
144
+ if preprocessor:
145
+ processed_data = preprocessor.preprocess(df_disclosures)
146
+ else:
147
+ # Use raw data if preprocessor not available
148
+ processed_data = df_disclosures
132
149
 
133
- # 2. Feature engineering
134
- feature_engineer = get_feature_engineer()
135
- features = feature_engineer.create_features(processed_data)
150
+ # 2. Feature engineering (using ML pipeline if available)
151
+ ml_pipeline = get_ml_pipeline()
152
+ if ml_pipeline:
153
+ features = ml_pipeline.transform(processed_data)
154
+ else:
155
+ features = processed_data
136
156
 
137
157
  # 3. Generate predictions (mock for now, replace with actual model)
138
158
  predictions = pd.DataFrame({
@@ -219,15 +239,18 @@ def main():
219
239
  st.sidebar.title("Navigation")
220
240
  page = st.sidebar.selectbox(
221
241
  "Choose a page",
222
- ["Pipeline Overview", "ML Processing", "Model Performance", "Predictions", "LSH Jobs", "System Health"]
242
+ ["Pipeline Overview", "ML Processing", "Model Performance", "Predictions", "LSH Jobs", "System Health"],
243
+ index=0 # Default to Pipeline Overview
223
244
  )
224
245
 
225
- # Auto-refresh toggle
226
- auto_refresh = st.sidebar.checkbox("Auto-refresh (30s)", value=True)
246
+ # Auto-refresh toggle (default off to prevent blocking)
247
+ auto_refresh = st.sidebar.checkbox("Auto-refresh (30s)", value=False)
227
248
  if auto_refresh:
228
- import time
229
- time.sleep(30)
230
- st.rerun()
249
+ try:
250
+ from streamlit_autorefresh import st_autorefresh
251
+ st_autorefresh(interval=30000, key="data_refresh")
252
+ except ImportError:
253
+ st.sidebar.warning("⚠️ Auto-refresh requires streamlit-autorefresh package")
231
254
 
232
255
  # Manual refresh button
233
256
  if st.sidebar.button("🔄 Refresh Now"):
@@ -244,25 +267,42 @@ def main():
244
267
  else:
245
268
  st.sidebar.error("❌ Pipeline failed")
246
269
 
247
- # Main content
248
- if page == "Pipeline Overview":
249
- show_pipeline_overview()
250
- elif page == "ML Processing":
251
- show_ml_processing()
252
- elif page == "Model Performance":
253
- show_model_performance()
254
- elif page == "Predictions":
255
- show_predictions()
256
- elif page == "LSH Jobs":
257
- show_lsh_jobs()
258
- elif page == "System Health":
259
- show_system_health()
270
+ # Main content with error handling
271
+ try:
272
+ if page == "Pipeline Overview":
273
+ show_pipeline_overview()
274
+ elif page == "ML Processing":
275
+ show_ml_processing()
276
+ elif page == "Model Performance":
277
+ show_model_performance()
278
+ elif page == "Predictions":
279
+ show_predictions()
280
+ elif page == "LSH Jobs":
281
+ show_lsh_jobs()
282
+ elif page == "System Health":
283
+ show_system_health()
284
+ except Exception as e:
285
+ st.error(f"❌ Error loading page '{page}': {e}")
286
+ import traceback
287
+ with st.expander("See error details"):
288
+ st.code(traceback.format_exc())
260
289
 
261
290
 
262
291
  def show_pipeline_overview():
263
292
  """Show ML pipeline overview"""
264
293
  st.header("ML Pipeline Overview")
265
294
 
295
+ # Check Supabase connection
296
+ if not get_supabase_client():
297
+ st.warning("⚠️ **Supabase not configured**")
298
+ st.info("""
299
+ To connect to Supabase, set these environment variables:
300
+ - `SUPABASE_URL`: Your Supabase project URL
301
+ - `SUPABASE_KEY`: Your Supabase API key
302
+
303
+ The dashboard will show demo data until configured.
304
+ """)
305
+
266
306
  # Get data
267
307
  politicians = get_politicians_data()
268
308
  disclosures = get_disclosures_data()
@@ -283,17 +323,20 @@ def show_pipeline_overview():
283
323
  if not disclosures.empty:
284
324
  preprocessor = get_preprocessor()
285
325
  try:
286
- processed = preprocessor.preprocess(disclosures.head(100))
287
- feature_count = len(processed.columns)
326
+ if preprocessor:
327
+ processed = preprocessor.preprocess(disclosures.head(100))
328
+ feature_count = len(processed.columns)
329
+ else:
330
+ feature_count = len(disclosures.columns)
288
331
  except:
289
- feature_count = 0
332
+ feature_count = len(disclosures.columns) if not disclosures.empty else 0
290
333
  else:
291
334
  feature_count = 0
292
335
 
293
336
  st.metric(
294
337
  label="Features Extracted",
295
338
  value=feature_count,
296
- delta="After preprocessing"
339
+ delta="Raw data" if not preprocessor else "After preprocessing"
297
340
  )
298
341
 
299
342
  with col3:
@@ -0,0 +1 @@
1
+ def test(): pass
mcli/self/test_cmd.py ADDED
@@ -0,0 +1 @@
1
+ def test(): pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcli-framework
3
- Version: 7.0.6
3
+ Version: 7.1.0
4
4
  Summary: 🚀 High-performance CLI framework with Rust extensions, AI chat, and stunning visuals
5
5
  Author-email: Luis Fernandez de la Vara <luis@lefv.io>
6
6
  Maintainer-email: Luis Fernandez de la Vara <luis@lefv.io>
@@ -136,13 +136,24 @@ Requires-Dist: pytest>=8.4.1; extra == "dev"
136
136
  Requires-Dist: pytest-cov<5.0.0,>=4.1.0; extra == "dev"
137
137
  Requires-Dist: pytest-mock>=3.14.1; extra == "dev"
138
138
  Requires-Dist: pytest-asyncio>=1.1.0; extra == "dev"
139
+ Requires-Dist: pytest-benchmark>=4.0.0; extra == "dev"
140
+ Requires-Dist: pytest-timeout>=2.2.0; extra == "dev"
141
+ Requires-Dist: pytest-xdist>=3.5.0; extra == "dev"
142
+ Requires-Dist: hypothesis>=6.92.0; extra == "dev"
143
+ Requires-Dist: faker>=22.0.0; extra == "dev"
144
+ Requires-Dist: responses>=0.24.0; extra == "dev"
145
+ Requires-Dist: freezegun>=1.4.0; extra == "dev"
146
+ Requires-Dist: pytest-html>=4.1.0; extra == "dev"
147
+ Requires-Dist: pytest-json-report>=1.5.0; extra == "dev"
139
148
  Requires-Dist: black>=23.0.0; extra == "dev"
140
149
  Requires-Dist: isort<6.0.0,>=5.12.0; extra == "dev"
141
150
  Requires-Dist: mypy<2.0.0,>=1.7.1; extra == "dev"
151
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
152
+ Requires-Dist: pre-commit>=3.6.0; extra == "dev"
142
153
  Requires-Dist: build>=1.2.2.post1; extra == "dev"
143
154
  Requires-Dist: maturin>=1.9.3; extra == "dev"
155
+ Requires-Dist: twine>=4.0.0; extra == "dev"
144
156
  Provides-Extra: all
145
- Requires-Dist: mcli[async-extras,chat,dashboard,database,documents,gpu,ml,monitoring,streaming,video,viz,web]; extra == "all"
146
157
  Dynamic: license-file
147
158
 
148
159
  # MCLI
@@ -7,7 +7,7 @@ mcli/app/completion_helpers.py,sha256=PR66qgVNC5_st-CBiD4uuGfO3Zs7Y3QmJ2GJjpx5N6
7
7
  mcli/app/cron_test_cmd.py,sha256=Ai4Smg2WxULeiMD5s2m_S_fXdMAAQsKHpSc4iJGSnwI,26156
8
8
  mcli/app/logs_cmd.py,sha256=xkGjUiuV1a1-2j8rkffp0OwnG9nS39-i2jpCnKUn9f0,13777
9
9
  mcli/app/main.py,sha256=iA9HdqhBaOnOJ2--edLPD7iAatAzhIl5NAcNhw9qJAw,19010
10
- mcli/app/model_cmd.py,sha256=xJqD4xBLFqi3sBsgAeyXIC8n5SR3czl8wIWx8za31vA,11756
10
+ mcli/app/model_cmd.py,sha256=_8NBzf36u2tnUvc8ASQt88cdfBEonpXj3_16OEAf1cI,12842
11
11
  mcli/app/redis_cmd.py,sha256=Cl0LQ3Mqt27gLeb542_xw6bJBbIE-CBmWyMmaUTSk8c,9426
12
12
  mcli/app/visual_cmd.py,sha256=jXighahHxeM9HANQ2Brk6nKFgi2ZuQBOBH7PE5xhebk,9428
13
13
  mcli/app/model/model.py,sha256=EUGu_td-hRlbf4OElkdk1-0p7WyuG7sZmb-Ux2-J9KY,39061
@@ -81,7 +81,7 @@ mcli/ml/configs/dvc_config.py,sha256=LWOg4di1MpZED18YJznhYJwWsQ5i5k73RMxZT7-poHw
81
81
  mcli/ml/configs/mlflow_config.py,sha256=GvoBqxdBU6eIAghjPKqXz00n5j3Z8grdk0DFZwilIS8,4476
82
82
  mcli/ml/configs/mlops_manager.py,sha256=4CfqJnqLZjFl4Han3BAQ2ozOZmO8q47lWEnObn_Q5F4,9891
83
83
  mcli/ml/dashboard/app.py,sha256=GP_FgmR-4xQ7JoZeLygaA9_Li8T310AG9UJi3vxRpzs,15092
84
- mcli/ml/dashboard/app_integrated.py,sha256=6BjoV298c4jJ_Cs8syMQ35iG9pdP4uA-K_iTu_hTa6A,25610
84
+ mcli/ml/dashboard/app_integrated.py,sha256=3yAb_9Q0Fvd1_roCnzFZd7sHPG1TdP8TVKXbmDayR2I,27332
85
85
  mcli/ml/dashboard/app_supabase.py,sha256=E6zjJTcCpv8MCrQIZ4pgce4sxtLro7utfC9s2762QVA,19734
86
86
  mcli/ml/dashboard/app_training.py,sha256=XeU-fDj2MVzM5IM1ezCYJV5RF51oyvXy2_lppPAhSdw,19623
87
87
  mcli/ml/dashboard/cli.py,sha256=n4L732c9UoA9DUsiOEzaqBNs42vt1st-JP-UHuzc92I,1479
@@ -116,9 +116,11 @@ mcli/ml/preprocessing/test_preprocessing.py,sha256=TLBp24Y7YloIrUI2_KmyJhB6uw2iJ
116
116
  mcli/ml/scripts/populate_sample_data.py,sha256=GKbS1ISiYen45JCGxSEuYvHFiCNm4Rm-4jxGwJn9A8c,7633
117
117
  mcli/ml/tests/test_integration.py,sha256=gyH7gnghshD4z9zZKqs3uZTK7oZdgVF_Ujcbe6-b3Gw,15643
118
118
  mcli/ml/tests/test_training_dashboard.py,sha256=9P1JrUCei7YydSJR8L4OrVmEWm5-SAy3e6S3h87JplQ,13588
119
+ mcli/mygroup/test_cmd.py,sha256=PD0qoZ7GqagdQG9DaP7rIrGFenN23zVbYVYlZ0FJaSQ,16
119
120
  mcli/public/public.py,sha256=t9BkO1XV7s3YcoH0bbIpyjZ05UX_vBjaKtKkuDX7wZ0,114
120
121
  mcli/public/oi/oi.py,sha256=SQabQWQ1pE67pWYEHwIDc3R93DARJfB6VHk7qxWx9xo,308
121
122
  mcli/self/self_cmd.py,sha256=v6f5_Gm7CvBLJU_IZIDjC8Uz7nEExDfHnf1SOPgj7Gs,48458
123
+ mcli/self/test_cmd.py,sha256=PD0qoZ7GqagdQG9DaP7rIrGFenN23zVbYVYlZ0FJaSQ,16
122
124
  mcli/workflow/lsh_integration.py,sha256=khwmMPsdYdkmmLxlZi_UqUo2p0Nf-6GF6PPbtOrmoYQ,13290
123
125
  mcli/workflow/workflow.py,sha256=t58OVXmU9uQCJnyXuIbMAm8lihSzJ_jI10vXPNpZspk,928
124
126
  mcli/workflow/daemon/api_daemon.py,sha256=hA4Jolvb2C0T5_adKeI7BYE5wajfH9BFmk4bK1CmbE4,29000
@@ -179,9 +181,9 @@ mcli/workflow/sync/sync_cmd.py,sha256=S8TuZS_WAsdeD3_j8-XSAZFFrpynAwTWnCC0e6DCLh
179
181
  mcli/workflow/sync/test_cmd.py,sha256=neVgs9zEnKSxlvzDpFkuCGucqnzjrShm2OvJtHibslg,10009
180
182
  mcli/workflow/videos/videos.py,sha256=C47ViVv6qqqkSKQz6YXjzhok4UrqFbya8w5k_x7hToM,8360
181
183
  mcli/workflow/wakatime/wakatime.py,sha256=sEjsUKa3-XyE8Ni6sAb_D3GAY5jDcA30KknW9YTbLTA,142
182
- mcli_framework-7.0.6.dist-info/licenses/LICENSE,sha256=sahwAMfrJv2-V66HNPTp7A9UmMjxtyejwTZZoWQvEcI,1075
183
- mcli_framework-7.0.6.dist-info/METADATA,sha256=dOo-hFZkRTcnniOHoClyy-W3juTZgc6TsXsYEqgRFWo,14307
184
- mcli_framework-7.0.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
185
- mcli_framework-7.0.6.dist-info/entry_points.txt,sha256=dYrZbDIm-KUPsl1wfv600Kx_8sMy89phMkCihbDRgP8,261
186
- mcli_framework-7.0.6.dist-info/top_level.txt,sha256=_bnO8J2EUkliWivey_1le0UrnocFKmyVMQjbQ8iVXjc,5
187
- mcli_framework-7.0.6.dist-info/RECORD,,
184
+ mcli_framework-7.1.0.dist-info/licenses/LICENSE,sha256=sahwAMfrJv2-V66HNPTp7A9UmMjxtyejwTZZoWQvEcI,1075
185
+ mcli_framework-7.1.0.dist-info/METADATA,sha256=bCTcJVOlpyRNzR6Vmdmz_fyLnPWFPFshsvxTC06Xo1o,14775
186
+ mcli_framework-7.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
187
+ mcli_framework-7.1.0.dist-info/entry_points.txt,sha256=dYrZbDIm-KUPsl1wfv600Kx_8sMy89phMkCihbDRgP8,261
188
+ mcli_framework-7.1.0.dist-info/top_level.txt,sha256=_bnO8J2EUkliWivey_1le0UrnocFKmyVMQjbQ8iVXjc,5
189
+ mcli_framework-7.1.0.dist-info/RECORD,,