Skip to main content

lairs

A read/write dataset client for the Layers format, built on didactic.

CI Docs PyPI Python 3.14+ License: MIT

Tutorial · Guides · Concepts · API · Development


lairs is a Python client for reading and writing data in the Layers format. It downloads pub.layers.* records from ATProto Personal Data Servers, validates them against models generated from the Layers lexicons, holds them in memory or in a local content-addressed store, and exposes them through a datasets-like API with tooling for the modalities Layers carries: audio, video, and time-series signals. On the write side it constructs records, uploads media blobs, and publishes records in bulk to the authenticated user's own repository, with the local store doubling as schema-aware version control.

The mental model: datasets and git for decentralised linguistic annotation.

lairs is built on didactic, which is built on panproto. Every structured value in lairs is a didactic model. The project never uses dataclasses, pydantic, or ad-hoc classes for its data, and type hints never use Any.

The ATProto lexicons are the single source of truth. The pub.layers.* models are not written by hand. They are generated from the vendored lexicons and committed to the repository. Updating to a new Layers version is a re-vendor, a regeneration, and a drift check (lairs gen --check).

Installation

The core install carries no integration dependencies. Each integration is an optional extra, discovered at runtime through entry points, so importing lairs never imports an integration's dependency.

pip install lairs                 # core
pip install "lairs[hf]"           # HuggingFace datasets and Hub
pip install "lairs[torch]"        # PyTorch exporter
pip install "lairs[audio]"        # audio decoding
pip install "lairs[conllu]"       # the CoNLL-U codec

Usage

import lairs

corpus = lairs.load_corpus(
    "at://did:plc:abc/pub.layers.corpus.corpus/ud-en",
    source="pds",
)
print(len(corpus.expressions))
print(corpus.expressions[0].text)

The lairs command vendors lexicons, regenerates models, and pulls, materialises, publishes, and inspects corpora:

lairs gen --check          # fail if the committed models drift from the lexicons
lairs pull did:plc:abc     # ingest an account's records into a local repository
lairs materialize <uri>    # build Arrow and Parquet views
lairs publish --repo ... --revision v0.1 --to did:plc:abc   # dry-run plan by default

Documentation

The documentation follows the Diátaxis structure: a tutorial, task-oriented guides, conceptual explanation, and an API reference rendered from the source docstrings. Build it locally with:

uv run --group docs mkdocs serve

Development

uv sync
uv run ruff format --check lairs tests
uv run ruff check lairs tests
uv run ty check
uv run pytest                    # unit tests only
uv run pytest --run-integration  # include integration tests (docker, network, extras)

See CONTRIBUTING.md for the full contribution guide and the Development section of the documentation for testing, code generation, and the release process. All participants are expected to follow the Code of Conduct.

Changelog

Notable changes are recorded in CHANGELOG.md.

License

lairs is released under the MIT License.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lairs-0.4.1.tar.gz (700.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lairs-0.4.1-py3-none-any.whl (420.5 kB view details)

Uploaded Python 3

File details

Details for the file lairs-0.4.1.tar.gz.

File metadata

  • Download URL: lairs-0.4.1.tar.gz
  • Upload date:
  • Size: 700.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for lairs-0.4.1.tar.gz
Algorithm Hash digest
SHA256 3a81b5f99eab166b4de5413a9029c86aee90ca504e6bff6bae05bc44bd8363f9
MD5 6c7406bf9d1882e97f907537276713c5
BLAKE2b-256 b91f4c513f7f450af55ec017f8be865cc04438f13d698ea8d2d0bc0533801fd2

See more details on using hashes here.

Provenance

The following attestation bundles were made for lairs-0.4.1.tar.gz:

Publisher: release.yml on layers-pub/lairs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lairs-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: lairs-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 420.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for lairs-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9dfe1b3ffc4583181cc42e12488dabd5cdd03b47f4773eab49b648d24b7d8eab
MD5 6aaea12746659a41f056610b2823017e
BLAKE2b-256 32c4ce85f1229f5dc056f4bca45a54eee7b06c410e02d1d8b70b20f6d65c00bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for lairs-0.4.1-py3-none-any.whl:

Publisher: release.yml on layers-pub/lairs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.6.0

2 files

0.5.0

2 files

This release

0.4.1 This release

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page