mtr-cli 0.1.0__tar.gz → 0.2.0__tar.gz

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.
Files changed (29) hide show
  1. {mtr_cli-0.1.0 → mtr_cli-0.2.0}/PKG-INFO +14 -7
  2. {mtr_cli-0.1.0 → mtr_cli-0.2.0}/README.md +13 -6
  3. {mtr_cli-0.1.0 → mtr_cli-0.2.0}/mtr/cli.py +10 -3
  4. {mtr_cli-0.1.0 → mtr_cli-0.2.0}/pyproject.toml +1 -1
  5. {mtr_cli-0.1.0 → mtr_cli-0.2.0}/uv.lock +1 -1
  6. {mtr_cli-0.1.0 → mtr_cli-0.2.0}/.gitignore +0 -0
  7. {mtr_cli-0.1.0 → mtr_cli-0.2.0}/.pre-commit-config.yaml +0 -0
  8. {mtr_cli-0.1.0 → mtr_cli-0.2.0}/.python-version +0 -0
  9. {mtr_cli-0.1.0 → mtr_cli-0.2.0}/AGENTS.md +0 -0
  10. {mtr_cli-0.1.0 → mtr_cli-0.2.0}/LICENSE +0 -0
  11. {mtr_cli-0.1.0 → mtr_cli-0.2.0}/examples/config.yaml +0 -0
  12. {mtr_cli-0.1.0 → mtr_cli-0.2.0}/mtr/__init__.py +0 -0
  13. {mtr_cli-0.1.0 → mtr_cli-0.2.0}/mtr/config.py +0 -0
  14. {mtr_cli-0.1.0 → mtr_cli-0.2.0}/mtr/logger.py +0 -0
  15. {mtr_cli-0.1.0 → mtr_cli-0.2.0}/mtr/ssh.py +0 -0
  16. {mtr_cli-0.1.0 → mtr_cli-0.2.0}/mtr/sync.py +0 -0
  17. {mtr_cli-0.1.0 → mtr_cli-0.2.0}/tests/__init__.py +0 -0
  18. {mtr_cli-0.1.0 → mtr_cli-0.2.0}/tests/conftest.py +0 -0
  19. {mtr_cli-0.1.0 → mtr_cli-0.2.0}/tests/integration/__init__.py +0 -0
  20. {mtr_cli-0.1.0 → mtr_cli-0.2.0}/tests/integration/test_cli_flow.py +0 -0
  21. {mtr_cli-0.1.0 → mtr_cli-0.2.0}/tests/integration/test_cli_phase1.py +0 -0
  22. {mtr_cli-0.1.0 → mtr_cli-0.2.0}/tests/unit/__init__.py +0 -0
  23. {mtr_cli-0.1.0 → mtr_cli-0.2.0}/tests/unit/test_config.py +0 -0
  24. {mtr_cli-0.1.0 → mtr_cli-0.2.0}/tests/unit/test_logger.py +0 -0
  25. {mtr_cli-0.1.0 → mtr_cli-0.2.0}/tests/unit/test_ssh.py +0 -0
  26. {mtr_cli-0.1.0 → mtr_cli-0.2.0}/tests/unit/test_ssh_interactive.py +0 -0
  27. {mtr_cli-0.1.0 → mtr_cli-0.2.0}/tests/unit/test_ssh_pre_cmd.py +0 -0
  28. {mtr_cli-0.1.0 → mtr_cli-0.2.0}/tests/unit/test_sync_rsync.py +0 -0
  29. {mtr_cli-0.1.0 → mtr_cli-0.2.0}/tests/unit/test_sync_sftp.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mtr-cli
3
- Version: 0.1.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 mtremote
51
+ uv tool install mtr-cli
52
52
  # 或者
