mcli-framework 7.10.2__py3-none-any.whl → 7.11.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 +150 -58
- mcli/app/main.py +21 -27
- 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/custom_commands.py +52 -12
- 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/paths.py +129 -5
- mcli/lib/performance/__init__.py +17 -0
- mcli/lib/pickles/__init__.py +1 -0
- mcli/lib/secrets/__init__.py +10 -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/auth/__init__.py +41 -0
- mcli/ml/backtesting/__init__.py +33 -0
- mcli/ml/cli/__init__.py +5 -0
- mcli/ml/config/__init__.py +33 -0
- mcli/ml/configs/__init__.py +16 -0
- mcli/ml/dashboard/__init__.py +12 -0
- mcli/ml/dashboard/components/__init__.py +7 -0
- mcli/ml/dashboard/pages/__init__.py +6 -0
- mcli/ml/data_ingestion/__init__.py +29 -0
- mcli/ml/database/__init__.py +40 -0
- mcli/ml/experimentation/__init__.py +29 -0
- mcli/ml/features/__init__.py +39 -0
- mcli/ml/mlops/__init__.py +19 -0
- mcli/ml/models/__init__.py +90 -0
- mcli/ml/monitoring/__init__.py +25 -0
- mcli/ml/optimization/__init__.py +27 -0
- mcli/ml/predictions/__init__.py +5 -0
- mcli/ml/preprocessing/__init__.py +24 -0
- mcli/ml/scripts/__init__.py +1 -0
- mcli/ml/serving/__init__.py +1 -0
- mcli/ml/trading/__init__.py +63 -0
- mcli/ml/training/__init__.py +7 -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/migrate_cmd.py +261 -0
- mcli/self/self_cmd.py +8 -0
- mcli/workflow/__init__.py +0 -0
- mcli/workflow/daemon/__init__.py +15 -0
- 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/notebook/__init__.py +16 -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/secrets/__init__.py +4 -0
- mcli/workflow/secrets/secrets_cmd.py +192 -0
- mcli/workflow/sync/__init__.py +5 -0
- mcli/workflow/videos/__init__.py +1 -0
- mcli/workflow/wakatime/__init__.py +80 -0
- mcli/workflow/workflow.py +22 -6
- {mcli_framework-7.10.2.dist-info → mcli_framework-7.11.0.dist-info}/METADATA +51 -54
- {mcli_framework-7.10.2.dist-info → mcli_framework-7.11.0.dist-info}/RECORD +80 -12
- {mcli_framework-7.10.2.dist-info → mcli_framework-7.11.0.dist-info}/WHEEL +0 -0
- {mcli_framework-7.10.2.dist-info → mcli_framework-7.11.0.dist-info}/entry_points.txt +0 -0
- {mcli_framework-7.10.2.dist-info → mcli_framework-7.11.0.dist-info}/licenses/LICENSE +0 -0
- {mcli_framework-7.10.2.dist-info → mcli_framework-7.11.0.dist-info}/top_level.txt +0 -0
mcli/app/main.py
CHANGED
|
@@ -326,14 +326,14 @@ class LazyGroup(click.Group):
|
|
|
326
326
|
|
|
327
327
|
def _add_lazy_commands(app: click.Group):
|
|
328
328
|
"""Add command groups with lazy loading."""
|
|
329
|
-
#
|
|
329
|
+
# Workflow management - load immediately for fast access (renamed from 'commands')
|
|
330
330
|
try:
|
|
331
|
-
from mcli.app.commands_cmd import
|
|
331
|
+
from mcli.app.commands_cmd import workflow
|
|
332
332
|
|
|
333
|
-
app.add_command(
|
|
334
|
-
logger.debug("Added
|
|
333
|
+
app.add_command(workflow, name="workflow")
|
|
334
|
+
logger.debug("Added workflow management group")
|
|
335
335
|
except ImportError as e:
|
|
336
|
-
logger.debug(f"Could not load
|
|
336
|
+
logger.debug(f"Could not load workflow management group: {e}")
|
|
337
337
|
|
|
338
338
|
# Self management - load immediately as it's commonly used
|
|
339
339
|
try:
|
|
@@ -344,35 +344,29 @@ def _add_lazy_commands(app: click.Group):
|
|
|
344
344
|
except Exception as e:
|
|
345
345
|
logger.debug(f"Could not load self commands: {e}")
|
|
346
346
|
|
|
347
|
-
#
|
|
348
|
-
|
|
349
|
-
from mcli.lib.lib import lib
|
|
350
|
-
|
|
351
|
-
app.add_command(lib, name="lib")
|
|
352
|
-
logger.debug("Added lib commands")
|
|
353
|
-
except Exception as e:
|
|
354
|
-
logger.debug(f"Could not load lib commands: {e}")
|
|
347
|
+
# Note: lib group removed - secrets moved to workflows
|
|
348
|
+
# Previous: mcli lib secrets -> Now: mcli workflows secrets
|
|
355
349
|
|
|
356
|
-
# Add workflow with completion-aware lazy loading
|
|
350
|
+
# Add workflows group (renamed from 'workflow') with completion-aware lazy loading
|
|
357
351
|
try:
|
|
358
352
|
from mcli.app.completion_helpers import create_completion_aware_lazy_group
|
|
359
353
|
|
|
360
|
-
|
|
361
|
-
"
|
|
362
|
-
"mcli.workflow.workflow.
|
|
363
|
-
"
|
|
354
|
+
workflows_group = create_completion_aware_lazy_group(
|
|
355
|
+
"workflows",
|
|
356
|
+
"mcli.workflow.workflow.workflows",
|
|
357
|
+
"Runnable workflows for automation, video processing, and daemon management",
|
|
364
358
|
)
|
|
365
|
-
app.add_command(
|
|
366
|
-
logger.debug("Added completion-aware
|
|
359
|
+
app.add_command(workflows_group, name="workflows")
|
|
360
|
+
logger.debug("Added completion-aware workflows group")
|
|
367
361
|
except ImportError as e:
|
|
368
362
|
logger.debug(f"Could not load completion helpers, using standard lazy group: {e}")
|
|
369
363
|
# Fallback to standard lazy group
|
|
370
|
-
|
|
371
|
-
"
|
|
372
|
-
"mcli.workflow.workflow.
|
|
373
|
-
help="
|
|
364
|
+
workflows_group = LazyGroup(
|
|
365
|
+
"workflows",
|
|
366
|
+
"mcli.workflow.workflow.workflows",
|
|
367
|
+
help="Runnable workflows for automation, video processing, and daemon management",
|
|
374
368
|
)
|
|
375
|
-
app.add_command(
|
|
369
|
+
app.add_command(workflows_group, name="workflows")
|
|
376
370
|
|
|
377
371
|
# Lazy load other heavy commands that are used less frequently
|
|
378
372
|
# NOTE: chat and model commands have been removed
|
|
@@ -382,8 +376,8 @@ def _add_lazy_commands(app: click.Group):
|
|
|
382
376
|
lazy_commands = {}
|
|
383
377
|
|
|
384
378
|
for cmd_name, cmd_info in lazy_commands.items():
|
|
385
|
-
# Skip
|
|
386
|
-
if cmd_name == "
|
|
379
|
+
# Skip workflows since we already added it with completion support
|
|
380
|
+
if cmd_name == "workflows":
|
|
387
381
|
continue
|
|
388
382
|
|
|
389
383
|
if cmd_name in ["model"]:
|
|
File without changes
|
mcli/chat/__init__.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""
|
|
2
|
+
MCLI Chat System
|
|
3
|
+
Real-time system control and interaction capabilities for MCLI chat
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from .system_controller import (
|
|
7
|
+
SystemController,
|
|
8
|
+
control_app,
|
|
9
|
+
execute_system_command,
|
|
10
|
+
open_file_or_url,
|
|
11
|
+
open_textedit_and_write,
|
|
12
|
+
system_controller,
|
|
13
|
+
take_screenshot,
|
|
14
|
+
)
|
|
15
|
+
from .system_integration import (
|
|
16
|
+
ChatSystemIntegration,
|
|
17
|
+
chat_system_integration,
|
|
18
|
+
get_system_capabilities,
|
|
19
|
+
handle_system_request,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
__all__ = [
|
|
23
|
+
"SystemController",
|
|
24
|
+
"system_controller",
|
|
25
|
+
"ChatSystemIntegration",
|
|
26
|
+
"chat_system_integration",
|
|
27
|
+
"handle_system_request",
|
|
28
|
+
"get_system_capabilities",
|
|
29
|
+
"open_textedit_and_write",
|
|
30
|
+
"control_app",
|
|
31
|
+
"execute_system_command",
|
|
32
|
+
"take_screenshot",
|
|
33
|
+
"open_file_or_url",
|
|
34
|
+
]
|
mcli/lib/__init__.py
ADDED
|
File without changes
|
mcli/lib/api/__init__.py
ADDED
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .auth import *
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .config import *
|
mcli/lib/custom_commands.py
CHANGED
|
@@ -19,7 +19,12 @@ from typing import Any, Dict, List, Optional
|
|
|
19
19
|
import click
|
|
20
20
|
|
|
21
21
|
from mcli.lib.logger.logger import get_logger, register_subprocess
|
|
22
|
-
from mcli.lib.paths import
|
|
22
|
+
from mcli.lib.paths import (
|
|
23
|
+
get_custom_commands_dir,
|
|
24
|
+
get_lockfile_path,
|
|
25
|
+
is_git_repository,
|
|
26
|
+
get_git_root,
|
|
27
|
+
)
|
|
23
28
|
|
|
24
29
|
logger = get_logger()
|
|
25
30
|
|
|
@@ -27,10 +32,22 @@ logger = get_logger()
|
|
|
27
32
|
class CustomCommandManager:
|
|
28
33
|
"""Manages custom user commands stored in JSON format."""
|
|
29
34
|
|
|
30
|
-
def __init__(self):
|
|
31
|
-
|
|
35
|
+
def __init__(self, global_mode: bool = False):
|
|
36
|
+
"""
|
|
37
|
+
Initialize the custom command manager.
|
|
38
|
+
|
|
39
|
+
Args:
|
|
40
|
+
global_mode: If True, use global commands directory (~/.mcli/commands/).
|
|
41
|
+
If False, use local directory (.mcli/commands/) when in a git repository.
|
|
42
|
+
"""
|
|
43
|
+
self.global_mode = global_mode
|
|
44
|
+
self.commands_dir = get_custom_commands_dir(global_mode=global_mode)
|
|
32
45
|
self.loaded_commands: Dict[str, Any] = {}
|
|
33
|
-
self.lockfile_path =
|
|
46
|
+
self.lockfile_path = get_lockfile_path(global_mode=global_mode)
|
|
47
|
+
|
|
48
|
+
# Store context information for display
|
|
49
|
+
self.is_local = not global_mode and is_git_repository()
|
|
50
|
+
self.git_root = get_git_root() if self.is_local else None
|
|
34
51
|
|
|
35
52
|
def save_command(
|
|
36
53
|
self,
|
|
@@ -486,16 +503,39 @@ class CustomCommandManager:
|
|
|
486
503
|
return results
|
|
487
504
|
|
|
488
505
|
|
|
489
|
-
# Global
|
|
490
|
-
|
|
506
|
+
# Global and local instances
|
|
507
|
+
_global_command_manager: Optional[CustomCommandManager] = None
|
|
508
|
+
_local_command_manager: Optional[CustomCommandManager] = None
|
|
509
|
+
|
|
491
510
|
|
|
511
|
+
def get_command_manager(global_mode: bool = False) -> CustomCommandManager:
|
|
512
|
+
"""
|
|
513
|
+
Get the custom command manager instance.
|
|
514
|
+
|
|
515
|
+
Args:
|
|
516
|
+
global_mode: If True, return global manager. If False, return local manager (if in git repo).
|
|
492
517
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
518
|
+
Returns:
|
|
519
|
+
CustomCommandManager instance for the appropriate scope
|
|
520
|
+
"""
|
|
521
|
+
global _global_command_manager, _local_command_manager
|
|
522
|
+
|
|
523
|
+
if global_mode:
|
|
524
|
+
if _global_command_manager is None:
|
|
525
|
+
_global_command_manager = CustomCommandManager(global_mode=True)
|
|
526
|
+
return _global_command_manager
|
|
527
|
+
else:
|
|
528
|
+
# Use local manager if in git repository
|
|
529
|
+
if is_git_repository():
|
|
530
|
+
# Recreate local manager if git root changed (e.g., changed directory)
|
|
531
|
+
if _local_command_manager is None or _local_command_manager.git_root != get_git_root():
|
|
532
|
+
_local_command_manager = CustomCommandManager(global_mode=False)
|
|
533
|
+
return _local_command_manager
|
|
534
|
+
else:
|
|
535
|
+
# Fallback to global manager when not in a git repository
|
|
536
|
+
if _global_command_manager is None:
|
|
537
|
+
_global_command_manager = CustomCommandManager(global_mode=True)
|
|
538
|
+
return _global_command_manager
|
|
499
539
|
|
|
500
540
|
|
|
501
541
|
def load_custom_commands(target_group: click.Group) -> int:
|
mcli/lib/erd/__init__.py
ADDED
|
@@ -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
|
mcli/lib/fs/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .fs import *
|
mcli/lib/paths.py
CHANGED
|
@@ -82,13 +82,137 @@ def get_cache_dir() -> Path:
|
|
|
82
82
|
return cache_dir
|
|
83
83
|
|
|
84
84
|
|
|
85
|
-
def
|
|
85
|
+
def is_git_repository(path: Optional[Path] = None) -> bool:
|
|
86
86
|
"""
|
|
87
|
-
|
|
87
|
+
Check if the current directory (or specified path) is inside a git repository.
|
|
88
|
+
|
|
89
|
+
Args:
|
|
90
|
+
path: Path to check (defaults to current working directory)
|
|
91
|
+
|
|
92
|
+
Returns:
|
|
93
|
+
True if inside a git repository, False otherwise
|
|
94
|
+
"""
|
|
95
|
+
check_path = path or Path.cwd()
|
|
96
|
+
|
|
97
|
+
# Walk up the directory tree looking for .git
|
|
98
|
+
current = check_path.resolve()
|
|
99
|
+
while current != current.parent:
|
|
100
|
+
if (current / ".git").exists():
|
|
101
|
+
return True
|
|
102
|
+
current = current.parent
|
|
103
|
+
|
|
104
|
+
return False
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def get_git_root(path: Optional[Path] = None) -> Optional[Path]:
|
|
108
|
+
"""
|
|
109
|
+
Get the root directory of the git repository.
|
|
110
|
+
|
|
111
|
+
Args:
|
|
112
|
+
path: Path to check (defaults to current working directory)
|
|
113
|
+
|
|
114
|
+
Returns:
|
|
115
|
+
Path to git root, or None if not in a git repository
|
|
116
|
+
"""
|
|
117
|
+
check_path = path or Path.cwd()
|
|
118
|
+
|
|
119
|
+
# Walk up the directory tree looking for .git
|
|
120
|
+
current = check_path.resolve()
|
|
121
|
+
while current != current.parent:
|
|
122
|
+
if (current / ".git").exists():
|
|
123
|
+
return current
|
|
124
|
+
current = current.parent
|
|
125
|
+
|
|
126
|
+
return None
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def get_local_mcli_dir() -> Optional[Path]:
|
|
130
|
+
"""
|
|
131
|
+
Get the local .mcli directory for the current git repository.
|
|
88
132
|
|
|
89
133
|
Returns:
|
|
90
|
-
Path to
|
|
134
|
+
Path to .mcli directory in git root, or None if not in a git repository
|
|
91
135
|
"""
|
|
136
|
+
git_root = get_git_root()
|
|
137
|
+
if git_root:
|
|
138
|
+
local_mcli = git_root / ".mcli"
|
|
139
|
+
return local_mcli
|
|
140
|
+
return None
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def get_local_commands_dir() -> Optional[Path]:
|
|
144
|
+
"""
|
|
145
|
+
Get the local workflows directory for the current git repository.
|
|
146
|
+
|
|
147
|
+
Note: This function name is kept for backward compatibility but now returns
|
|
148
|
+
the workflows directory. Checks workflows first, then commands for migration.
|
|
149
|
+
|
|
150
|
+
Returns:
|
|
151
|
+
Path to .mcli/workflows (or .mcli/commands for migration) in git root,
|
|
152
|
+
or None if not in a git repository
|
|
153
|
+
"""
|
|
154
|
+
local_mcli = get_local_mcli_dir()
|
|
155
|
+
if local_mcli:
|
|
156
|
+
# Check for new workflows directory first
|
|
157
|
+
workflows_dir = local_mcli / "workflows"
|
|
158
|
+
if workflows_dir.exists():
|
|
159
|
+
return workflows_dir
|
|
160
|
+
|
|
161
|
+
# Fall back to old commands directory for migration support
|
|
162
|
+
commands_dir = local_mcli / "commands"
|
|
163
|
+
return commands_dir
|
|
164
|
+
return None
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def get_custom_commands_dir(global_mode: bool = False) -> Path:
|
|
168
|
+
"""
|
|
169
|
+
Get the custom workflows directory for mcli.
|
|
170
|
+
|
|
171
|
+
Note: This function name is kept for backward compatibility but now returns
|
|
172
|
+
the workflows directory. Checks workflows first, then commands for migration.
|
|
173
|
+
|
|
174
|
+
Args:
|
|
175
|
+
global_mode: If True, always use global directory. If False, use local if in git repo.
|
|
176
|
+
|
|
177
|
+
Returns:
|
|
178
|
+
Path to custom workflows directory, created if it doesn't exist
|
|
179
|
+
"""
|
|
180
|
+
# If not in global mode and we're in a git repository, use local directory
|
|
181
|
+
if not global_mode:
|
|
182
|
+
local_dir = get_local_commands_dir()
|
|
183
|
+
if local_dir:
|
|
184
|
+
local_dir.mkdir(parents=True, exist_ok=True)
|
|
185
|
+
return local_dir
|
|
186
|
+
|
|
187
|
+
# Otherwise, use global directory
|
|
188
|
+
# Check for new workflows directory first
|
|
189
|
+
workflows_dir = get_mcli_home() / "workflows"
|
|
190
|
+
if workflows_dir.exists():
|
|
191
|
+
return workflows_dir
|
|
192
|
+
|
|
193
|
+
# Check for old commands directory (for migration support)
|
|
92
194
|
commands_dir = get_mcli_home() / "commands"
|
|
93
|
-
commands_dir.
|
|
94
|
-
|
|
195
|
+
if commands_dir.exists():
|
|
196
|
+
# Return commands directory if it exists (user hasn't migrated yet)
|
|
197
|
+
return commands_dir
|
|
198
|
+
|
|
199
|
+
# If neither exists, create the new workflows directory
|
|
200
|
+
workflows_dir.mkdir(parents=True, exist_ok=True)
|
|
201
|
+
return workflows_dir
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
def get_lockfile_path(global_mode: bool = False) -> Path:
|
|
205
|
+
"""
|
|
206
|
+
Get the lockfile path for workflow management.
|
|
207
|
+
|
|
208
|
+
Note: Lockfile remains named commands.lock.json for compatibility.
|
|
209
|
+
|
|
210
|
+
Args:
|
|
211
|
+
global_mode: If True, use global lockfile. If False, use local if in git repo.
|
|
212
|
+
|
|
213
|
+
Returns:
|
|
214
|
+
Path to the lockfile
|
|
215
|
+
"""
|
|
216
|
+
workflows_dir = get_custom_commands_dir(global_mode=global_mode)
|
|
217
|
+
# Keep the old lockfile name for compatibility
|
|
218
|
+
return workflows_dir / "commands.lock.json"
|
|
@@ -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
|
+
]
|
mcli/ml/api/__init__.py
ADDED
|
@@ -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/auth/__init__.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
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 Permission, check_permission, has_permission
|
|
22
|
+
|
|
23
|
+
__all__ = [
|
|
24
|
+
"AuthManager",
|
|
25
|
+
"create_access_token",
|
|
26
|
+
"verify_access_token",
|
|
27
|
+
"get_current_user",
|
|
28
|
+
"get_current_active_user",
|
|
29
|
+
"require_role",
|
|
30
|
+
"hash_password",
|
|
31
|
+
"verify_password",
|
|
32
|
+
"UserCreate",
|
|
33
|
+
"UserLogin",
|
|
34
|
+
"UserResponse",
|
|
35
|
+
"TokenResponse",
|
|
36
|
+
"PasswordReset",
|
|
37
|
+
"PasswordChange",
|
|
38
|
+
"Permission",
|
|
39
|
+
"check_permission",
|
|
40
|
+
"has_permission",
|
|
41
|
+
]
|
|
@@ -0,0 +1,33 @@
|
|
|
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 MarketSimulator, Order, Portfolio, Position, TradingSimulator
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
"BacktestEngine",
|
|
20
|
+
"BacktestConfig",
|
|
21
|
+
"BacktestResult",
|
|
22
|
+
"TradingStrategy",
|
|
23
|
+
"PositionManager",
|
|
24
|
+
"PerformanceAnalyzer",
|
|
25
|
+
"PortfolioMetrics",
|
|
26
|
+
"RiskMetrics",
|
|
27
|
+
"plot_performance",
|
|
28
|
+
"TradingSimulator",
|
|
29
|
+
"Order",
|
|
30
|
+
"Position",
|
|
31
|
+
"Portfolio",
|
|
32
|
+
"MarketSimulator",
|
|
33
|
+
]
|
mcli/ml/cli/__init__.py
ADDED
|
@@ -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
|
+
]
|