replx 1.0.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.
- replx-1.0.0/LICENSE +21 -0
- replx-1.0.0/PKG-INFO +421 -0
- replx-1.0.0/README.md +374 -0
- replx-1.0.0/pyproject.toml +46 -0
- replx-1.0.0/replx/__init__.py +11 -0
- replx-1.0.0/replx/exceptions.py +14 -0
- replx-1.0.0/replx/file_system.py +514 -0
- replx-1.0.0/replx/helpers.py +816 -0
- replx-1.0.0/replx/repl_protocol.py +901 -0
- replx-1.0.0/replx/replx.py +1569 -0
- replx-1.0.0/replx/terminal.py +241 -0
- replx-1.0.0/replx.egg-info/PKG-INFO +421 -0
- replx-1.0.0/replx.egg-info/SOURCES.txt +16 -0
- replx-1.0.0/replx.egg-info/dependency_links.txt +1 -0
- replx-1.0.0/replx.egg-info/entry_points.txt +2 -0
- replx-1.0.0/replx.egg-info/requires.txt +5 -0
- replx-1.0.0/replx.egg-info/top_level.txt +1 -0
- replx-1.0.0/setup.cfg +4 -0
replx-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 chanmin.park
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
replx-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: replx
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: replx is a fast, modern MicroPython CLI: turbo REPL, robust file sync (put/get), project install, mpy-cross integration, and smart port discovery.
|
|
5
|
+
Author-email: "chanmin.park" <devcamp@gmail.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2024 chanmin.park
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
Project-URL: Homepage, https://github.com/PlanXLab/replx
|
|
28
|
+
Project-URL: Repository, https://github.com/PlanXLab/replx
|
|
29
|
+
Project-URL: Issues, https://github.com/PlanXLab/replx/issues
|
|
30
|
+
Keywords: micropython,repl,serial,pyserial,typer,mpy-cross,deploy
|
|
31
|
+
Classifier: Environment :: Console
|
|
32
|
+
Classifier: Programming Language :: Python :: 3
|
|
33
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
34
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
35
|
+
Classifier: Operating System :: OS Independent
|
|
36
|
+
Classifier: Topic :: Software Development :: Embedded Systems
|
|
37
|
+
Classifier: Topic :: System :: Hardware :: Universal Serial Bus (USB)
|
|
38
|
+
Requires-Python: >=3.10
|
|
39
|
+
Description-Content-Type: text/markdown
|
|
40
|
+
License-File: LICENSE
|
|
41
|
+
Requires-Dist: typer>=0.12
|
|
42
|
+
Requires-Dist: rich>=13.0
|
|
43
|
+
Requires-Dist: pyserial>=3.5
|
|
44
|
+
Requires-Dist: genlib>=0.6
|
|
45
|
+
Requires-Dist: mpy-cross>=1.26
|
|
46
|
+
Dynamic: license-file
|
|
47
|
+
|
|
48
|
+
# replx User Manual
|
|
49
|
+
|
|
50
|
+
## Overview
|
|
51
|
+
**replx** is a powerful command-line tool designed for interacting with MicroPython REPL over serial connections. It provides a unified interface for managing files, running scripts, inspecting device status, and maintaining synchronized development environments in VS Code.
|
|
52
|
+
|
|
53
|
+
This manual guides you through all available commands, usage patterns, and workflow integration strategies.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Installation & Setup
|
|
58
|
+
|
|
59
|
+
### Requirements
|
|
60
|
+
- Python 3.10 or newer
|
|
61
|
+
- `pyserial`, `click`, `mpy-cross` and `genlib` Python packages
|
|
62
|
+
- Supported OS: Windows, Linux, macOS
|
|
63
|
+
|
|
64
|
+
### Installation
|
|
65
|
+
```bash
|
|
66
|
+
pip install replx
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Connecting Your Board
|
|
70
|
+
Before any command can run, ensure your MicroPython device is connected via USB and note the serial port name (e.g., `COM3`, `/dev/ttyACM0`).
|
|
71
|
+
|
|
72
|
+
You can verify available boards:
|
|
73
|
+
```bash
|
|
74
|
+
replx scan
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Setting Up the VSCode Environment
|
|
78
|
+
To initialize a VSCode workspace for a connected device:
|
|
79
|
+
```bash
|
|
80
|
+
replx -p <port> env
|
|
81
|
+
```
|
|
82
|
+
This creates `.vscode/.env` with your serial configuration, along with default `tasks.json`, `settings.json`, and `launch.json`.
|
|
83
|
+
|
|
84
|
+
You can force regeneration with:
|
|
85
|
+
```bash
|
|
86
|
+
replx -p <port> env <device_name>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Command Syntax
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
replx [OPTIONS] COMMAND [ARGS]...
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Globla Options
|
|
96
|
+
|
|
97
|
+
Option | Description
|
|
98
|
+
-------|-------------------
|
|
99
|
+
-p, --port | Serial port name of the connected device
|
|
100
|
+
-c, --command | Execute a raw command directly on the device
|
|
101
|
+
-v, --version | Show version and exit
|
|
102
|
+
--help | Show help message and exit
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Commands
|
|
107
|
+
|
|
108
|
+
### `scan`
|
|
109
|
+
Scan for connected MicroPython boards.
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
replx scan
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Options:**
|
|
116
|
+
- `--raw` – show raw firmware info (full MicroPython banner)
|
|
117
|
+
|
|
118
|
+
**Example Output:**
|
|
119
|
+
```
|
|
120
|
+
COM10 1.25 2025-01-15 ticle
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
### `port`
|
|
126
|
+
View or set the serial port used by replx.
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
replx port [PORT_NAME]
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
If no argument is given, displays the current configured port.
|
|
133
|
+
|
|
134
|
+
**Examples:**
|
|
135
|
+
```bash
|
|
136
|
+
replx port
|
|
137
|
+
replx port COM9
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
### `get`
|
|
143
|
+
Download a file from the device.
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
replx get <remote> [local]
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Example:**
|
|
150
|
+
```bash
|
|
151
|
+
replx get /main.py ./backup_main.py
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
### `put`
|
|
157
|
+
Upload files or directories to the device.
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
replx put <local> [remote]
|
|
161
|
+
```
|
|
162
|
+
Automatically creates directories if missing.
|
|
163
|
+
|
|
164
|
+
**Examples:**
|
|
165
|
+
```bash
|
|
166
|
+
replx put main.py
|
|
167
|
+
replx put foo.py lib/
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
### `ls`
|
|
173
|
+
List files and directories on the device.
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
replx ls [path]
|
|
177
|
+
```
|
|
178
|
+
Shows detailed file information including size and icons.
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
### `mkdir`
|
|
183
|
+
Create a directory on the device.
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
replx mkdir <remote_dir>
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
### `rm`
|
|
192
|
+
Remove a file or directory (recursively).
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
replx rm <remote_path>
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
### `df`
|
|
201
|
+
Display filesystem usage (total, used, free, percentage).
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
replx df
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
### `mem`
|
|
210
|
+
Display MicroPython memory statistics.
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
replx mem
|
|
214
|
+
```
|
|
215
|
+
Shows `free`, `allocated`, `total`, and usage percent.
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
### `run`
|
|
220
|
+
Execute a local Python script on the device.
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
replx run <file.py> [options]
|
|
224
|
+
```
|
|
225
|
+
**Options:**
|
|
226
|
+
- `-n`, `--non-interactive`: Run without REPL interaction
|
|
227
|
+
- `-e`, `--echo`: Enable local echo for interactive mode
|
|
228
|
+
|
|
229
|
+
**Example:**
|
|
230
|
+
```bash
|
|
231
|
+
replx run test_led.py -e
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
> **Shortcut:** Simply typing `myscript.py` automatically invokes `run`.
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
### `repl`
|
|
239
|
+
Enter device REPL interactively.
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
replx repl
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
Exit with **Ctrl+C**.
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
### `format`
|
|
250
|
+
Format the device’s filesystem.
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
replx format
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Shows a progress indicator until completion.
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
### `reset`
|
|
261
|
+
Perform a soft reset on the device.
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
replx reset
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
### `shell`
|
|
270
|
+
Interactive command-line shell for device management.
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
replx shell
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
Inside the shell, you can use commands like:
|
|
277
|
+
|
|
278
|
+
```
|
|
279
|
+
ls, cd, get, put, rm, mkdir, df, pwd, repl, clear, exit
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
Example session:
|
|
283
|
+
```
|
|
284
|
+
📟 ticle:/ > ls
|
|
285
|
+
📁 lib
|
|
286
|
+
📄 main.py
|
|
287
|
+
📟 ticle:/ > get main.py
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
### `update`
|
|
293
|
+
Update local library cache from GitHub.
|
|
294
|
+
|
|
295
|
+
```bash
|
|
296
|
+
replx update [device] [--owner <org>] [--repo <name>] [--ref <branch>]
|
|
297
|
+
```
|
|
298
|
+
Downloads and synchronizes `.py` sources for both `core` and `device` components.
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
### `install`
|
|
303
|
+
Install libraries or files onto the device.
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
replx install [SPEC]
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
**SPEC Examples:**
|
|
310
|
+
| SPEC | Description |
|
|
311
|
+
|------|--------------|
|
|
312
|
+
| *(empty)* | Install all core/device libs |
|
|
313
|
+
| `core/` | Install only core libraries |
|
|
314
|
+
| `device/` | Install only device-specific libraries |
|
|
315
|
+
| `./foo.py` | Upload and compile a single file |
|
|
316
|
+
| `https://.../file.py` | Download and install from URL |
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
### `search`
|
|
321
|
+
Search for libraries in the remote registry.
|
|
322
|
+
|
|
323
|
+
```bash
|
|
324
|
+
replx search [lib_name] [--owner] [--repo] [--ref]
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
**Example:**
|
|
328
|
+
```bash
|
|
329
|
+
replx search BME68x
|
|
330
|
+
```
|
|
331
|
+
Shows available library versions and update status (`*` marks newer remote versions).
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
## Automatic Update Check
|
|
336
|
+
On startup, replx checks PyPI for new releases and offers in-place upgrade:
|
|
337
|
+
```bash
|
|
338
|
+
A newer version (1.2.0) is available. Update now? (y/n):
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
## Error Handling
|
|
344
|
+
When a MicroPython traceback occurs, replx automatically reformats and maps `<stdin>` references to your local file paths for clarity.
|
|
345
|
+
|
|
346
|
+
Example error output:
|
|
347
|
+
```
|
|
348
|
+
--------------------------------Traceback--------------------------------
|
|
349
|
+
File "C:\project\main.py", line 22
|
|
350
|
+
sensor.read()
|
|
351
|
+
ValueError: I2C bus error
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
---
|
|
355
|
+
|
|
356
|
+
## Environment Integration
|
|
357
|
+
|
|
358
|
+
### `.vscode/.env` Example
|
|
359
|
+
```
|
|
360
|
+
SERIAL_PORT=COM10
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
### File Mappings
|
|
364
|
+
| Type | Target on Device |
|
|
365
|
+
|------|------------------|
|
|
366
|
+
| `main.py` | `/main.mpy` |
|
|
367
|
+
| `boot.py` | `/boot.mpy` |
|
|
368
|
+
| Libraries | `/lib/...` |
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
## Troubleshooting
|
|
373
|
+
|
|
374
|
+
| Problem | Cause | Solution |
|
|
375
|
+
|----------|--------|-----------|
|
|
376
|
+
| `Device not found` | Incorrect serial port | Run `scan` and verify port |
|
|
377
|
+
| `could not enter raw repl` | Board busy or sleeping | Reset the board and retry |
|
|
378
|
+
| `Download incomplete` | Serial timeout | Check cable and reduce baud rate |
|
|
379
|
+
|
|
380
|
+
---
|
|
381
|
+
|
|
382
|
+
## Versioning & Licensing
|
|
383
|
+
- **Author:** PlanX Lab Development Team
|
|
384
|
+
- **License:** MIT License
|
|
385
|
+
- **Version:** Displayed via `--version`
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
389
|
+
## Quick Reference Table
|
|
390
|
+
|
|
391
|
+
| Command | Description |
|
|
392
|
+
|----------|-------------|
|
|
393
|
+
| `scan` | Detect connected boards |
|
|
394
|
+
| `port` | Show/set current serial port |
|
|
395
|
+
| `get` | Download file from device |
|
|
396
|
+
| `put` | Upload file or folder |
|
|
397
|
+
| `ls` | List directory contents |
|
|
398
|
+
| `run` | Execute a local script |
|
|
399
|
+
| `repl` | Open interactive REPL |
|
|
400
|
+
| `mem` | Show memory usage |
|
|
401
|
+
| `df` | Show filesystem usage |
|
|
402
|
+
| `mkdir` | Create directory |
|
|
403
|
+
| `rm` | Delete file/folder |
|
|
404
|
+
| `update` | Sync libraries from GitHub |
|
|
405
|
+
| `install` | Install libraries/files |
|
|
406
|
+
| `shell` | Interactive management shell |
|
|
407
|
+
| `format` | Format filesystem |
|
|
408
|
+
| `env` | Setup VSCode environment |
|
|
409
|
+
| `reset` | Soft reset the device |
|
|
410
|
+
|
|
411
|
+
---
|
|
412
|
+
|
|
413
|
+
## Notes
|
|
414
|
+
- All commands automatically load `.vscode/.env` if present.
|
|
415
|
+
- Serial interruption (Ctrl+C) is supported on both Windows and POSIX systems.
|
|
416
|
+
- Batch upload/download operations display progress bars.
|
|
417
|
+
|
|
418
|
+
---
|
|
419
|
+
|
|
420
|
+
**End of Manual**
|
|
421
|
+
|