53
- pip install mtremote
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: ~/.mtr/logs/mtr_YYYYMMDD_HHMMSS.log)
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 ~/.mtr/logs/mtr_20260128_171216.log
245
+ cat ./.mtr/logs/mtr_20260128_171216.log
239
246
  ```
240
247
 
241
248
  日志文件按会话独立生成,格式为 `mtr_YYYYMMDD_HHMMSS.log`,包含:
@@ -1,4 +1,4 @@
1
- # MTRemote (mtr)
1
+ # MTRemote (mtr-cli)
2
2
 
3
3
  MTRemote 是一个专为 AI Infra 和 Python/C++ 混合开发设计的命令行工具。它允许你在本地修改代码,通过简单的 `mtr` 前缀,自动将代码同步到远端 GPU 服务器并执行命令,同时保留本地的交互体验(实时日志、颜色高亮、Ctrl+C 支持)。
4
4
 
@@ -21,9 +21,9 @@ MTRemote 是一个专为 AI Infra 和 Python/C++ 混合开发设计的命令行
21
21
  推荐使用 `uv` 或 `pipx` 安装:
22
22
 
23
23
  ```bash
24
- uv tool install mtremote
24
+ uv tool install mtr-cli
25
25
  # 或者
26
- pip install mtremote
26
+ pip install mtr-cli
27
27
  ```
28
28
 
29
29
  ### 系统依赖
@@ -102,7 +102,7 @@ Options:
102
102
  --to TEXT Local destination path for download (optional)
103
103
  --enable-log Enable logging to file
104
104
  --log-level TEXT Log level: DEBUG/INFO/WARNING/ERROR [default: INFO]
105
- --log-file PATH Custom log file path (default: ~/.mtr/logs/mtr_YYYYMMDD_HHMMSS.log)
105
+ --log-file PATH Custom log file path (default: ./.mtr/logs/mtr_YYYYMMDD_HHMMSS.log)
106
106
  --init Initialize configuration file
107
107
  --help Show this message and exit
108
108
  ```
@@ -165,9 +165,12 @@ sudo yum install sshpass
165
165
  使用 `--get` 参数可以从远端服务器下载文件或文件夹到本地:
166
166
 
167
167
  ```bash
168
- # 下载文件到当前目录
168
+ # 下载文件(绝对路径)
169
169
  mtr --get /remote/path/to/file.txt
170
170
 
171
+ # 下载文件(相对路径,基于 remote_dir)
172
+ mtr --get checkpoints/model.pt
173
+
171
174
  # 下载文件到指定位置
172
175
  mtr --get /remote/path/to/file.txt --to ./local/path/
173
176
 
@@ -178,6 +181,10 @@ mtr --get /remote/path/to/checkpoints/ --to ./backups/
178
181
  mtr --no-sync --get /remote/path/to/file.txt
179
182
  ```
180
183
 
184
+ **路径解析规则**:
185
+ - **绝对路径**(以 `/` 开头):直接使用指定的完整路径
186
+ - **相对路径**:自动拼接 `remote_dir`,例如配置 `remote_dir: "/workdir/project"`,执行 `--get checkpoints/model.pt` 将下载 `/workdir/project/checkpoints/model.pt`
187
+
181
188
  **配置下载目录**:
182
189
  可以在配置文件中设置默认下载位置:
183
190
 
@@ -208,7 +215,7 @@ mtr --enable-log python train.py
208
215
  mtr --enable-log --log-level DEBUG python train.py
209
216
 
210
217
  # 查看日志
211
- cat ~/.mtr/logs/mtr_20260128_171216.log
218
+ cat ./.mtr/logs/mtr_20260128_171216.log
212
219
  ```
213
220
 
214
221
  日志文件按会话独立生成,格式为 `mtr_YYYYMMDD_HHMMSS.log`,包含:
@@ -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: ~/.mtr/logs/mtr_YYYYMMDD_HHMMSS.log)")
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: ~/.mtr/logs/mtr_YYYYMMDD_HHMMSS.log
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.expanduser("~/.mtr/logs")
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
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "mtr-cli"
7
- version = "0.1.0"
7
+ version = "0.2.0"
8
8
  description = "A CLI tool for seamless local development and remote execution on GPU servers."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -328,7 +328,7 @@ wheels = [
328
328
  ]
329
329
 
330
330
  [[package]]
331
- name = "mtremote"
331
+ name = "mtr-cli"
332
332
  version = "0.1.0"
333
333
  source = { editable = "." }
334
334
  dependencies = [
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes