sdev 0.2.1__tar.gz → 0.2.2__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.
sdev-0.2.2/PKG-INFO ADDED
@@ -0,0 +1,77 @@
1
+ Metadata-Version: 2.4
2
+ Name: sdev
3
+ Version: 0.2.2
4
+ Summary: 串口控制器工具包
5
+ Home-page: https://github.com/klrc/sdev
6
+ Author: klrc
7
+ Author-email: klrc <144069824@qq.com>
8
+ License: MIT
9
+ Project-URL: Homepage, https://github.com/klrc/sdev
10
+ Project-URL: Repository, https://github.com/klrc/sdev
11
+ Project-URL: Bug Tracker, https://github.com/klrc/sdev/issues
12
+ Keywords: serial,controller,hardware,embedded
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.7
19
+ Classifier: Programming Language :: Python :: 3.8
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Classifier: Topic :: System :: Hardware
25
+ Requires-Python: >=3.7
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: pyserial>=3.5
29
+ Requires-Dist: loguru>=0.6.0
30
+ Dynamic: author
31
+ Dynamic: home-page
32
+ Dynamic: license-file
33
+ Dynamic: requires-python
34
+
35
+ # SDEV
36
+
37
+ 串口开发板控制器工具包:后台异步读缓冲、按行/按 flag 读、回显着色、组合命令、存活检测。
38
+
39
+ ## 安装
40
+
41
+ ```bash
42
+ pip install sdev
43
+ ```
44
+
45
+ ## 快速使用
46
+
47
+ ```python
48
+ from sdev import Demoboard
49
+
50
+ with Demoboard("/dev/ttyUSB0", 115200) as board:
51
+ board.check_alive("~ #") # 确认板子存活(未接则轮询等待)
52
+ out = board.execute_command("ls") # 发命令并收到提示符为止,返回输出列表
53
+ print(out)
54
+ ```
55
+
56
+ ## 主要接口
57
+
58
+ | 方法 | 说明 |
59
+ |------|------|
60
+ | `connect()` / `disconnect()` | 打开/关闭串口并启停后台读线程 |
61
+ | `send(text)` | 发送一行(自动加换行);`text` 不得含换行符 |
62
+ | `read(display=..., timeout=...)` | 消费缓冲直至断开或超时,返回行列表 |
63
+ | `read_until(flag, timeout=..., skip_echo_of=...)` | 读到含 `flag` 且非「命令回显」的行为止 |
64
+ | `execute_command(cmd, flag=" #", stream=False, ...)` | 先 `clear()` 再 `send(cmd)` 再 `read_until(flag, skip_echo_of=cmd)` |
65
+ | `check_alive(reboot_flag=..., prompt_flag=" #", ...)` | 有缓冲数据或能响应 Ctrl-C 即视为存活;超时则轮询等待 |
66
+ | `clear()` | 清空读缓冲(保留 disconnect 用 sentinel) |
67
+ | `send_interrupt(prompt_flag=..., timeout=...)` | 发 Ctrl-C 并等到含 `prompt_flag` 的提示行 |
68
+
69
+ - 使用 `stream_read` / `stream_read_until` 可逐行迭代;`read` / `read_until` 为列表版。
70
+ - `display=True` 时:本机发送回显为青色,匹配 flag 行为绿色,其余为灰色;板端折行会拼成一行再显示。
71
+
72
+ ## 特性
73
+
74
+ - 后台线程读串口入队,主流程不阻塞
75
+ - 不假定提示符左边格式(如 `~ #` / ` #` 均可),通过 `skip_echo_of` 区分命令回显与提示行
76
+ - 超时在底层 `get(timeout=...)` 实现,可靠
77
+ - 依赖:Python >= 3.7,pyserial >= 3.5,loguru >= 0.6.0
sdev-0.2.2/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # SDEV
2
+
3
+ 串口开发板控制器工具包:后台异步读缓冲、按行/按 flag 读、回显着色、组合命令、存活检测。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ pip install sdev
9
+ ```
10
+
11
+ ## 快速使用
12
+
13
+ ```python
14
+ from sdev import Demoboard
15
+
16
+ with Demoboard("/dev/ttyUSB0", 115200) as board:
17
+ board.check_alive("~ #") # 确认板子存活(未接则轮询等待)
18
+ out = board.execute_command("ls") # 发命令并收到提示符为止,返回输出列表
19
+ print(out)
20
+ ```
21
+
22
+ ## 主要接口
23
+
24
+ | 方法 | 说明 |
25
+ |------|------|
26
+ | `connect()` / `disconnect()` | 打开/关闭串口并启停后台读线程 |
27
+ | `send(text)` | 发送一行(自动加换行);`text` 不得含换行符 |
28
+ | `read(display=..., timeout=...)` | 消费缓冲直至断开或超时,返回行列表 |
29
+ | `read_until(flag, timeout=..., skip_echo_of=...)` | 读到含 `flag` 且非「命令回显」的行为止 |
30
+ | `execute_command(cmd, flag=" #", stream=False, ...)` | 先 `clear()` 再 `send(cmd)` 再 `read_until(flag, skip_echo_of=cmd)` |
31
+ | `check_alive(reboot_flag=..., prompt_flag=" #", ...)` | 有缓冲数据或能响应 Ctrl-C 即视为存活;超时则轮询等待 |
32
+ | `clear()` | 清空读缓冲(保留 disconnect 用 sentinel) |
33
+ | `send_interrupt(prompt_flag=..., timeout=...)` | 发 Ctrl-C 并等到含 `prompt_flag` 的提示行 |
34
+
35
+ - 使用 `stream_read` / `stream_read_until` 可逐行迭代;`read` / `read_until` 为列表版。
36
+ - `display=True` 时:本机发送回显为青色,匹配 flag 行为绿色,其余为灰色;板端折行会拼成一行再显示。
37
+
38
+ ## 特性
39
+
40
+ - 后台线程读串口入队,主流程不阻塞
41
+ - 不假定提示符左边格式(如 `~ #` / ` #` 均可),通过 `skip_echo_of` 区分命令回显与提示行
42
+ - 超时在底层 `get(timeout=...)` 实现,可靠
43
+ - 依赖:Python >= 3.7,pyserial >= 3.5,loguru >= 0.6.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "sdev"
7
- version = "0.2.1"
7
+ version = "0.2.2"
8
8
  description = "串口控制器工具包"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -6,7 +6,7 @@ Demoboard:串口连接、后台异步读、发送、按行/按 flag 读、回
