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.6.0.tar.gz (856.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.6.0-py3-none-any.whl (573.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lairs-0.6.0.tar.gz
  • Upload date:
  • Size: 856.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for lairs-0.6.0.tar.gz
Algorithm Hash digest
SHA256 75af5f9bda74e65838c200bd68024964aeb7ac106713fc554a935215af61216b
MD5 931952f3f4c7348c4155cc16071d87bc
BLAKE2b-256 652cfc003e41fe93f5ae81ed7fc2b32591f5927906fbe73a189278539bad2a0b

See more details on using hashes here.

Provenance

The following attestation bundles were made for lairs-0.6.0.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.6.0-py3-none-any.whl.

File metadata

  • Download URL: lairs-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 573.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for lairs-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 12ec556a425d6a09e94ed2c7b8c09e930469fdf388d9dfd92593c5b2cc9b7d71
MD5 2908f8d3ee1036654f7f2fc6af716671
BLAKE2b-256 e7bacad5fc4db220a82ef7969420dbd7c41d2701a2e0a9f7c9ad4434f9fef168

See more details on using hashes here.

Provenance

The following attestation bundles were made for lairs-0.6.0-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

This release

0.6.0 This release

2 files

0.5.0

2 files

0.4.1

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