Replace progpib.py stub with a proper installable package

Builds a modern, testable API for the Prologix GPIB-ETHERNET controller
(GPIB-USB structurally supported but untested, no hardware available):
Transport abstraction (Ethernet now, serial later), GpibController for
the full "++" command set, a clean-room netfinder discovery client that
fixes a real chr()/struct-format bug present in vendortools/nfutil.py,
and a CLI (discover/config/info/terminal). vendortools/, pty-gpib-emulator/,
sampledata.txt and the manual PDF are kept untouched as reference material.

Depends on the sibling bits package (editable, not yet pinned -- see its
own commit) for MAC formatting and IEEE-488.2 status-byte bit access.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-24 18:43:08 -05:00
parent 6664760477
commit a9a79b6dd7
19 changed files with 1723 additions and 54 deletions

View File

@@ -1,3 +1,54 @@
# progpib
Prologix GPIB python tools.
A modern Python 3 API for the [Prologix](https://prologix.biz/) GPIB-ETHERNET
controller. GPIB-USB is supported behind the same interface but is
**untested** -- no GPIB-USB hardware was available while building this
package (see `progpib/transport/serial.py`).
## Install (development)
This package depends on [`bits`](https://git.groesz.org/Groesz.org/bits)
(distribution name `binary-bits`), currently used as a local editable
checkout rather than a pinned PyPI release -- install it first:
```sh
python -m venv .venv
.venv/bin/pip install -e ../bits
.venv/bin/pip install -e .[dev]
```
## Usage
```python
from progpib import discover, GpibController
# Find controllers on the LAN (broadcasts on every local interface):
for device in discover():
print(device.mac_str, device.ip_address, device.name)
# Talk to one:
with GpibController.ethernet("192.168.1.50") as gpib:
print(gpib.ver())
gpib.addr = 5 # address the instrument at GPIB primary address 5
gpib.eos = 3 # no GPIB terminator appended
gpib.eoi = 1
response = gpib.query("*IDN?")
print(response.decode())
```
## CLI
```sh
progpib discover # find controllers on the LAN
progpib info <ip> # controller version/mode/config
progpib config --mac AA:BB:CC:DD:EE:FF --dhcp
progpib config --mac AA:BB:CC:DD:EE:FF --static 192.168.1.50 255.255.255.0 192.168.1.1
progpib terminal <ip> --addr 5 # interactive pass-through terminal
```
## Reference material
`vendortools/`, `pty-gpib-emulator/`, `sampledata.txt` and
`PrologixGpibEthernetManual.pdf` are kept as historical/reference material
(original vendor tooling, a separate PTY-based emulator side project, and a
captured protocol session) -- nothing in `progpib/` imports from them.