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
@@ -1,84 +1,29 @@
1
1
  import json
2
- from typing import Optional
3
2
 
4
3
  from mcli.lib.config import DEV_SECRETS_ROOT
5
4
  from mcli.lib.fs import get_absolute_path
6
5
  from mcli.lib.logger.logger import get_logger
7
6
 
8
- from .credential_manager import CredentialManager
7
+ from .credential_manager import CloudProviderManager
9
8
 
10
9
  logger = get_logger(__name__)
11
10
 
12
11
 
13
- class AwsManager(CredentialManager):
12
+ class AwsManager(CloudProviderManager):
14
13
  """
15
- Specialized credential manager for handling authentication tokens and environment URLs.
14
+ AWS credential manager for handling authentication tokens and storage credentials.
15
+ Inherits common token management from CloudProviderManager.
16
16
  """
17
17
 
18
- def __init__(self, app_name: str = "mcli"):
19
- """
20
- Initialize AwsManager with a specific configuration filename.
21
-
22
- Args:
23
- app_name (str, optional): Name of the application. Defaults to "mcli".
24
- """
25
- super().__init__(app_name, config_filename="mcli.token.config.json")
26
-
27
- def save_token(self, token: str):
18
+ @staticmethod
19
+ def persist_aws_storage_creds(access_key, secret_key):
28
20
  """
29
- Save authentication token to configuration.
21
+ Persist AWS storage credentials to file.
30
22
 
31
23
  Args:
32
- token (str): Authentication token to save.
33
-
34
- Raises:
35
- ValueError: If token is empty or not a string.
36
- """
37
- if not token or not isinstance(token, str):
38
- raise ValueError("Token must be a non-empty string")
39
-
40
- try:
41
- self.update_config("auth_token", token)
42
- except Exception as e:
43
- raise Exception(f"Failed to save token: {str(e)}")
44
-
45
- def get_token(self) -> Optional[str]:
24
+ access_key (str): AWS access key.
25
+ secret_key (str): AWS secret key.
46
26
  """
47
- Retrieve the stored authentication token.
48
-
49
- Returns:
50
- Optional[str]: Stored authentication token or None if not found.
51
- """
52
- try:
53
- logger.info("getting token")
54
- return self.get_config_value("auth_token")
55
- except Exception as e:
56
- logger.info(f"Warning: Error retrieving token: {str(e)}")
57
- return None
58
-
59
- def clear_token(self):
60
- """
61
- Clear the stored authentication token.
62
- Uses the base class clear_config method.
63
- """
64
- self.clear_config()
65
-
66
- def get_url(self) -> Optional[str]:
67
- """
68
- Retrieve environment URL from configuration.
69
-
70
- Returns:
71
- Optional[str]: Stored environment URL or None if not found.
72
- """
73
- try:
74
- logger.info("getting url")
75
- return self.get_config_value("env_url")
76
- except Exception as e:
77
- logger.info(f"Warning: Error retrieving environment URL: {str(e)}")
78
- return None
79
-
80
- @staticmethod
81
- def persist_aws_storage_creds(access_key, secret_key):
82
27
  filepath = get_absolute_path(DEV_SECRETS_ROOT + "aws/aws.json")
83
28
  with open(filepath, "w") as f:
84
29
  json.dump({"access_key": access_key, "secret_key": secret_key}, f)
@@ -1,84 +1,29 @@
1
1
  import json
2
- from typing import Optional
3
2
 
4
3
  from mcli.lib.config import DEV_SECRETS_ROOT
5
4
  from mcli.lib.fs import get_absolute_path
6
5
  from mcli.lib.logger.logger import get_logger
7
6
 
8
- from .credential_manager import CredentialManager
7
+ from .credential_manager import CloudProviderManager
9
8
 
10
9
  logger = get_logger(__name__)
11
10
 
12
11
 
13
- class AzureManager(CredentialManager):
12
+ class AzureManager(CloudProviderManager):
14
13
  """
15
- Specialized credential manager for handling authentication tokens and environment URLs.
14
+ Azure credential manager for handling authentication tokens and storage credentials.
15
+ Inherits common token management from CloudProviderManager.
16
16
  """
17
17
 