6
6
 
7
7
  from .demoboard import Demoboard
8
8
 
9
- __version__ = "0.2.1"
9
+ __version__ = "0.2.2"
10
10
  __author__ = "klrc"
11
11
  __email__ = "144069824@qq.com"
12
12
 
@@ -0,0 +1,77 @@
1
+ Metadata-Version: 2.4
2
+ Name: sdev
3
+ Version: 0.2.2
4
+ Summary: 串口控制器工具包
5
+ Home-page: https://github.com/klrc/sdev
6
+ Author: klrc
7
+ Author-email: klrc <144069824@qq.com>
8
+ License: MIT
9
+ Project-URL: Homepage, https://github.com/klrc/sdev
10
+ Project-URL: Repository, https://github.com/klrc/sdev
11
+ Project-URL: Bug Tracker, https://github.com/klrc/sdev/issues
12
+ Keywords: serial,controller,hardware,embedded
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.7
19
+ Classifier: Programming Language :: Python :: 3.8
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Classifier: Topic :: System :: Hardware
25
+ Requires-Python: >=3.7
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: pyserial>=3.5
29
+ Requires-Dist: loguru>=0.6.0
30
+ Dynamic: author
31
+ Dynamic: home-page
32
+ Dynamic: license-file
33
+ Dynamic: requires-python
34
+
35
+ # SDEV
36
+
37
+ 串口开发板控制器工具包:后台异步读缓冲、按行/按 flag 读、回显着色、组合命令、存活检测。
38
+
39
+ ## 安装
40
+
41
+ ```bash
42
+ pip install sdev
43
+ ```
44
+
45
+ ## 快速使用
46
+
47
+ ```python
48
+ from sdev import Demoboard
49
+
50
+ with Demoboard("/dev/ttyUSB0", 115200) as board:
51
+ board.check_alive("~ #") # 确认板子存活(未接则轮询等待)
52
+ out = board.execute_command("ls") # 发命令并收到提示符为止,返回输出列表
53
+ print(out)
54
+ ```
55
+
56
+ ## 主要接口
57
+
58
+ | 方法 | 说明 |
59
+ |------|------|
60
+ | `connect()` / `disconnect()` | 打开/关闭串口并启停后台读线程 |
61
+ | `send(text)` | 发送一行(自动加换行);`text` 不得含换行符 |
62
+ | `read(display=..., timeout=...)` | 消费缓冲直至断开或超时,返回行列表 |
63
+ | `read_until(flag, timeout=..., skip_echo_of=...)` | 读到含 `flag` 且非「命令回显」的行为止 |
64
+ | `execute_command(cmd, flag=" #", stream=False, ...)` | 先 `clear()` 再 `send(cmd)` 再 `read_until(flag, skip_echo_of=cmd)` |
65
+ | `check_alive(reboot_flag=..., prompt_flag=" #", ...)` | 有缓冲数据或能响应 Ctrl-C 即视为存活;超时则轮询等待 |
66
+ | `clear()` | 清空读缓冲(保留 disconnect 用 sentinel) |
67
+ | `send_interrupt(prompt_flag=..., timeout=...)` | 发 Ctrl-C 并等到含 `prompt_flag` 的提示行 |
68
+
69
+ - 使用 `stream_read` / `stream_read_until` 可逐行迭代;`read` / `read_until` 为列表版。
70
+ - `display=True` 时:本机发送回显为青色,匹配 flag 行为绿色,其余为灰色;板端折行会拼成一行再显示。
71
+
72
+ ## 特性
73
+
74
+ - 后台线程读串口入队,主流程不阻塞
75
+ - 不假定提示符左边格式(如 `~ #` / ` #` 均可),通过 `skip_echo_of` 区分命令回显与提示行
76
+ - 超时在底层 `get(timeout=...)` 实现,可靠
77
+ - 依赖:Python >= 3.7,pyserial >= 3.5,loguru >= 0.6.0
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
5
5
 
6
6
  setup(
7
7
  name="sdev",
8
- version="0.2.1",
8
+ version="0.2.2",
9
9
  author="klrc",
10
10
  author_email="144069824@qq.com",
11
11
  description="串口控制器工具包",
sdev-0.2.1/PKG-INFO DELETED
@@ -1,78 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: sdev
3
- Version: 0.2.1
4
- Summary: 串口控制器工具包
5
- Home-page: https://github.com/klrc/sdev
6
- Author: klrc
7
- Author-email: klrc <144069824@qq.com>
8
- License: MIT
9
- Project-URL: Homepage, https://github.com/klrc/sdev
10
- Project-URL: Repository, https://github.com/klrc/sdev
11
- Project-URL: Bug Tracker, https://github.com/klrc/sdev/issues
12
- Keywords: serial,controller,hardware,embedded
13
- Classifier: Development Status :: 3 - Alpha
14
- Classifier: Intended Audience :: Developers
15
- Classifier: License :: OSI Approved :: MIT License
16
- Classifier: Operating System :: OS Independent
17
- Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3.7
19
- Classifier: Programming Language :: Python :: 3.8
20
- Classifier: Programming Language :: Python :: 3.9
21
- Classifier: Programming Language :: Python :: 3.10
22
- Classifier: Programming Language :: Python :: 3.11
23
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
- Classifier: Topic :: System :: Hardware
25
- Requires-Python: >=3.7
26
- Description-Content-Type: text/markdown
27
- License-File: LICENSE
28
- Requires-Dist: pyserial>=3.5
29
- Requires-Dist: loguru>=0.6.0
30
- Dynamic: author
31
- Dynamic: home-page
32
- Dynamic: license-file
33
- Dynamic: requires-python
34
-
35
- # SDEV
36
-
37
- 串口控制器工具包
38
-
39
- ## 安装
40
-
41
- ```bash
42
- pip install sdev
43
- ```
44
-
45
- ## 使用方法
46
-
47
- ```python
48
- from sdev import SerialController
49
-
50
- # 创建串口控制器实例
51
- controller = SerialController(serial_port="/dev/ttyUSB0", baudrate=115200)
52
-
53
- # 连接串口
54
- if controller.connect():
55
- print("连接成功")
56
-
57
- # 执行命令
58
- result = controller.execute_command("ls")
59
- print(result)
60
-
61
- # 断开连接
62
- controller.disconnect()
63
- else:
64
- print("连接失败")
65
- ```
66
-
67
- ## 功能特性
68
-
69
- - 支持串口通信
70
- - 命令执行和响应处理
71
- - 自动ANSI转义码清理
72
- - 连接状态管理
73
-
74
- ## 依赖
75
-
76
- - Python >= 3.7
77
- - pyserial >= 3.5
78
- - loguru >= 0.6.0
sdev-0.2.1/README.md DELETED
@@ -1,44 +0,0 @@
1
- # SDEV
2
-
3
- 串口控制器工具包
4
-
5
- ## 安装
6
-
7
- ```bash
8
- pip install sdev
9
- ```
10
-
11
- ## 使用方法
12
-
13
- ```python
14
- from sdev import SerialController
15
-
16
- # 创建串口控制器实例
17
- controller = SerialController(serial_port="/dev/ttyUSB0", baudrate=115200)
18
-
19
- # 连接串口
20
- if controller.connect():
21
- print("连接成功")
22
-
23
- # 执行命令
24
- result = controller.execute_command("ls")
25
- print(result)
26
-
27
- # 断开连接
28
- controller.disconnect()
29
- else:
30
- print("连接失败")
31
- ```
32
-
33
- ## 功能特性
34
-
35
- - 支持串口通信
36
- - 命令执行和响应处理
37
- - 自动ANSI转义码清理
38
- - 连接状态管理
39
-
40
- ## 依赖
41
-
42
- - Python >= 3.7
43
- - pyserial >= 3.5
44
- - loguru >= 0.6.0
@@ -1,78 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: sdev
3
- Version: 0.2.1
4
- Summary: 串口控制器工具包
5
- Home-page: https://github.com/klrc/sdev
6
- Author: klrc
7
- Author-email: klrc <144069824@qq.com>
8
- License: MIT
9
- Project-URL: Homepage, https://github.com/klrc/sdev
10
- Project-URL: Repository, https://github.com/klrc/sdev
11
- Project-URL: Bug Tracker, https://github.com/klrc/sdev/issues
12
- Keywords: serial,controller,hardware,embedded
13
- Classifier: Development Status :: 3 - Alpha
14
- Classifier: Intended Audience :: Developers
15
- Classifier: License :: OSI Approved :: MIT License
16
- Classifier: Operating System :: OS Independent
17
- Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3.7
19
- Classifier: Programming Language :: Python :: 3.8
20
- Classifier: Programming Language :: Python :: 3.9
21
- Classifier: Programming Language :: Python :: 3.10
22
- Classifier: Programming Language :: Python :: 3.11
23
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
- Classifier: Topic :: System :: Hardware
25
- Requires-Python: >=3.7
26
- Description-Content-Type: text/markdown
27
- License-File: LICENSE
28
- Requires-Dist: pyserial>=3.5
29
- Requires-Dist: loguru>=0.6.0
30
- Dynamic: author
31
- Dynamic: home-page
32
- Dynamic: license-file
33
- Dynamic: requires-python
34
-
35
- # SDEV
36
-
37
- 串口控制器工具包
38
-
39
- ## 安装
40
-
41
- ```bash
42
- pip install sdev
43
- ```
44
-
45
- ## 使用方法
46
-
47
- ```python
48
- from sdev import SerialController
49
-
50
- # 创建串口控制器实例
51
- controller = SerialController(serial_port="/dev/ttyUSB0", baudrate=115200)
52
-
53
- # 连接串口
54
- if controller.connect():
55
- print("连接成功")
56
-
57
- # 执行命令
58
- result = controller.execute_command("ls")
59
- print(result)
60
-
61
- # 断开连接
62
- controller.disconnect()
63
- else:
64
- print("连接失败")
65
- ```
66
-
67
- ## 功能特性
68
-
69
- - 支持串口通信
70
- - 命令执行和响应处理
71
- - 自动ANSI转义码清理
72
- - 连接状态管理
73
-
74
- ## 依赖
75
-
76
- - Python >= 3.7
77
- - pyserial >= 3.5
78
- - loguru >= 0.6.0
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes