mtr-cli 0.1.0__py3-none-any.whl → 0.2.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.
- mtr/cli.py +10 -3
- {mtr_cli-0.1.0.dist-info → mtr_cli-0.2.0.dist-info}/METADATA +14 -7
- {mtr_cli-0.1.0.dist-info → mtr_cli-0.2.0.dist-info}/RECORD +6 -6
- {mtr_cli-0.1.0.dist-info → mtr_cli-0.2.0.dist-info}/WHEEL +0 -0
- {mtr_cli-0.1.0.dist-info → mtr_cli-0.2.0.dist-info}/entry_points.txt +0 -0
- {mtr_cli-0.1.0.dist-info → mtr_cli-0.2.0.dist-info}/licenses/LICENSE +0 -0
mtr/cli.py
CHANGED
|
@@ -73,7 +73,7 @@ def _init_config():
|
|
|
73
73
|
@click.option("--init", is_flag=True, help="Initialize a configuration file in current directory")
|
|
74
74
|
@click.option("--enable-log", is_flag=True, help="Enable logging to file")
|
|
75
75
|
@click.option("--log-level", default="INFO", help="Log level (DEBUG/INFO/WARNING/ERROR)")
|
|
76
|
-
@click.option("--log-file", help="Path to log file (default:
|
|
76
|
+
@click.option("--log-file", help="Path to log file (default: ./.mtr/logs/mtr_YYYYMMDD_HHMMSS.log)")
|
|
77
77
|
@click.option("--get", "remote_get_path", help="Remote path to download from")
|
|
78
78
|
@click.option("--to", "local_dest_path", help="Local destination path for download (optional)")
|
|
79
79
|
@click.argument("command", nargs=-1, type=click.UNPROCESSED)
|
|
@@ -86,9 +86,9 @@ def cli(server, sync, dry_run, tty, init, enable_log, log_level, log_file, remot
|
|
|
86
86
|
# Setup logging if enabled
|
|
87
87
|
if enable_log:
|
|
88
88
|
if not log_file:
|
|
89
|
-
# Generate default log file path:
|
|
89
|
+
# Generate default log file path: ./.mtr/logs/mtr_YYYYMMDD_HHMMSS.log
|
|
90
90
|
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
|
91
|
-
log_dir = os.path.
|
|
91
|
+
log_dir = os.path.join(os.getcwd(), ".mtr/logs")
|
|
92
92
|
log_file = os.path.join(log_dir, f"mtr_{timestamp}.log")
|
|
93
93
|
|
|
94
94
|
try:
|
|
@@ -238,6 +238,13 @@ def cli(server, sync, dry_run, tty, init, enable_log, log_level, log_file, remot
|
|
|
238
238
|
|
|
239
239
|
# 3. Download from remote (if --get is specified)
|
|
240
240
|
if remote_get_path:
|
|
241
|
+
# Resolve relative remote path from remote_dir
|
|
242
|
+
if not remote_get_path.startswith("/"):
|
|
243
|
+
if not remote_dir:
|
|
244
|
+
click.secho("Error: 'remote_dir' is required for relative --get path.", fg="red", err=True)
|
|
245
|
+
sys.exit(1)
|
|
246
|
+
remote_get_path = os.path.join(remote_dir, remote_get_path)
|
|
247
|
+
|
|
241
248
|
# Resolve local destination path
|
|
242
249
|
if cli_dest:
|
|
243
250
|
local_dest = cli_dest
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mtr-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: A CLI tool for seamless local development and remote execution on GPU servers.
|
|
5
5
|
Project-URL: Homepage, https://github.com/lecoan/mtremote
|
|
6
6
|
Project-URL: Repository, https://github.com/lecoan/mtremote
|
|
@@ -25,7 +25,7 @@ Requires-Dist: pyyaml>=6.0
|
|
|
25
25
|
Requires-Dist: rich>=12.0.0
|
|
26
26
|
Description-Content-Type: text/markdown
|
|
27
27
|
|
|
28
|
-
# MTRemote (mtr)
|
|
28
|
+
# MTRemote (mtr-cli)
|
|
29
29
|
|
|
30
30
|
MTRemote 是一个专为 AI Infra 和 Python/C++ 混合开发设计的命令行工具。它允许你在本地修改代码,通过简单的 `mtr` 前缀,自动将代码同步到远端 GPU 服务器并执行命令,同时保留本地的交互体验(实时日志、颜色高亮、Ctrl+C 支持)。
|
|
31
31
|
|
|
@@ -48,9 +48,9 @@ MTRemote 是一个专为 AI Infra 和 Python/C++ 混合开发设计的命令行
|
|
|
48
48
|
推荐使用 `uv` 或 `pipx` 安装:
|
|
49
49
|
|
|
50
50
|
```bash
|
|
51
|
-
uv tool install
|
|
51
|
+
uv tool install mtr-cli
|
|
52
52
|
# 或者
|
|
53
|
-
pip install
|
|
53
|
+
pip install mtr-cli
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
### 系统依赖
|
|
@@ -129,7 +129,7 @@ Options:
|
|
|
129
129
|
--to TEXT Local destination path for download (optional)
|
|
130
130
|
--enable-log Enable logging to file
|
|
131
131
|
--log-level TEXT Log level: DEBUG/INFO/WARNING/ERROR [default: INFO]
|
|
132
|
-
--log-file PATH Custom log file path (default:
|
|
132
|
+
--log-file PATH Custom log file path (default: ./.mtr/logs/mtr_YYYYMMDD_HHMMSS.log)
|
|
133
133
|
--init Initialize configuration file
|
|
134
134
|
--help Show this message and exit
|
|
135
135
|
```
|
|
@@ -192,9 +192,12 @@ sudo yum install sshpass
|
|
|
192
192
|
使用 `--get` 参数可以从远端服务器下载文件或文件夹到本地:
|
|
193
193
|
|
|
194
194
|
```bash
|
|
195
|
-
#
|
|
195
|
+
# 下载文件(绝对路径)
|
|
196
196
|
mtr --get /remote/path/to/file.txt
|
|
197
197
|
|
|
198
|
+
# 下载文件(相对路径,基于 remote_dir)
|
|
199
|
+
mtr --get checkpoints/model.pt
|
|
200
|
+
|
|
198
201
|
# 下载文件到指定位置
|
|
199
202
|
mtr --get /remote/path/to/file.txt --to ./local/path/
|
|
200
203
|
|
|
@@ -205,6 +208,10 @@ mtr --get /remote/path/to/checkpoints/ --to ./backups/
|
|
|
205
208
|
mtr --no-sync --get /remote/path/to/file.txt
|
|
206
209
|
```
|
|
207
210
|
|
|
211
|
+
**路径解析规则**:
|
|
212
|
+
- **绝对路径**(以 `/` 开头):直接使用指定的完整路径
|
|
213
|
+
- **相对路径**:自动拼接 `remote_dir`,例如配置 `remote_dir: "/workdir/project"`,执行 `--get checkpoints/model.pt` 将下载 `/workdir/project/checkpoints/model.pt`
|
|
214
|
+
|
|
208
215
|
**配置下载目录**:
|
|
209
216
|
可以在配置文件中设置默认下载位置:
|
|
210
217
|
|
|
@@ -235,7 +242,7 @@ mtr --enable-log python train.py
|
|
|
235
242
|
mtr --enable-log --log-level DEBUG python train.py
|
|
236
243
|
|
|
237
244
|
# 查看日志
|
|
238
|
-
cat
|
|
245
|
+
cat ./.mtr/logs/mtr_20260128_171216.log
|
|
239
246
|
```
|
|
240
247
|
|
|
241
248
|
日志文件按会话独立生成,格式为 `mtr_YYYYMMDD_HHMMSS.log`,包含:
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
mtr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
mtr/cli.py,sha256=
|
|
2
|
+
mtr/cli.py,sha256=lhK5hoOlMSp5kAhiqYvmWGfDdyUozELDKgk1x1LjFwI,13910
|
|
3
3
|
mtr/config.py,sha256=v1lUg7z12jb-W0B61KKwiLuP6BO3I6ZLZSqxPSoAi7A,3037
|
|
4
4
|
mtr/logger.py,sha256=9DPKTTzYsNMF7vXnvJ0bJditNYgzhZWHwLKUErtwCBY,3669
|
|
5
5
|
mtr/ssh.py,sha256=fCEXxfEK6ao8YrCU9FBJ_e5zrK93AKz6bgjXWkORQkk,7170
|
|
6
6
|
mtr/sync.py,sha256=LvfGs7wGzlU-RSHsXF8IQ_LK70yYPnw-sqVEGqLknHQ,11799
|
|
7
|
-
mtr_cli-0.
|
|
8
|
-
mtr_cli-0.
|
|
9
|
-
mtr_cli-0.
|
|
10
|
-
mtr_cli-0.
|
|
11
|
-
mtr_cli-0.
|
|
7
|
+
mtr_cli-0.2.0.dist-info/METADATA,sha256=ZhfL78GWsse8Q1Ml17SqdOa2V2HUZwS9Tvl6kIKSMeU,9458
|
|
8
|
+
mtr_cli-0.2.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
9
|
+
mtr_cli-0.2.0.dist-info/entry_points.txt,sha256=8BRK0VoSAWGzovrOdzWqpwwNj-dmjVY1iQcz5MQseV4,36
|
|
10
|
+
mtr_cli-0.2.0.dist-info/licenses/LICENSE,sha256=PkuO1VHNDkFylFSOtMADb93mjExarK6DBTjtCB3kBeU,1067
|
|
11
|
+
mtr_cli-0.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|