18
- def __init__(self, app_name: str = "mcli"):
19
- """
20
- Initialize GcpManager with a specific configuration filename.
21
-
22
- Args:
23
- app_name (str, optional): Name of the application. Defaults to "mcli".
24
- """
25
- super().__init__(app_name, config_filename="mcli.token.config.json")
26
-
27
- def save_token(self, token: str):
18
+ @staticmethod
19
+ def persist_azure_storage_creds(account_name, access_key):
28
20
  """
29
- Save authentication token to configuration.
21
+ Persist Azure storage credentials to file.
30
22
 
31
23
  Args:
32
- token (str): Authentication token to save.
33
-
34
- Raises:
35
- ValueError: If token is empty or not a string.
36
- """
37
- if not token or not isinstance(token, str):
38
- raise ValueError("Token must be a non-empty string")
39
-
40
- try:
41
- self.update_config("auth_token", token)
42
- except Exception as e:
43
- raise Exception(f"Failed to save token: {str(e)}")
44
-
45
- def get_token(self) -> Optional[str]:
24
+ account_name (str): Azure storage account name.
25
+ access_key (str): Azure storage access key.
46
26
  """
47
- Retrieve the stored authentication token.
48
-
49
- Returns:
50
- Optional[str]: Stored authentication token or None if not found.
51
- """
52
- try:
53
- logger.info("getting token")
54
- return self.get_config_value("auth_token")
55
- except Exception as e:
56
- logger.info(f"Warning: Error retrieving token: {str(e)}")
57
- return None
58
-
59
- def clear_token(self):
60
- """
61
- Clear the stored authentication token.
62
- Uses the base class clear_config method.
63
- """
64
- self.clear_config()
65
-
66
- def get_url(self) -> Optional[str]:
67
- """
68
- Retrieve environment URL from configuration.
69
-
70
- Returns:
71
- Optional[str]: Stored environment URL or None if not found.
72
- """
73
- try:
74
- logger.info("getting url")
75
- return self.get_config_value("env_url")
76
- except Exception as e:
77
- logger.info(f"Warning: Error retrieving environment URL: {str(e)}")
78
- return None
79
-
80
- @staticmethod
81
- def persist_azure_storage_creds(account_name, access_key):
82
27
  filepath = get_absolute_path(DEV_SECRETS_ROOT + "azure/azure.json")
83
28
  with open(filepath, "w") as f:
84
29
  json.dump(
@@ -189,4 +189,73 @@ class CredentialManager:
189
189
  return key_b64
190
190
 
191
191
 
192
- __all__ = ["CredentialManager"]
192
+ class CloudProviderManager(CredentialManager):
193
+ """
194
+ Abstract base class for cloud provider credential managers.
195
+ Provides common token and URL management functionality for AWS, GCP, and Azure.
196
+ """
197
+
198
+ def __init__(self, app_name: str = "mcli"):
199
+ """
200
+ Initialize CloudProviderManager with token configuration filename.
201
+
202
+ Args:
203
+ app_name (str, optional): Name of the application. Defaults to "mcli".
204
+ """
205
+ super().__init__(app_name, config_filename="mcli.token.config.json")
206
+
207
+ def save_token(self, token: str):
208
+ """
209
+ Save authentication token to configuration.
210
+
211
+ Args:
212
+ token (str): Authentication token to save.
213
+
214
+ Raises:
215
+ ValueError: If token is empty or not a string.
216
+ """
217
+ if not token or not isinstance(token, str):
218
+ raise ValueError("Token must be a non-empty string")
219
+
220
+ try:
221
+ self.update_config("auth_token", token)
222
+ except Exception as e:
223
+ raise Exception(f"Failed to save token: {str(e)}")
224
+
225
+ def get_token(self) -> Optional[str]:
226
+ """
227
+ Retrieve the stored authentication token.
228
+
229
+ Returns:
230
+ Optional[str]: Stored authentication token or None if not found.
231
+ """
232
+ try:
233
+ logger.info("getting token")
234
+ return self.get_config_value("auth_token")
235
+ except Exception as e:
236
+ logger.info(f"Warning: Error retrieving token: {str(e)}")
237
+ return None
238
+
239
+ def clear_token(self):
240
+ """
241
+ Clear the stored authentication token.
242
+ Uses the base class clear_config method.
243
+ """
244
+ self.clear_config()
245
+
246
+ def get_url(self) -> Optional[str]:
247
+ """
248
+ Retrieve environment URL from configuration.
249
+
250
+ Returns:
251
+ Optional[str]: Stored environment URL or None if not found.
252
+ """
253
+ try:
254
+ logger.info("getting url")
255
+ return self.get_config_value("env_url")
256
+ except Exception as e:
257
+ logger.info(f"Warning: Error retrieving environment URL: {str(e)}")
258
+ return None
259
+
260
+
261
+ __all__ = ["CredentialManager", "CloudProviderManager"]
@@ -1,84 +1,31 @@
1
1
  import json
2
- from typing import Optional
3
2
 
4
3
  from mcli.lib.config import DEV_SECRETS_ROOT
5
4
  from mcli.lib.fs import get_absolute_path
6
5
  from mcli.lib.logger.logger import get_logger
7
6
 
8
- from .credential_manager import CredentialManager
7
+ from .credential_manager import CloudProviderManager
9
8
 
10
9
  logger = get_logger(__name__)
11
10
 
12
11
 
13
- class GcpManager(CredentialManager):
12
+ class GcpManager(CloudProviderManager):
14
13
  """
15
- Specialized credential manager for handling authentication tokens and environment URLs.
14
+ GCP credential manager for handling authentication tokens and storage credentials.
15
+ Inherits common token management from CloudProviderManager.
16
16
  """
17
17
 
18
- def __init__(self, app_name: str = "mcli"):
19
- """
20
- Initialize GcpManager with a specific configuration filename.
21
-
22
- Args:
23
- app_name (str, optional): Name of the application. Defaults to "mcli".
24
- """
25
- super().__init__(app_name, config_filename="mcli.token.config.json")
26
-
27
- def save_token(self, token: str):
18
+ @staticmethod
19
+ def persist_gcp_storage_creds(account_id, account_email, access_key, secret_key):
28
20
  """
29
- Save authentication token to configuration.
21
+ Persist GCP storage credentials to file.
30
22
 
31
23
  Args:
32
- token (str): Authentication token to save.
33
-
34
- Raises:
35
- ValueError: If token is empty or not a string.
36
- """
37
- if not token or not isinstance(token, str):
38
- raise ValueError("Token must be a non-empty string")
39
-
40
- try:
41
- self.update_config("auth_token", token)
42
- except Exception as e:
43
- raise Exception(f"Failed to save token: {str(e)}")
44
-
45
- def get_token(self) -> Optional[str]:
24
+ account_id (str): GCP account ID.
25
+ account_email (str): GCP account email.
26
+ access_key (str): GCP access key.
27
+ secret_key (str): GCP secret key.
46
28
  """
47
- Retrieve the stored authentication token.
48
-
49
- Returns:
50
- Optional[str]: Stored authentication token or None if not found.
51
- """
52
- try:
53
- logger.info("getting token")
54
- return self.get_config_value("auth_token")
55
- except Exception as e:
56
- logger.info(f"Warning: Error retrieving token: {str(e)}")
57
- return None
58
-
59
- def clear_token(self):
60
- """
61
- Clear the stored authentication token.
62
- Uses the base class clear_config method.
63
- """
64
- self.clear_config()
65
-
66
- def get_url(self) -> Optional[str]:
67
- """
68
- Retrieve environment URL from configuration.
69
-
70
- Returns:
71
- Optional[str]: Stored environment URL or None if not found.
72
- """
73
- try:
74
- logger.info("getting url")
75
- return self.get_config_value("env_url")
76
- except Exception as e:
77
- logger.info(f"Warning: Error retrieving environment URL: {str(e)}")
78
- return None
79
-
80
- @staticmethod
81
- def persist_gcp_storage_creds(account_id, account_email, access_key, secret_key):
82
29
  filepath = get_absolute_path(DEV_SECRETS_ROOT + "gcp/gcp.json")
83
30
  with open(filepath, "w") as f:
84
31
  json.dump(
mcli/ml/dashboard/app.py CHANGED
@@ -25,47 +25,14 @@ from mcli.ml.database.models import (
25
25
  User,
26
26
  )
27
27
  from mcli.ml.database.session import SessionLocal
28
+ from mcli.ml.dashboard.common import setup_page_config
29
+ from mcli.ml.dashboard.styles import apply_dashboard_styles
28
30
 
29
- # Page config
30
- st.set_page_config(
31
- page_title="MCLI ML Dashboard", page_icon="📊", layout="wide", initial_sidebar_state="expanded"
32
- )
31
+ # Page config - must be first
32
+ setup_page_config(page_title="MCLI ML Dashboard")
33
33
 
34
- # Custom CSS
35
- st.markdown(
36
- """
37
- <style>
38
- .metric-card {
39
- background-color: #f0f2f6;
40
- padding: 1rem;
41
- border-radius: 0.5rem;
42
- border-left: 4px solid #1f77b4;
43
- }
44
- .alert-success {
45
- background-color: #d4edda;
46
- border: 1px solid #c3e6cb;
47
- color: #155724;
48
- padding: 0.75rem;
49
- border-radius: 0.25rem;
50
- }
51
- .alert-warning {
52
- background-color: #fff3cd;
53
- border: 1px solid #ffeaa7;
54
- color: #856404;
55
- padding: 0.75rem;
56
- border-radius: 0.25rem;
57
- }
58
- .alert-danger {
59
- background-color: #f8d7da;
60
- border: 1px solid #f5c6cb;
61
- color: #721c24;
62
- padding: 0.75rem;
63
- border-radius: 0.25rem;
64
- }
65
- </style>
66
- """,
67
- unsafe_allow_html=True,
68
- )
34
+ # Apply standard dashboard styles
35
+ apply_dashboard_styles()
69
36
 
70
37
 
71
38
  @st.cache_data(ttl=30)