lairs
A read/write dataset client for the Layers format, built on didactic.
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
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 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.
Release files for lairs 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lairs-0.7.0.tar.gz | 873.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lairs-0.7.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.5 MB
Release files / lairs-0.7.0.tar.gz
| Download URL | lairs-0.7.0.tar.gz |
|---|---|
| Size | 873.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0c3fe5702a7c7b1516998d0763bf580e2b5d0d54e73a329517a2c9a35c79f442
|
|
BLAKE2b-256 checksum How to use checksums |
1318643cf7e3294687bd0b699bbb19a28f45dcec695b3df919c280ea6cd573ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 2, 2026.
Transparency logRelease files / lairs-0.7.0-py3-none-any.whl
| Download URL | lairs-0.7.0-py3-none-any.whl |
|---|---|
| Size | 585.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
496466592d9354b4905c2a712af09c402876b9c90e25a2627c1d4eb42a7768ec
|
|
BLAKE2b-256 checksum How to use checksums |
07d24e6b8c4d3b6ee7bec641893763965d86e1ed9696be614ca1f0a348fe744f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 2, 2026.
Transparency log