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

Files changed (114) hide show
  1. mcli/__init__.py +160 -0
  2. mcli/__main__.py +14 -0
  3. mcli/app/__init__.py +23 -0
  4. mcli/app/main.py +10 -0
  5. mcli/app/model/__init__.py +0 -0
  6. mcli/app/video/__init__.py +5 -0
  7. mcli/chat/__init__.py +34 -0
  8. mcli/lib/__init__.py +0 -0
  9. mcli/lib/api/__init__.py +0 -0
  10. mcli/lib/auth/__init__.py +1 -0
  11. mcli/lib/config/__init__.py +1 -0
  12. mcli/lib/custom_commands.py +424 -0
  13. mcli/lib/erd/__init__.py +25 -0
  14. mcli/lib/files/__init__.py +0 -0
  15. mcli/lib/fs/__init__.py +1 -0
  16. mcli/lib/logger/__init__.py +3 -0
  17. mcli/lib/paths.py +12 -0
  18. mcli/lib/performance/__init__.py +17 -0
  19. mcli/lib/pickles/__init__.py +1 -0
  20. mcli/lib/shell/__init__.py +0 -0
  21. mcli/lib/toml/__init__.py +1 -0
  22. mcli/lib/watcher/__init__.py +0 -0
  23. mcli/ml/__init__.py +16 -0
  24. mcli/ml/api/__init__.py +30 -0
  25. mcli/ml/api/routers/__init__.py +27 -0
  26. mcli/ml/api/schemas.py +2 -2
  27. mcli/ml/auth/__init__.py +45 -0
  28. mcli/ml/auth/models.py +2 -2
  29. mcli/ml/backtesting/__init__.py +39 -0
  30. mcli/ml/cli/__init__.py +5 -0
  31. mcli/ml/cli/main.py +1 -1
  32. mcli/ml/config/__init__.py +33 -0
  33. mcli/ml/configs/__init__.py +16 -0
  34. mcli/ml/dashboard/__init__.py +12 -0
  35. mcli/ml/dashboard/app.py +13 -13
  36. mcli/ml/dashboard/app_integrated.py +1309 -148
  37. mcli/ml/dashboard/app_supabase.py +46 -21
  38. mcli/ml/dashboard/app_training.py +14 -14
  39. mcli/ml/dashboard/components/__init__.py +7 -0
  40. mcli/ml/dashboard/components/charts.py +258 -0
  41. mcli/ml/dashboard/components/metrics.py +125 -0
  42. mcli/ml/dashboard/components/tables.py +228 -0
  43. mcli/ml/dashboard/pages/__init__.py +6 -0
  44. mcli/ml/dashboard/pages/cicd.py +382 -0
  45. mcli/ml/dashboard/pages/predictions_enhanced.py +834 -0
  46. mcli/ml/dashboard/pages/scrapers_and_logs.py +1060 -0
  47. mcli/ml/dashboard/pages/test_portfolio.py +373 -0
  48. mcli/ml/dashboard/pages/trading.py +714 -0
  49. mcli/ml/dashboard/pages/workflows.py +533 -0
  50. mcli/ml/dashboard/utils.py +154 -0
  51. mcli/ml/data_ingestion/__init__.py +39 -0
  52. mcli/ml/database/__init__.py +47 -0
  53. mcli/ml/experimentation/__init__.py +29 -0
  54. mcli/ml/features/__init__.py +39 -0
  55. mcli/ml/mlops/__init__.py +33 -0
  56. mcli/ml/models/__init__.py +94 -0
  57. mcli/ml/monitoring/__init__.py +25 -0
  58. mcli/ml/optimization/__init__.py +27 -0
  59. mcli/ml/predictions/__init__.py +5 -0
  60. mcli/ml/preprocessing/__init__.py +28 -0
  61. mcli/ml/scripts/__init__.py +1 -0
  62. mcli/ml/trading/__init__.py +60 -0
  63. mcli/ml/trading/alpaca_client.py +353 -0
  64. mcli/ml/trading/migrations.py +164 -0
  65. mcli/ml/trading/models.py +418 -0
  66. mcli/ml/trading/paper_trading.py +326 -0
  67. mcli/ml/trading/risk_management.py +370 -0
  68. mcli/ml/trading/trading_service.py +480 -0
  69. mcli/ml/training/__init__.py +10 -0
  70. mcli/ml/training/train_model.py +569 -0
  71. mcli/mygroup/__init__.py +3 -0
  72. mcli/public/__init__.py +1 -0
  73. mcli/public/commands/__init__.py +2 -0
  74. mcli/self/__init__.py +3 -0
  75. mcli/self/self_cmd.py +579 -91
  76. mcli/workflow/__init__.py +0 -0
  77. mcli/workflow/daemon/__init__.py +15 -0
  78. mcli/workflow/daemon/daemon.py +21 -3
  79. mcli/workflow/dashboard/__init__.py +5 -0
  80. mcli/workflow/docker/__init__.py +0 -0
  81. mcli/workflow/file/__init__.py +0 -0
  82. mcli/workflow/gcloud/__init__.py +1 -0
  83. mcli/workflow/git_commit/__init__.py +0 -0
  84. mcli/workflow/interview/__init__.py +0 -0
  85. mcli/workflow/politician_trading/__init__.py +4 -0
  86. mcli/workflow/politician_trading/data_sources.py +259 -1
  87. mcli/workflow/politician_trading/models.py +159 -1
  88. mcli/workflow/politician_trading/scrapers_corporate_registry.py +846 -0
  89. mcli/workflow/politician_trading/scrapers_free_sources.py +516 -0
  90. mcli/workflow/politician_trading/scrapers_third_party.py +391 -0
  91. mcli/workflow/politician_trading/seed_database.py +539 -0
  92. mcli/workflow/registry/__init__.py +0 -0
  93. mcli/workflow/repo/__init__.py +0 -0
  94. mcli/workflow/scheduler/__init__.py +25 -0
  95. mcli/workflow/search/__init__.py +0 -0
  96. mcli/workflow/sync/__init__.py +5 -0
  97. mcli/workflow/videos/__init__.py +1 -0
  98. mcli/workflow/wakatime/__init__.py +80 -0
  99. mcli/workflow/workflow.py +8 -27
  100. {mcli_framework-7.1.3.dist-info → mcli_framework-7.3.1.dist-info}/METADATA +3 -1
  101. {mcli_framework-7.1.3.dist-info → mcli_framework-7.3.1.dist-info}/RECORD +105 -29
  102. mcli/workflow/daemon/api_daemon.py +0 -800
  103. mcli/workflow/daemon/commands.py +0 -1196
  104. mcli/workflow/dashboard/dashboard_cmd.py +0 -120
  105. mcli/workflow/file/file.py +0 -100
  106. mcli/workflow/git_commit/commands.py +0 -430
  107. mcli/workflow/politician_trading/commands.py +0 -1939
  108. mcli/workflow/scheduler/commands.py +0 -493
  109. mcli/workflow/sync/sync_cmd.py +0 -437
  110. mcli/workflow/videos/videos.py +0 -242
  111. {mcli_framework-7.1.3.dist-info → mcli_framework-7.3.1.dist-info}/WHEEL +0 -0
  112. {mcli_framework-7.1.3.dist-info → mcli_framework-7.3.1.dist-info}/entry_points.txt +0 -0
  113. {mcli_framework-7.1.3.dist-info → mcli_framework-7.3.1.dist-info}/licenses/LICENSE +0 -0
  114. {mcli_framework-7.1.3.dist-info → mcli_framework-7.3.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,25 @@
1
+ """
2
+ Entity Relationship Diagram (ERD) package.
3
+
4
+ This package provides utilities for generating Entity Relationship Diagrams from MCLI type metadata.
5
+ """
6
+
7
+ # Import and export all public functions from erd.py
8
+ from .erd import (
9
+ analyze_graph_for_hierarchical_exports,
10
+ create_merged_erd,
11
+ do_erd,
12
+ find_top_nodes_in_graph,
13
+ generate_erd_for_top_nodes,
14
+ generate_merged_erd_for_types,
15
+ )
16
+
17
+ # Define __all__ to control exports
18
+ __all__ = [
19
+ "do_erd",
20
+ "create_merged_erd",
21
+ "generate_merged_erd_for_types",
22
+ "find_top_nodes_in_graph",
23
+ "generate_erd_for_top_nodes",
24
+ "analyze_graph_for_hierarchical_exports",
25
+ ]
File without changes
@@ -0,0 +1 @@
1
+ from .fs import *
@@ -0,0 +1,3 @@
1
+ from .logger import get_logger
2
+
3
+ __all__ = ["get_logger"]
mcli/lib/paths.py CHANGED
@@ -80,3 +80,15 @@ def get_cache_dir() -> Path:
80
80
  cache_dir = get_mcli_home() / "cache"
81
81
  cache_dir.mkdir(parents=True, exist_ok=True)
82
82
  return cache_dir
83
+
84
+
85
+ def get_custom_commands_dir() -> Path:
86
+ """
87
+ Get the custom commands directory for mcli.
88
+
89
+ Returns:
90
+ Path to custom commands directory (e.g., ~/.mcli/commands), created if it doesn't exist
91
+ """
92
+ commands_dir = get_mcli_home() / "commands"
93
+ commands_dir.mkdir(parents=True, exist_ok=True)
94
+ return commands_dir
@@ -0,0 +1,17 @@
1
+ """
2
+ Performance optimization utilities for mcli
3
+ """
4
+
5
+ from .uvloop_config import (
6
+ configure_event_loop_for_performance,
7
+ get_event_loop_info,
8
+ install_uvloop,
9
+ should_use_uvloop,
10
+ )
11
+
12
+ __all__ = [
13
+ "install_uvloop",
14
+ "should_use_uvloop",
15
+ "get_event_loop_info",
16
+ "configure_event_loop_for_performance",
17
+ ]
@@ -0,0 +1 @@
1
+ from .pickles import ObjectCache
File without changes
@@ -0,0 +1 @@
1
+ from .toml import read_from_toml
File without changes
mcli/ml/__init__.py ADDED
@@ -0,0 +1,16 @@
1
+ """MCLI Machine Learning Module for Stock Recommendation System"""
2
+
3
+ from .configs.dvc_config import get_dvc_config, setup_dvc
4
+ from .configs.mlflow_config import get_mlflow_config, setup_mlflow
5
+ from .configs.mlops_manager import MLOpsManager, get_mlops_manager
6
+
7
+ __version__ = "0.1.0"
8
+
9
+ __all__ = [
10
+ "get_mlops_manager",
11
+ "MLOpsManager",
12
+ "get_mlflow_config",
13
+ "setup_mlflow",
14
+ "get_dvc_config",
15
+ "setup_dvc",
16
+ ]
@@ -0,0 +1,30 @@
1
+ """API routes and endpoints for ML system"""
2
+
3
+ from .app import create_app, get_application
4
+ from .routers import (
5
+ admin_router,
6
+ auth_router,
7
+ backtest_router,
8
+ data_router,
9
+ model_router,
10
+ monitoring_router,
11
+ portfolio_router,
12
+ prediction_router,
13
+ trade_router,
14
+ websocket_router,
15
+ )
16
+
17
+ __all__ = [
18
+ "auth_router",
19
+ "model_router",
20
+ "prediction_router",
21
+ "portfolio_router",
22
+ "data_router",
23
+ "trade_router",
24
+ "backtest_router",
25
+ "monitoring_router",
26
+ "admin_router",
27
+ "websocket_router",
28
+ "create_app",
29
+ "get_application",
30
+ ]
@@ -0,0 +1,27 @@
1
+ """API routers"""
2
+
3
+ from . import (
4
+ admin_router,
5
+ auth_router,
6
+ backtest_router,
7
+ data_router,
8
+ model_router,
9
+ monitoring_router,
10
+ portfolio_router,
11
+ prediction_router,
12
+ trade_router,
13
+ websocket_router,
14
+ )
15
+
16
+ __all__ = [
17
+ "auth_router",
18
+ "model_router",
19
+ "prediction_router",
20
+ "portfolio_router",
21
+ "data_router",
22
+ "trade_router",
23
+ "backtest_router",
24
+ "monitoring_router",
25
+ "admin_router",
26
+ "websocket_router",
27
+ ]
mcli/ml/api/schemas.py CHANGED
@@ -32,7 +32,7 @@ class ModelResponse(BaseModel):
32
32
  updated_at: datetime
33
33
 
34
34
  class Config:
35
- orm_mode = True
35
+ from_attributes = True
36
36
 
37
37
 
38
38
  class ModelMetrics(BaseModel):
@@ -69,4 +69,4 @@ class PredictionResponse(BaseModel):
69
69
  model_name: str
70
70
 
71
71
  class Config:
72
- orm_mode = True
72
+ from_attributes = True
@@ -0,0 +1,45 @@
1
+ """Authentication and authorization system"""
2
+
3
+ from .auth_manager import (
4
+ AuthManager,
5
+ create_access_token,
6
+ get_current_active_user,
7
+ get_current_user,
8
+ hash_password,
9
+ require_role,
10
+ verify_access_token,
11
+ verify_password,
12
+ )
13
+ from .models import (
14
+ PasswordChange,
15
+ PasswordReset,
16
+ TokenResponse,
17
+ UserCreate,
18
+ UserLogin,
19
+ UserResponse,
20
+ )
21
+ from .permissions import (
22
+ Permission,
23
+ check_permission,
24
+ has_permission,
25
+ )
26
+
27
+ __all__ = [
28
+ "AuthManager",
29
+ "create_access_token",
30
+ "verify_access_token",
31
+ "get_current_user",
32
+ "get_current_active_user",
33
+ "require_role",
34
+ "hash_password",
35
+ "verify_password",
36
+ "UserCreate",
37
+ "UserLogin",
38
+ "UserResponse",
39
+ "TokenResponse",
40
+ "PasswordReset",
41
+ "PasswordChange",
42
+ "Permission",
43
+ "check_permission",
44
+ "has_permission",
45
+ ]
mcli/ml/auth/models.py CHANGED
@@ -10,7 +10,7 @@ from pydantic import BaseModel, EmailStr, Field, validator
10
10
  class UserCreate(BaseModel):
11
11
  """User registration model"""
12
12
 
13
- username: str = Field(..., min_length=3, max_length=50, regex="^[a-zA-Z0-9_-]+$")
13
+ username: str = Field(..., min_length=3, max_length=50, pattern="^[a-zA-Z0-9_-]+$")
14
14
  email: EmailStr
15
15
  password: str = Field(..., min_length=8, max_length=100)
16
16
  first_name: Optional[str] = Field(None, max_length=50)
@@ -52,7 +52,7 @@ class UserResponse(BaseModel):
52
52
  last_login_at: Optional[datetime]
53
53
 
54
54
  class Config:
55
- orm_mode = True
55
+ from_attributes = True
56
56
 
57
57
 
58
58
  class TokenResponse(BaseModel):
@@ -0,0 +1,39 @@
1
+ """Backtesting framework for trading strategies"""
2
+
3
+ from .backtest_engine import (
4
+ BacktestConfig,
5
+ BacktestEngine,
6
+ BacktestResult,
7
+ PositionManager,
8
+ TradingStrategy,
9
+ )
10
+ from .performance_metrics import (
11
+ PerformanceAnalyzer,
12
+ PortfolioMetrics,
13
+ RiskMetrics,
14
+ plot_performance,
15
+ )
16
+ from .trading_simulator import (
17
+ MarketSimulator,
18
+ Order,
19
+ Portfolio,
20
+ Position,
21
+ TradingSimulator,
22
+ )
23
+
24
+ __all__ = [
25
+ "BacktestEngine",
26
+ "BacktestConfig",
27
+ "BacktestResult",
28
+ "TradingStrategy",
29
+ "PositionManager",
30
+ "PerformanceAnalyzer",
31
+ "PortfolioMetrics",
32
+ "RiskMetrics",
33
+ "plot_performance",
34
+ "TradingSimulator",
35
+ "Order",
36
+ "Position",
37
+ "Portfolio",
38
+ "MarketSimulator",
39
+ ]
@@ -0,0 +1,5 @@
1
+ """CLI interface for ML system"""
2
+
3
+ from .main import app
4
+
5
+ __all__ = ["app"]
mcli/ml/cli/main.py CHANGED
@@ -377,6 +377,7 @@ def config(
377
377
  debug: Optional[bool] = typer.Option(None, "--debug", help="Set debug mode"),
378
378
  ):
379
379
  """Manage system configuration"""
380
+ global settings
380
381
 
381
382
  if show:
382
383
  console.print(f"[bold blue]Current Configuration[/bold blue]")
@@ -399,7 +400,6 @@ def config(
399
400
  raise typer.Exit(1)
400
401
 
401
402
  # Update environment
402
- global settings
403
403
  settings = create_settings(environment)
404
404
  console.print(f"[green]✓ Environment set to: {environment}[/green]")
405
405
 
@@ -0,0 +1,33 @@
1
+ """Configuration management for ML system"""
2
+
3
+ from .settings import (
4
+ APISettings,
5
+ DatabaseSettings,
6
+ DataSettings,
7
+ MLflowSettings,
8
+ ModelSettings,
9
+ MonitoringSettings,
10
+ RedisSettings,
11
+ SecuritySettings,
12
+ Settings,
13
+ create_settings,
14
+ get_settings,
15
+ settings,
16
+ update_settings,
17
+ )
18
+
19
+ __all__ = [
20
+ "Settings",
21
+ "DatabaseSettings",
22
+ "RedisSettings",
23
+ "MLflowSettings",
24
+ "ModelSettings",
25
+ "DataSettings",
26
+ "APISettings",
27
+ "MonitoringSettings",
28
+ "SecuritySettings",
29
+ "settings",
30
+ "get_settings",
31
+ "update_settings",
32
+ "create_settings",
33
+ ]
@@ -0,0 +1,16 @@
1
+ """ML Configuration Module"""
2
+
3
+ from .dvc_config import DVCConfig, get_dvc_config, setup_dvc
4
+ from .mlflow_config import MLflowConfig, get_mlflow_config, setup_mlflow
5
+ from .mlops_manager import MLOpsManager, get_mlops_manager
6
+
7
+ __all__ = [
8
+ "MLflowConfig",
9
+ "get_mlflow_config",
10
+ "setup_mlflow",
11
+ "DVCConfig",
12
+ "get_dvc_config",
13
+ "setup_dvc",
14
+ "MLOpsManager",
15
+ "get_mlops_manager",
16
+ ]
@@ -0,0 +1,12 @@
1
+ """ML Dashboard for real-time monitoring"""
2
+
3
+ from .app import main
4
+ from .cli import app as cli_app
5
+
6
+
7
+ def main():
8
+ """Main entry point for dashboard CLI"""
9
+ cli_app()
10
+
11
+
12
+ __all__ = ["main", "cli_app"]
mcli/ml/dashboard/app.py CHANGED
@@ -283,7 +283,7 @@ def show_overview():
283
283
  model_data = get_model_performance()
284
284
  if not model_data.empty:
285
285
  fig = px.bar(model_data, x="name", y="accuracy", title="Model Accuracy Comparison")
286
- st.plotly_chart(fig, use_container_width=True)
286
+ st.plotly_chart(fig, width="stretch", config={"responsive": True})
287
287
  else:
288
288
  st.info("No model performance data available")
289
289
 
@@ -295,7 +295,7 @@ def show_overview():
295
295
  fig = px.histogram(
296
296
  pred_data, x="confidence", title="Prediction Confidence Distribution"
297
297
  )
298
- st.plotly_chart(fig, use_container_width=True)
298
+ st.plotly_chart(fig, width="stretch", config={"responsive": True})
299
299
  else:
300
300
  st.info("No recent predictions available")
301
301
 
@@ -309,13 +309,13 @@ def show_models():
309
309
 
310
310
  if not model_data.empty:
311
311
  st.subheader("Model Performance")
312
- st.dataframe(model_data, use_container_width=True)
312
+ st.dataframe(model_data, width="stretch")
313
313
 
314
314
  # Model accuracy chart
315
315
  fig = px.line(
316
316
  model_data, x="created_at", y="accuracy", color="name", title="Model Accuracy Over Time"
317
317
  )
318
- st.plotly_chart(fig, use_container_width=True)
318
+ st.plotly_chart(fig, width="stretch", config={"responsive": True})
319
319
  else:
320
320
  st.warning("No model data available")
321
321
 
@@ -349,7 +349,7 @@ def show_predictions():
349
349
 
350
350
  # Display filtered data
351
351
  st.subheader("Filtered Predictions")
352
- st.dataframe(filtered_data, use_container_width=True)
352
+ st.dataframe(filtered_data, width="stretch")
353
353
 
354
354
  # Charts
355
355
  col1, col2 = st.columns(2)
@@ -362,7 +362,7 @@ def show_predictions():
362
362
  color="ticker",
363
363
  title="Confidence vs Predicted Return",
364
364
  )
365
- st.plotly_chart(fig, use_container_width=True)
365
+ st.plotly_chart(fig, width="stretch", config={"responsive": True})
366
366
 
367
367
  with col2:
368
368
  # Group by ticker and show average return
@@ -373,7 +373,7 @@ def show_predictions():
373
373
  y="predicted_return",
374
374
  title="Average Predicted Return by Ticker",
375
375
  )
376
- st.plotly_chart(fig, use_container_width=True)
376
+ st.plotly_chart(fig, width="stretch", config={"responsive": True})
377
377
 
378
378
  else:
379
379
  st.warning("No prediction data available")
@@ -388,7 +388,7 @@ def show_portfolios():
388
388
  if not portfolio_data.empty:
389
389
  # Portfolio metrics
390
390
  st.subheader("Portfolio Summary")
391
- st.dataframe(portfolio_data, use_container_width=True)
391
+ st.dataframe(portfolio_data, width="stretch")
392
392
 
393
393
  # Performance charts
394
394
  col1, col2 = st.columns(2)
@@ -397,7 +397,7 @@ def show_portfolios():
397
397
  fig = px.bar(
398
398
  portfolio_data, x="name", y="total_return", title="Total Return by Portfolio"
399
399
  )
400
- st.plotly_chart(fig, use_container_width=True)
400
+ st.plotly_chart(fig, width="stretch", config={"responsive": True})
401
401
 
402
402
  with col2:
403
403
  fig = px.scatter(
@@ -408,7 +408,7 @@ def show_portfolios():
408
408
  hover_data=["name"],
409
409
  title="Risk-Return Analysis",
410
410
  )
411
- st.plotly_chart(fig, use_container_width=True)
411
+ st.plotly_chart(fig, width="stretch", config={"responsive": True})
412
412
 
413
413
  else:
414
414
  st.warning("No portfolio data available")
@@ -467,7 +467,7 @@ def show_system_health():
467
467
  )
468
468
 
469
469
  fig.update_layout(height=500, title_text="System Resource Usage (24h)")
470
- st.plotly_chart(fig, use_container_width=True)
470
+ st.plotly_chart(fig, width="stretch", config={"responsive": True})
471
471
 
472
472
 
473
473
  def show_live_monitoring():
@@ -509,13 +509,13 @@ def show_live_monitoring():
509
509
  "Time": [datetime.now() - timedelta(seconds=x * 10) for x in range(5)],
510
510
  }
511
511
  )
512
- st.dataframe(new_preds, use_container_width=True)
512
+ st.dataframe(new_preds, width="stretch")
513
513
 
514
514
  # Model status
515
515
  with model_placeholder.container():
516
516
  model_data = get_model_performance()
517
517
  if not model_data.empty:
518
- st.dataframe(model_data[["name", "accuracy"]], use_container_width=True)
518
+ st.dataframe(model_data[["name", "accuracy"]], width="stretch")
519
519
 
520
520
  time.sleep(5)
521
521