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, checks their types and structure with 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 relates: 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.

lairs is built on didactic, which is built on panproto. Structured values in lairs are didactic models built programmatically from the pub.layers.* ATProto lexicons.

Generated models check field types, required fields, union structure, and datetime fields. Other lexicon constraints, including identifier syntax, lengths, and numeric ranges, are not enforced by the models. Builders check selected argument ranges and anchor relationships. See validation scope for the checks performed and how to apply a strict Lexicon validator.

Installation

lairs can be installed from pypi:

pip install lairs                 # core

The core install does not include 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[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
from lairs.atproto import PdsClient

# read a corpus straight from the public Layers PDS
with PdsClient("https://repo.layers.pub") as client:
    corpus = lairs.load_corpus(
        "at://did:plc:myu6umexofclib2tvwn23gsc/pub.layers.corpus.corpus/92cfd1034bcef513c2796962",
        source="pds",
        pds_client=client,
    )

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 is available at layers.pub/lairs/. It can be built locally with:

uv run --group docs mkdocs serve

Development

lairs uses uv along with ruff, ty, and pytest for 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.

Acknowledgments

lairs was developed with substantial assistance from Claude Code.

Metadata

Release files for lairs 0.10.5

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

Source distribution (sdist)

Source distribution for lairs 0.10.5
File Size Uploaded Provenance Actions
lairs-0.10.5.tar.gz 1.1 MB With provenance Details for lairs-0.10.5.tar.gz

Built distribution (wheel)

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

Total release size: 1.8 MB

Release files / lairs-0.10.5.tar.gz

Download URL lairs-0.10.5.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
97fe2e5eebcbcfc1ebe20ed9ffd3bcc6c6ef0f957dfe913a3c5a7b9d4499ce6e
BLAKE2b-256 checksum
How to use checksums
204a3bfba57d5877a32b24055849f4b47033da0f17e69e1a2b192755873658e2
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 25, 2026.

Transparency log

Release files / lairs-0.10.5-py3-none-any.whl

Download URL lairs-0.10.5-py3-none-any.whl
Size 656.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1cd45f3755ae7c562f57455f2fcd06c063a0beef7dddf4ecf8272dd6d56ffea2
BLAKE2b-256 checksum
How to use checksums
253bb8fd5b641bd4c038940fa451df92ea927a6d2effe86e36cc89857f710644
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 25, 2026.

Transparency log

Security for lairs 0.10.5

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 lairs-0.10.5.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 25, 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