Metadata-Version: 2.4
Name: plesty-lib
Version: 0.1.0
Summary: A library for the Plesty ecosystem.
Author-email: Yunshuang Yuan <yunshuang.yuan@fkp.uni-hannover.de>
Maintainer-email: Plesty Development Team <yunshuang.yuan@fkp.uni-hannover.de>
License-Expression: LGPL-3.0-or-later
License-File: COPYING
License-File: LICENSE
Requires-Python: >=3.12
Requires-Dist: numpy>=1.24
Requires-Dist: plesty-sdk
Requires-Dist: pyserial>=3.5
Requires-Dist: pyusb>=1.2.1
Requires-Dist: pyvisa>=1.13
Requires-Dist: pyzmq>=25.0
Provides-Extra: dev
Description-Content-Type: text/markdown

# PlestyLib

PlestyLib is the core Python library in the PLESTY ecosystem for building standardized device APIs for laboratory and experimental automation.

It provides reusable abstractions for:

1. Device lifecycle and synchronous device models
2. Transport/traffic management (Serial, VISA, TCP/IP)
3. Command and operation solvers (for example SCPI and operation-message protocols)
4. Parameter and function metadata systems
5. Auto testing helpers, logging, and error-handling utilities

## Requirements

1. Python 3.12+
2. Runtime dependencies are defined in pyproject.toml

## Installation

Install from package index:

```bash
pip install plesty-lib
```

Or install from source in editable mode:

```bash
pip install -e .
```

## Quick Start

### 1. Create a device class from a base device

```python
from plestylib.device.base_visa_scpi_device import BaseVisaScpiDevice


class PowermeterDevice(BaseVisaScpiDevice):
	def __init__(self, address: str):
		super().__init__(address)
		self.register_config("POWER", dtype=float, read_only=True, command="MEAS:SCAL:POW")
		self.register_config("WAVELENGTH", dtype=int, unit="nm", command="SENS:CORR:WAV")
```

### 2. Use the device

```python
address = "USB0::0x1313::0x8078::P0000001::INSTR"

with PowermeterDevice(address) as dev:
	print(dev.identity())
	print(dev.query("POWER"))
```

## Architecture Overview

PlestyLib encourages a layered device API design:

1. Base device model: operation entry points and parameter/function systems
2. Command/operation solver: map standardized calls to protocol payloads
3. Traffic manager: transport-specific I/O with real hardware
4. Optional wrappers: async and TCP/IP service/client patterns

This separation keeps implementations testable and easier to maintain.


## License

Plesty is licensed under the GNU Lesser General Public License v3.0 or later
(LGPL-3.0-or-later). See the LICENSE file.
