Metadata-Version: 2.4
Name: labnet
Version: 3.0.0
Summary: Typed device control and acquisition services for a lab network
Author: Robert Miller
License-Expression: MIT
Project-URL: Documentation, https://mill0851.github.io/labnet/
Project-URL: Source, https://github.com/mill0851/labnet
Project-URL: Issues, https://github.com/mill0851/labnet/issues
Project-URL: Changelog, https://github.com/mill0851/labnet/blob/main/CHANGELOG.md
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: System :: Hardware
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: grpcio<2.0,>=1.81.1
Requires-Dist: httpx<1.0,>=0.27
Requires-Dist: protobuf<7.0,>=6.33.5
Requires-Dist: python-dotenv<2.0,>=1.0
Provides-Extra: lab-pc
Requires-Dist: fastapi<1.0,>=0.115; extra == "lab-pc"
Requires-Dist: grpcio-health-checking<2.0,>=1.81.1; extra == "lab-pc"
Requires-Dist: uvicorn<1.0,>=0.30; extra == "lab-pc"
Provides-Extra: central
Requires-Dist: alembic<2.0,>=1.19.1; extra == "central"
Requires-Dist: fastapi<1.0,>=0.115; extra == "central"
Requires-Dist: SQLAlchemy<3.0,>=2.0.52; extra == "central"
Requires-Dist: uvicorn<1.0,>=0.30; extra == "central"
Provides-Extra: postgres
Requires-Dist: psycopg[binary]<4.0,>=3.2; extra == "postgres"
Provides-Extra: certs
Requires-Dist: cryptography<47,>=42; extra == "certs"
Provides-Extra: driver-dev
Requires-Dist: grpcio-tools==1.81.1; extra == "driver-dev"

# labnet

LabNet lets experiment programs anywhere on a lab network use instruments
attached to other computers safely: one user at a time, through typed
operations, with the instrument's own computer staying in charge of the
hardware.

This package holds Central (users, the device directory, leases), the Lab PC
runtime (serves instruments over gRPC), the client library, the driver
tooling, and the `labnet` command. Instruments come from driver packages,
such as [`labnet-sim`](https://pypi.org/project/labnet-sim/); the web
interface is [`labnet-control-center`](https://pypi.org/project/labnet-control-center/).

## Install

| Command | For |
| --- | --- |
| `pip install labnet` | Client computers: experiment scripts |
| `pip install "labnet[lab-pc]"` | Lab PCs |
| `pip install "labnet[central]"` | Central (add `postgres` for PostgreSQL) |
| `pip install "labnet[certs]"` | The computer that issues the lab's certificates |
| `pip install "labnet[driver-dev]"` | Writing a driver package (`labnet driver build`) |

A whole simulated lab on one computer:

```bash
pip install "labnet[central,lab-pc]" labnet-sim labnet-control-center
labnet dev up
```

## Use an instrument

```python
from labnet import LabClient
from labnet_sim import SimulatedWavemeter

central = LabClient.from_env()               # reads LABNET_ENV_FILE
meter = SimulatedWavemeter(client=central)   # leases the first available wavemeter
try:
    print(meter.read_wavelength(), "nm")
finally:
    meter.close()                              # releases the lease
    central.close()
```

## Documentation

<https://mill0851.github.io/labnet/>: the
[Quickstart](https://mill0851.github.io/labnet/quickstart/),
[writing a driver](https://mill0851.github.io/labnet/drivers/),
[deploying a lab](https://mill0851.github.io/labnet/deploying/), and the
[API reference](https://mill0851.github.io/labnet/reference/api/client/).

LabNet is MIT licensed. Source: <https://github.com/mill0851/labnet>.
