Python library for Alicat mass flow meters and controllers.
Project description
alicatlib
Python library for Alicat Scientific instruments
over serial — the full {flow, pressure} × {meter, controller} × {gas,
liquid} matrix, plus the CODA Coriolis line. Covered prefixes include
M- / MC- gas mass flow, P- / PC- gas pressure, L- / LC-
liquid flow, the K-family (K- / KM- / KC- / KF- / KG-) CODA
Coriolis prefixes, and all documented specialty variants (MCDW-,
PCD-, LCR-, BASIS-, SFF-, …). The Medium model is flexible
enough to handle devices configured for gas, liquid, or both — users
narrow to the specific unit configuration via assume_media= on
open_device.
alicatlib is focused on correctness, typed APIs, and reliable multi-device
acquisition.
Status: beta. Documentation and release prep in progress; see docs/design.md for the architecture and remaining future work.
Highlights
- Typed end to end.
Gas.N2,Unit.SCCM,Statistic.MASS_FLOW, frozen dataclass responses.py.typedshipped.mypy --strictpasses. - Declarative commands. One
Commandobject per Alicat command with encoding, decoding, firmware gating, device-kind gating, and medium gating (gas vs. liquid, for CODA and friends) as metadata — adding a new command is ~50 lines. - Typed errors. Distinct exception types for timeout, malformed response,
unsupported firmware, and device error markers — all carrying structured
ErrorContextfor debuggability. - Safety. Destructive operations (factory reset, baud change, exhaust)
require
confirm=True. Setpoints are range-checked before any I/O. - Multi-device, correctly.
AlicatManagerruns many devices concurrently; same-port requests serialize via a shared lock, different ports run in parallel, resources unwind cleanly on partial-open failures. - Acquisition built in.
record()drives one or more devices at an absolute-target cadence with no cumulative drift, andpipe()drains samples into anySampleSink. First-party sinks:InMemorySink,CsvSink,JsonlSink,SqliteSink(stdlib WAL), plusParquetSinkandPostgresSinkbehind extras. - Streaming mode.
dev.stream(...)opens a bounded-memoryStreamingSessionthat normalises the wire and fast-fails any concurrent request/response command on the same bus;NCSsets the device's continuous-stream rate on V10 firmware 10v05+. - Swappable transports.
SerialTransportfor hardware,FakeTransportfor tests; TCP / Modbus can land behind the same interface later. - Sync or async. The core is
async(built onanyio), and a sync facade (alicatlib.sync.Alicat) wraps it for scripts, notebooks, and REPLs. - Lean core.
pip install alicatlibpulls inanyioandanyserial— and nothing else. Parquet, Postgres, and docs live behind extras.
Install
pip install alicatlib
# optional sinks
pip install 'alicatlib[parquet]'
pip install 'alicatlib[postgres]'
Requires Python 3.13+.
Quickstart (sync)
from alicatlib.sync import Alicat
with Alicat.open("/dev/ttyUSB0") as dev:
frame = dev.poll()
print(frame.get_float("Mass_Flow"))
dev.setpoint(50.0, "SCCM")
Quickstart (async)
import anyio
from alicatlib import Gas, open_device
async def main():
async with open_device("/dev/ttyUSB0") as dev:
frame = await dev.poll()
print(frame.get_float("Mass_Flow"))
await dev.gas(Gas.N2, save=True)
anyio.run(main)
Development
Uses uv for env and lock management, hatchling
for the build backend, ruff for format and lint, and mypy --strict for
types.
uv sync --all-extras --dev
uv run pytest
uv run ruff format --check .
uv run ruff check .
uv run mypy
See CONTRIBUTING.md for the full workflow, and docs/design.md for the architectural design.
License
MIT. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file alicatlib-0.1.0.tar.gz.
File metadata
- Download URL: alicatlib-0.1.0.tar.gz
- Upload date:
- Size: 466.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e626977f007c645978ee587160120b7fb185feaad75d15fcb28cc874318dd1e1
|
|
| MD5 |
cf3c92776238f434bb3e4a589da1dbfd
|
|
| BLAKE2b-256 |
ae5d017e89c7f878aa2842d85a309d25f41cfba8c6a4725aa85badf53ae71da1
|
Provenance
The following attestation bundles were made for alicatlib-0.1.0.tar.gz:
Publisher:
release.yml on GraysonBellamy/alicatlib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
alicatlib-0.1.0.tar.gz -
Subject digest:
e626977f007c645978ee587160120b7fb185feaad75d15fcb28cc874318dd1e1 - Sigstore transparency entry: 1383681655
- Sigstore integration time:
-
Permalink:
GraysonBellamy/alicatlib@78bd03a832bd1cda3fcaf9b5755ae4534b54da74 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/GraysonBellamy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@78bd03a832bd1cda3fcaf9b5755ae4534b54da74 -
Trigger Event:
release
-
Statement type:
File details
Details for the file alicatlib-0.1.0-py3-none-any.whl.
File metadata
- Download URL: alicatlib-0.1.0-py3-none-any.whl
- Upload date:
- Size: 286.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c69b2733998d4e314832006798ce694043358f16a2b09b024bf02f57ed3c32cb
|
|
| MD5 |
7c0f0073d138e5bcf87ee8bae6f8d940
|
|
| BLAKE2b-256 |
5cc7ae57589a1981e838733bf9485a9692602866e2dbafaf34594837d1fec236
|
Provenance
The following attestation bundles were made for alicatlib-0.1.0-py3-none-any.whl:
Publisher:
release.yml on GraysonBellamy/alicatlib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
alicatlib-0.1.0-py3-none-any.whl -
Subject digest:
c69b2733998d4e314832006798ce694043358f16a2b09b024bf02f57ed3c32cb - Sigstore transparency entry: 1383681735
- Sigstore integration time:
-
Permalink:
GraysonBellamy/alicatlib@78bd03a832bd1cda3fcaf9b5755ae4534b54da74 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/GraysonBellamy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@78bd03a832bd1cda3fcaf9b5755ae4534b54da74 -
Trigger Event:
release
-
Statement type: