Skip to main content

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.typed shipped. mypy --strict passes.
  • Declarative commands. One Command object 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 ErrorContext for debuggability.
  • Safety. Destructive operations (factory reset, baud change, exhaust) require confirm=True. Setpoints are range-checked before any I/O.
  • Multi-device, correctly. AlicatManager runs 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, and pipe() drains samples into any SampleSink. First-party sinks: InMemorySink, CsvSink, JsonlSink, SqliteSink (stdlib WAL), plus ParquetSink and PostgresSink behind extras.
  • Streaming mode. dev.stream(...) opens a bounded-memory StreamingSession that normalises the wire and fast-fails any concurrent request/response command on the same bus; NCS sets the device's continuous-stream rate on V10 firmware 10v05+.
  • Swappable transports. SerialTransport for hardware, FakeTransport for tests; TCP / Modbus can land behind the same interface later.
  • Sync or async. The core is async (built on anyio), and a sync facade (alicatlib.sync.Alicat) wraps it for scripts, notebooks, and REPLs.
  • Lean core. pip install alicatlib pulls in anyio and anyserial — 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 await 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.

Metadata

Release files for alicatlib 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for alicatlib 0.3.2
File Size Uploaded Provenance Actions
alicatlib-0.3.2.tar.gz 512.8 kB With provenance Details for alicatlib-0.3.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for alicatlib 0.3.2
File Interpreter ABI Platform Actions
alicatlib-0.3.2-py3-none-any.whl Python 3 none any Details for alicatlib-0.3.2-py3-none-any.whl

Total release size: 808.3 kB

Release files / alicatlib-0.3.2.tar.gz

Download URL alicatlib-0.3.2.tar.gz
Size 512.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e326692dd11c5ab3e7cf5fef7c10a1aaacc0670c27fe46d033fff9584bf64a20
BLAKE2b-256 checksum
How to use checksums
2becea8bf5362f116d6694e52e68b87a40038dedd075510d3a4c86ccc0fa786f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / alicatlib-0.3.2-py3-none-any.whl

Download URL alicatlib-0.3.2-py3-none-any.whl
Size 295.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cddc3cceae4b476df210a2be40963f65e2848f4979403b5759e4212cf59c79fd
BLAKE2b-256 checksum
How to use checksums
64090d499526122340c588a7c73a0675fd6c5d99da040eb48a9309d7aea8d205
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Security for alicatlib 0.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for alicatlib-0.3.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page