lss
English
A Python CLI that lists the system's serial ports, including the device path, port name, and device description. Supports Windows, macOS, and Linux. Requires Python 3.10 or newer.
The PyPI package is named lss-serial-ports; the installed command is lss.
Install
Install from PyPI with uv:
uv tool install lss-serial-ports
Or with pip:
python -m pip install lss-serial-ports
Usage
lss
lss USB
lss --filter "USB Serial"
lss -f com3
lss --help
The optional keyword performs a case-insensitive, literal substring search
across the device path, port name, and description. Use either the positional
keyword or --filter. Regular expressions are not interpreted.
Example output (actual information depends on the operating system):
PORT NAME DESCRIPTION
COM3 COM3 USB Serial Device (COM3)
COM8 COM8 USB-SERIAL CH340 (COM8)
Results are sorted by port name in natural order, such as COM2 before COM10. The command only discovers ports; it does not open them or test whether they are busy. Some devices or platforms may not provide a description.
If no ports are found or no ports match, the command prints a message and exits with code 0. Discovery failures exit with code 1; invalid arguments exit with code 2.
Development
git clone https://github.com/codemee/lss.git
cd lss
uv sync
uv run lss
uv run python -m unittest discover -s tests -v
uv build
To install the local checkout as a CLI, run uv tool install ..
If uv's tool directory is missing from PATH, run uv tool update-shell and
restart your terminal.
繁體中文
以 Python 列出系統目前的 serial port,包含連接埠路徑、名稱與裝置描述。 使用 uv 管理環境與依賴。
PyPI 套件名稱為 lss-serial-ports,安裝後的指令為 lss。
執行
uv sync
uv run lss
uv run lss USB
uv run lss --filter "USB Serial"
uv run lss -f com3
uv run lss --help
關鍵字會在連接埠路徑、名稱與描述中進行不區分大小寫的子字串比對,
不使用正規表示式。位置引數與 --filter 擇一使用。
輸出範例(實際資訊由作業系統提供):
PORT NAME DESCRIPTION
COM3 COM3 USB Serial Device (COM3)
COM8 COM8 USB-SERIAL CH340 (COM8)
沒有連接埠或沒有符合項目時會顯示提示,結束碼為 0; 列舉失敗時結束碼為 1,引數錯誤為 2。 此指令只列舉資訊,不會開啟連接埠。 Windows、macOS 與 Linux 的裝置描述可能不同,部分裝置不提供描述。
安裝成 CLI
從 PyPI 安裝(需要 Python 3.10 或更新版本):
uv tool install lss-serial-ports
在專案資料夾執行:
uv tool install .
lss
lss USB
若 uv 提示工具目錄尚未加入 PATH,可執行 uv tool update-shell 後重新開啟終端機。
測試
uv run python -m unittest discover -s tests -v
Metadata
Release files for lss-serial-ports 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lss_serial_ports-0.1.2.tar.gz | 4.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lss_serial_ports-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.9 kB
Release files / lss_serial_ports-0.1.2.tar.gz
| Download URL | lss_serial_ports-0.1.2.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ec0dbccae6b35f5be8ee00735829a21942ab66f80ae1fbd6511241bba625dc0d
|
|
BLAKE2b-256 checksum How to use checksums |
8f760ac22d4f33db0085132d3095d893c950649306886a753bfb6c08c80a156e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / lss_serial_ports-0.1.2-py3-none-any.whl
| Download URL | lss_serial_ports-0.1.2-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fb094eb3839c2d34864485e14d91338390f8eb43b0137b9b670c1f09c35d174b
|
|
BLAKE2b-256 checksum How to use checksums |
b5b5d1ea7f87c32ba4b8901192d95cacd74370687753531741117bf12a4986c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|