mcli-framework 7.0.0__py3-none-any.whl → 7.0.2__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 +32 -0
- mcli/app/logs_cmd.py +26 -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/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/logger/logger.py +5 -7
- mcli/lib/paths.py +82 -0
- mcli/lib/performance/__init__.py +17 -0
- mcli/lib/pickles/__init__.py +1 -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 +31 -0
- mcli/ml/api/routers/__init__.py +27 -0
- mcli/ml/auth/__init__.py +45 -0
- mcli/ml/backtesting/__init__.py +41 -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 +10 -0
- mcli/ml/data_ingestion/__init__.py +41 -0
- mcli/ml/database/__init__.py +47 -0
- mcli/ml/experimentation/__init__.py +29 -0
- mcli/ml/features/__init__.py +39 -0
- mcli/ml/mlops/__init__.py +35 -0
- mcli/ml/models/__init__.py +97 -0
- mcli/ml/monitoring/__init__.py +25 -0
- mcli/ml/optimization/__init__.py +27 -0
- mcli/ml/preprocessing/__init__.py +28 -0
- mcli/ml/scripts/__init__.py +1 -0
- mcli/public/__init__.py +1 -0
- mcli/public/commands/__init__.py +2 -0
- mcli/self/__init__.py +3 -0
- mcli/workflow/__init__.py +0 -0
- mcli/workflow/daemon/__init__.py +13 -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/politician_trading/__init__.py +4 -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/sync/__init__.py +5 -0
- mcli/workflow/videos/__init__.py +1 -0
- mcli/workflow/wakatime/__init__.py +80 -0
- {mcli_framework-7.0.0.dist-info → mcli_framework-7.0.2.dist-info}/METADATA +1 -1
- {mcli_framework-7.0.0.dist-info → mcli_framework-7.0.2.dist-info}/RECORD +66 -8
- {mcli_framework-7.0.0.dist-info → mcli_framework-7.0.2.dist-info}/WHEEL +0 -0
- {mcli_framework-7.0.0.dist-info → mcli_framework-7.0.2.dist-info}/entry_points.txt +0 -0
- {mcli_framework-7.0.0.dist-info → mcli_framework-7.0.2.dist-info}/licenses/LICENSE +0 -0
- {mcli_framework-7.0.0.dist-info → mcli_framework-7.0.2.dist-info}/top_level.txt +0 -0
mcli/__init__.py
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# logger.info("I am in mcli.__init__.py")
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
try:
|
|
5
|
+
from mcli.app import main
|
|
6
|
+
|
|
7
|
+
# from mcli.public import *
|
|
8
|
+
# from mcli.private import *
|
|
9
|
+
# Import the complete Click superset decorators
|
|
10
|
+
from mcli.lib.api.mcli_decorators import BOOL # mcli.BOOL - Click BOOL type
|
|
11
|
+
from mcli.lib.api.mcli_decorators import FLOAT # mcli.FLOAT - Click FLOAT type
|
|
12
|
+
from mcli.lib.api.mcli_decorators import INT # mcli.INT - Click INT type
|
|
13
|
+
from mcli.lib.api.mcli_decorators import STRING # mcli.STRING - Click STRING type
|
|
14
|
+
from mcli.lib.api.mcli_decorators import UNPROCESSED # mcli.UNPROCESSED - Click UNPROCESSED
|
|
15
|
+
from mcli.lib.api.mcli_decorators import UUID # mcli.UUID - Click UUID type
|
|
16
|
+
from mcli.lib.api.mcli_decorators import Abort # mcli.Abort - Click Abort
|
|
17
|
+
from mcli.lib.api.mcli_decorators import BadParameter # mcli.BadParameter - Click BadParameter
|
|
18
|
+
from mcli.lib.api.mcli_decorators import Choice # mcli.Choice - Click Choice type
|
|
19
|
+
from mcli.lib.api.mcli_decorators import File # mcli.File - Click File type
|
|
20
|
+
from mcli.lib.api.mcli_decorators import FloatRange # mcli.FloatRange - Click FloatRange type
|
|
21
|
+
from mcli.lib.api.mcli_decorators import IntRange # mcli.IntRange - Click IntRange type
|
|
22
|
+
from mcli.lib.api.mcli_decorators import ParamType # mcli.ParamType - Click ParamType
|
|
23
|
+
from mcli.lib.api.mcli_decorators import Path # mcli.Path - Click Path type
|
|
24
|
+
from mcli.lib.api.mcli_decorators import UsageError # mcli.UsageError - Click UsageError
|
|
25
|
+
from mcli.lib.api.mcli_decorators import api # @mcli.api - Legacy API decorator
|
|
26
|
+
from mcli.lib.api.mcli_decorators import (
|
|
27
|
+
api_command, # @mcli.api_command - Convenience for API endpoints
|
|
28
|
+
)
|
|
29
|
+
from mcli.lib.api.mcli_decorators import argument # @mcli.argument - Click argument decorator
|
|
30
|
+
from mcli.lib.api.mcli_decorators import (
|
|
31
|
+
background, # @mcli.background - Legacy background decorator
|
|
32
|
+
)
|
|
33
|
+
from mcli.lib.api.mcli_decorators import (
|
|
34
|
+
background_command, # @mcli.background_command - Convenience for background
|
|
35
|
+
)
|
|
36
|
+
from mcli.lib.api.mcli_decorators import clear # mcli.clear - Click clear
|
|
37
|
+
from mcli.lib.api.mcli_decorators import (
|
|
38
|
+
cli_with_api, # @mcli.cli_with_api - Legacy combined decorator
|
|
39
|
+
)
|
|
40
|
+
from mcli.lib.api.mcli_decorators import (
|
|
41
|
+
command, # @mcli.command - Complete Click command with API/background
|
|
42
|
+
)
|
|
43
|
+
from mcli.lib.api.mcli_decorators import confirm # mcli.confirm - Click confirmation
|
|
44
|
+
from mcli.lib.api.mcli_decorators import echo # mcli.echo - Click echo function
|
|
45
|
+
from mcli.lib.api.mcli_decorators import edit # mcli.edit - Click editor
|
|
46
|
+
from mcli.lib.api.mcli_decorators import (
|
|
47
|
+
format_filename, # mcli.format_filename - Click filename
|
|
48
|
+
)
|
|
49
|
+
from mcli.lib.api.mcli_decorators import get_app # mcli.get_app - Click app
|
|
50
|
+
from mcli.lib.api.mcli_decorators import get_app_dir # mcli.get_app_dir - Click app directory
|
|
51
|
+
from mcli.lib.api.mcli_decorators import (
|
|
52
|
+
get_binary_stream, # mcli.get_binary_stream - Click binary stream
|
|
53
|
+
)
|
|
54
|
+
from mcli.lib.api.mcli_decorators import (
|
|
55
|
+
get_current_context, # mcli.get_current_context - Click context
|
|
56
|
+
)
|
|
57
|
+
from mcli.lib.api.mcli_decorators import (
|
|
58
|
+
get_network_credentials, # mcli.get_network_credentials - Click network
|
|
59
|
+
)
|
|
60
|
+
from mcli.lib.api.mcli_decorators import get_os_args # mcli.get_os_args - Click OS args
|
|
61
|
+
from mcli.lib.api.mcli_decorators import (
|
|
62
|
+
get_terminal_size, # mcli.get_terminal_size - Click terminal size
|
|
63
|
+
)
|
|
64
|
+
from mcli.lib.api.mcli_decorators import (
|
|
65
|
+
get_text_stream, # mcli.get_text_stream - Click text stream
|
|
66
|
+
)
|
|
67
|
+
from mcli.lib.api.mcli_decorators import getchar # mcli.getchar - Click character input
|
|
68
|
+
from mcli.lib.api.mcli_decorators import (
|
|
69
|
+
group, # @mcli.group - Complete Click group with API support
|
|
70
|
+
)
|
|
71
|
+
from mcli.lib.api.mcli_decorators import launch # mcli.launch - Click launch
|
|
72
|
+
from mcli.lib.api.mcli_decorators import open_file # mcli.open_file - Click file operations
|
|
73
|
+
from mcli.lib.api.mcli_decorators import option # @mcli.option - Click option decorator
|
|
74
|
+
from mcli.lib.api.mcli_decorators import pause # mcli.pause - Click pause
|
|
75
|
+
from mcli.lib.api.mcli_decorators import progressbar # mcli.progressbar - Click progress bar
|
|
76
|
+
from mcli.lib.api.mcli_decorators import prompt # mcli.prompt - Click prompt
|
|
77
|
+
from mcli.lib.api.mcli_decorators import secho # mcli.secho - Click styled echo
|
|
78
|
+
from mcli.lib.api.mcli_decorators import style # mcli.style - Click styling
|
|
79
|
+
from mcli.lib.api.mcli_decorators import unstyle # mcli.unstyle - Click unstyle
|
|
80
|
+
from mcli.lib.api.mcli_decorators import ( # Core decorators (complete Click superset); Click re-exports (complete subsume); Click types (complete subsume); Convenience decorators; Legacy decorators (for backward compatibility); Server management; Configuration; Convenience functions
|
|
81
|
+
disable_api_server,
|
|
82
|
+
enable_api_server,
|
|
83
|
+
get_api_config,
|
|
84
|
+
health_check,
|
|
85
|
+
is_background_available,
|
|
86
|
+
is_server_running,
|
|
87
|
+
start_server,
|
|
88
|
+
status_check,
|
|
89
|
+
stop_server,
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
# Make everything available at the top level (complete Click subsume)
|
|
93
|
+
__all__ = [
|
|
94
|
+
"main",
|
|
95
|
+
# Core decorators (complete Click superset)
|
|
96
|
+
"command",
|
|
97
|
+
"group",
|
|
98
|
+
# Click re-exports (complete subsume)
|
|
99
|
+
"option",
|
|
100
|
+
"argument",
|
|
101
|
+
"echo",
|
|
102
|
+
"get_current_context",
|
|
103
|
+
"get_app",
|
|
104
|
+
"launch",
|
|
105
|
+
"open_file",
|
|
106
|
+
"get_os_args",
|
|
107
|
+
"get_binary_stream",
|
|
108
|
+
"get_text_stream",
|
|
109
|
+
"format_filename",
|
|
110
|
+
"getchar",
|
|
111
|
+
"pause",
|
|
112
|
+
"clear",
|
|
113
|
+
"style",
|
|
114
|
+
"unstyle",
|
|
115
|
+
"secho",
|
|
116
|
+
"edit",
|
|
117
|
+
"confirm",
|
|
118
|
+
"prompt",
|
|
119
|
+
"progressbar",
|
|
120
|
+
"get_terminal_size",
|
|
121
|
+
"get_app_dir",
|
|
122
|
+
"get_network_credentials",
|
|
123
|
+
# Click types (complete subsume)
|
|
124
|
+
"Path",
|
|
125
|
+
"Choice",
|
|
126
|
+
"IntRange",
|
|
127
|
+
"FloatRange",
|
|
128
|
+
"UNPROCESSED",
|
|
129
|
+
"STRING",
|
|
130
|
+
"INT",
|
|
131
|
+
"FLOAT",
|
|
132
|
+
"BOOL",
|
|
133
|
+
"UUID",
|
|
134
|
+
"File",
|
|
135
|
+
"ParamType",
|
|
136
|
+
"BadParameter",
|
|
137
|
+
"UsageError",
|
|
138
|
+
"Abort",
|
|
139
|
+
# Convenience decorators
|
|
140
|
+
"api_command",
|
|
141
|
+
"background_command",
|
|
142
|
+
# Legacy decorators (for backward compatibility)
|
|
143
|
+
"api",
|
|
144
|
+
"background",
|
|
145
|
+
"cli_with_api",
|
|
146
|
+
# Server management
|
|
147
|
+
"start_server",
|
|
148
|
+
"stop_server",
|
|
149
|
+
"is_server_running",
|
|
150
|
+
"is_background_available",
|
|
151
|
+
"get_api_config",
|
|
152
|
+
"enable_api_server",
|
|
153
|
+
"disable_api_server",
|
|
154
|
+
"health_check",
|
|
155
|
+
"status_check",
|
|
156
|
+
]
|
|
157
|
+
|
|
158
|
+
except ImportError:
|
|
159
|
+
# from .app import main
|
|
160
|
+
sys.exit(1)
|
mcli/__main__.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# logger.info("I am in mcli.__init__.py")
|
|
2
|
+
|
|
3
|
+
try:
|
|
4
|
+
from mcli.app.main import main as main_func
|
|
5
|
+
|
|
6
|
+
# from mcli.public import *
|
|
7
|
+
# from mcli.private import *
|
|
8
|
+
except ImportError:
|
|
9
|
+
from .app.main import main as main_func
|
|
10
|
+
|
|
11
|
+
__all__ = ["main_func"]
|
|
12
|
+
|
|
13
|
+
if __name__ == "__main__":
|
|
14
|
+
main_func()
|
mcli/app/__init__.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# src/mcli/app/__init__.py
|
|
2
|
+
import importlib
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
from mcli.lib.logger.logger import get_logger
|
|
6
|
+
|
|
7
|
+
logger = get_logger(__name__)
|
|
8
|
+
|
|
9
|
+
logger.info("Initializing mcli.app package")
|
|
10
|
+
|
|
11
|
+
# Import main function
|
|
12
|
+
try:
|
|
13
|
+
from .main import main
|
|
14
|
+
|
|
15
|
+
logger.info("Successfully imported main from .main")
|
|
16
|
+
except ImportError as e:
|
|
17
|
+
logger.error(f"Failed to import main: {e}")
|
|
18
|
+
import traceback
|
|
19
|
+
|
|
20
|
+
logger.error(f"Traceback: {traceback.format_exc()}")
|
|
21
|
+
raise
|
|
22
|
+
|
|
23
|
+
# Try importing readiness submodule
|
|
24
|
+
try:
|
|
25
|
+
from .readiness import readiness
|
|
26
|
+
|
|
27
|
+
logger.info(f"Successfully imported readiness module directly: {readiness}")
|
|
28
|
+
# Make it available at the app level
|
|
29
|
+
__all__ = ["main", "readiness"]
|
|
30
|
+
except ImportError as e:
|
|
31
|
+
logger.info(f"Could not import readiness directly: {e}")
|
|
32
|
+
__all__ = ["main"]
|
mcli/app/logs_cmd.py
CHANGED
|
@@ -16,6 +16,8 @@ from rich.live import Live
|
|
|
16
16
|
from rich.panel import Panel
|
|
17
17
|
from rich.text import Text
|
|
18
18
|
|
|
19
|
+
from mcli.lib.paths import get_logs_dir
|
|
20
|
+
|
|
19
21
|
console = Console()
|
|
20
22
|
|
|
21
23
|
|
|
@@ -25,6 +27,24 @@ def logs_group():
|
|
|
25
27
|
pass
|
|
26
28
|
|
|
27
29
|
|
|
30
|
+
@logs_group.command(name="location")
|
|
31
|
+
def show_location():
|
|
32
|
+
"""Show the location of the logs directory"""
|
|
33
|
+
logs_dir = get_logs_dir()
|
|
34
|
+
console.print(f"📁 [cyan]Logs directory:[/cyan] {logs_dir}")
|
|
35
|
+
console.print(f" [dim]Set MCLI_HOME environment variable to change location[/dim]")
|
|
36
|
+
|
|
37
|
+
# Show if directory exists and has files
|
|
38
|
+
if logs_dir.exists():
|
|
39
|
+
log_files = list(logs_dir.glob("mcli*.log"))
|
|
40
|
+
if log_files:
|
|
41
|
+
console.print(f" [green]✓ {len(log_files)} log file(s) found[/green]")
|
|
42
|
+
else:
|
|
43
|
+
console.print(f" [yellow]⚠ Directory exists but no log files yet[/yellow]")
|
|
44
|
+
else:
|
|
45
|
+
console.print(f" [yellow]⚠ Directory will be created on first use[/yellow]")
|
|
46
|
+
|
|
47
|
+
|
|
28
48
|
@logs_group.command(name="stream")
|
|
29
49
|
@click.option(
|
|
30
50
|
"--type",
|
|
@@ -49,13 +69,7 @@ def stream_logs(type: str, lines: int, follow: bool):
|
|
|
49
69
|
Shows log output with syntax highlighting and real-time updates.
|
|
50
70
|
Similar to 'tail -f' but with enhanced formatting for MCLI logs.
|
|
51
71
|
"""
|
|
52
|
-
logs_dir =
|
|
53
|
-
|
|
54
|
-
if not logs_dir.exists():
|
|
55
|
-
console.print(
|
|
56
|
-
"❌ No logs directory found. Run some MCLI commands to generate logs.", style="red"
|
|
57
|
-
)
|
|
58
|
-
return
|
|
72
|
+
logs_dir = get_logs_dir()
|
|
59
73
|
|
|
60
74
|
# Get today's log files
|
|
61
75
|
today = datetime.now().strftime("%Y%m%d")
|
|
@@ -98,12 +112,7 @@ def stream_logs(type: str, lines: int, follow: bool):
|
|
|
98
112
|
@click.option("--date", "-d", help="Show logs for specific date (YYYYMMDD format)")
|
|
99
113
|
def list_logs(date: Optional[str]):
|
|
100
114
|
"""List available log files"""
|
|
101
|
-
logs_dir =
|
|
102
|
-
|
|
103
|
-
if not logs_dir.exists():
|
|
104
|
-
console.print("❌ No logs directory found", style="red")
|
|
105
|
-
return
|
|
106
|
-
|
|
115
|
+
logs_dir = get_logs_dir()
|
|
107
116
|
_list_available_logs(logs_dir, date)
|
|
108
117
|
|
|
109
118
|
|
|
@@ -113,11 +122,9 @@ def list_logs(date: Optional[str]):
|
|
|
113
122
|
@click.option("--date", "-d", help="Date for log file (YYYYMMDD format, default: today)")
|
|
114
123
|
def tail_logs(log_type: str, lines: int, date: Optional[str]):
|
|
115
124
|
"""Show the last N lines of a specific log file"""
|
|
116
|
-
logs_dir =
|
|
125
|
+
logs_dir = get_logs_dir()
|
|
117
126
|
|
|
118
|
-
|
|
119
|
-
console.print("❌ No logs directory found", style="red")
|
|
120
|
-
return
|
|
127
|
+
# Note: get_logs_dir() creates the directory automatically
|
|
121
128
|
|
|
122
129
|
# Use provided date or default to today
|
|
123
130
|
log_date = date or datetime.now().strftime("%Y%m%d")
|
|
@@ -168,11 +175,7 @@ def tail_logs(log_type: str, lines: int, date: Optional[str]):
|
|
|
168
175
|
)
|
|
169
176
|
def grep_logs(pattern: str, type: str, date: Optional[str], context: int):
|
|
170
177
|
"""Search for patterns in log files"""
|
|
171
|
-
logs_dir =
|
|
172
|
-
|
|
173
|
-
if not logs_dir.exists():
|
|
174
|
-
console.print("❌ No logs directory found", style="red")
|
|
175
|
-
return
|
|
178
|
+
logs_dir = get_logs_dir()
|
|
176
179
|
|
|
177
180
|
# Use provided date or default to today
|
|
178
181
|
log_date = date or datetime.now().strftime("%Y%m%d")
|
|
@@ -216,11 +219,7 @@ def grep_logs(pattern: str, type: str, date: Optional[str], context: int):
|
|
|
216
219
|
@click.option("--confirm", "-y", is_flag=True, help="Skip confirmation prompt")
|
|
217
220
|
def clear_logs(older_than: Optional[int], confirm: bool):
|
|
218
221
|
"""Clear old log files"""
|
|
219
|
-
logs_dir =
|
|
220
|
-
|
|
221
|
-
if not logs_dir.exists():
|
|
222
|
-
console.print("❌ No logs directory found", style="red")
|
|
223
|
-
return
|
|
222
|
+
logs_dir = get_logs_dir()
|
|
224
223
|
|
|
225
224
|
# Find log files
|
|
226
225
|
log_files = list(logs_dir.glob("mcli*.log"))
|
|
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/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/logger/logger.py
CHANGED
|
@@ -208,13 +208,11 @@ class McliLogger:
|
|
|
208
208
|
|
|
209
209
|
# Set up file handler with path resolution
|
|
210
210
|
try:
|
|
211
|
-
#
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
#
|
|
215
|
-
|
|
216
|
-
log_dir = project_root / "logs"
|
|
217
|
-
log_dir.mkdir(exist_ok=True)
|
|
211
|
+
# Import paths utility for consistent path resolution
|
|
212
|
+
from mcli.lib.paths import get_logs_dir
|
|
213
|
+
|
|
214
|
+
# Get logs directory (e.g., ~/.mcli/logs)
|
|
215
|
+
log_dir = get_logs_dir()
|
|
218
216
|
|
|
219
217
|
# Create daily log file
|
|
220
218
|
timestamp = datetime.now().strftime("%Y%m%d")
|
mcli/lib/paths.py
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Path resolution utilities for mcli
|
|
3
|
+
|
|
4
|
+
Provides consistent path resolution for logs, config, and data directories
|
|
5
|
+
that work both when running from source and when installed as a package.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import os
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
from typing import Optional
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def get_mcli_home() -> Path:
|
|
14
|
+
"""
|
|
15
|
+
Get the mcli home directory for storing logs, config, and data.
|
|
16
|
+
|
|
17
|
+
Returns:
|
|
18
|
+
Path to ~/.mcli directory, created if it doesn't exist
|
|
19
|
+
"""
|
|
20
|
+
# Check for MCLI_HOME environment variable first
|
|
21
|
+
mcli_home = os.getenv("MCLI_HOME")
|
|
22
|
+
if mcli_home:
|
|
23
|
+
path = Path(mcli_home)
|
|
24
|
+
else:
|
|
25
|
+
# Use XDG_DATA_HOME if set, otherwise default to ~/.mcli
|
|
26
|
+
xdg_data_home = os.getenv("XDG_DATA_HOME")
|
|
27
|
+
if xdg_data_home:
|
|
28
|
+
path = Path(xdg_data_home) / "mcli"
|
|
29
|
+
else:
|
|
30
|
+
path = Path.home() / ".mcli"
|
|
31
|
+
|
|
32
|
+
# Create directory if it doesn't exist
|
|
33
|
+
path.mkdir(parents=True, exist_ok=True)
|
|
34
|
+
return path
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def get_logs_dir() -> Path:
|
|
38
|
+
"""
|
|
39
|
+
Get the logs directory for mcli.
|
|
40
|
+
|
|
41
|
+
Returns:
|
|
42
|
+
Path to logs directory (e.g., ~/.mcli/logs), created if it doesn't exist
|
|
43
|
+
"""
|
|
44
|
+
logs_dir = get_mcli_home() / "logs"
|
|
45
|
+
logs_dir.mkdir(parents=True, exist_ok=True)
|
|
46
|
+
return logs_dir
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def get_config_dir() -> Path:
|
|
50
|
+
"""
|
|
51
|
+
Get the config directory for mcli.
|
|
52
|
+
|
|
53
|
+
Returns:
|
|
54
|
+
Path to config directory (e.g., ~/.mcli/config), created if it doesn't exist
|
|
55
|
+
"""
|
|
56
|
+
config_dir = get_mcli_home() / "config"
|
|
57
|
+
config_dir.mkdir(parents=True, exist_ok=True)
|
|
58
|
+
return config_dir
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def get_data_dir() -> Path:
|
|
62
|
+
"""
|
|
63
|
+
Get the data directory for mcli.
|
|
64
|
+
|
|
65
|
+
Returns:
|
|
66
|
+
Path to data directory (e.g., ~/.mcli/data), created if it doesn't exist
|
|
67
|
+
"""
|
|
68
|
+
data_dir = get_mcli_home() / "data"
|
|
69
|
+
data_dir.mkdir(parents=True, exist_ok=True)
|
|
70
|
+
return data_dir
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def get_cache_dir() -> Path:
|
|
74
|
+
"""
|
|
75
|
+
Get the cache directory for mcli.
|
|
76
|
+
|
|
77
|
+
Returns:
|
|
78
|
+
Path to cache directory (e.g., ~/.mcli/cache), created if it doesn't exist
|
|
79
|
+
"""
|
|
80
|
+
cache_dir = get_mcli_home() / "cache"
|
|
81
|
+
cache_dir.mkdir(parents=True, exist_ok=True)
|
|
82
|
+
return cache_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
|
+
]
|
mcli/ml/api/__init__.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""API routes and endpoints for ML system"""
|
|
2
|
+
|
|
3
|
+
from .routers import (
|
|
4
|
+
auth_router,
|
|
5
|
+
model_router,
|
|
6
|
+
prediction_router,
|
|
7
|
+
portfolio_router,
|
|
8
|
+
data_router,
|
|
9
|
+
trade_router,
|
|
10
|
+
backtest_router,
|
|
11
|
+
monitoring_router,
|
|
12
|
+
admin_router,
|
|
13
|
+
websocket_router,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
from .app import create_app, get_application
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
"auth_router",
|
|
20
|
+
"model_router",
|
|
21
|
+
"prediction_router",
|
|
22
|
+
"portfolio_router",
|
|
23
|
+
"data_router",
|
|
24
|
+
"trade_router",
|
|
25
|
+
"backtest_router",
|
|
26
|
+
"monitoring_router",
|
|
27
|
+
"admin_router",
|
|
28
|
+
"websocket_router",
|
|
29
|
+
"create_app",
|
|
30
|
+
"get_application",
|
|
31
|
+
]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""API routers"""
|
|
2
|
+
|
|
3
|
+
from . import (
|
|
4
|
+
auth_router,
|
|
5
|
+
model_router,
|
|
6
|
+
prediction_router,
|
|
7
|
+
portfolio_router,
|
|
8
|
+
data_router,
|
|
9
|
+
trade_router,
|
|
10
|
+
backtest_router,
|
|
11
|
+
monitoring_router,
|
|
12
|
+
admin_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,45 @@
|
|
|
1
|
+
"""Authentication and authorization system"""
|
|
2
|
+
|
|
3
|
+
from .auth_manager import (
|
|
4
|
+
AuthManager,
|
|
5
|
+
create_access_token,
|
|
6
|
+
verify_access_token,
|
|
7
|
+
get_current_user,
|
|
8
|
+
get_current_active_user,
|
|
9
|
+
require_role,
|
|
10
|
+
hash_password,
|
|
11
|
+
verify_password,
|
|
12
|
+
)
|
|
13
|
+
from .models import (
|
|
14
|
+
UserCreate,
|
|
15
|
+
UserLogin,
|
|
16
|
+
UserResponse,
|
|
17
|
+
TokenResponse,
|
|
18
|
+
PasswordReset,
|
|
19
|
+
PasswordChange,
|
|
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
|
+
]
|