A read/write dataset client for the Layers format, built on didactic.
Project description
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
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lairs-0.2.0.tar.gz.
File metadata
- Download URL: lairs-0.2.0.tar.gz
- Upload date:
- Size: 691.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8aff81407d770f687d8ec5b7b793b53a75c7a7980c59b3c4baacddcb8721dd23
|
|
| MD5 |
f0b5b2d047ffff6ea7fc1d0a89bf2397
|
|
| BLAKE2b-256 |
db9270c4583d9da4693fa93832a7548ec4105d983b37996fc9d95c8275482243
|
Provenance
The following attestation bundles were made for lairs-0.2.0.tar.gz:
Publisher:
release.yml on layers-pub/lairs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lairs-0.2.0.tar.gz -
Subject digest:
8aff81407d770f687d8ec5b7b793b53a75c7a7980c59b3c4baacddcb8721dd23 - Sigstore transparency entry: 1967028704
- Sigstore integration time:
-
Permalink:
layers-pub/lairs@1bbb97d155e84fb87454c83edf8acf4a3cf7f978 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/layers-pub
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1bbb97d155e84fb87454c83edf8acf4a3cf7f978 -
Trigger Event:
push
-
Statement type:
File details
Details for the file lairs-0.2.0-py3-none-any.whl.
File metadata
- Download URL: lairs-0.2.0-py3-none-any.whl
- Upload date:
- Size: 416.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
675626973fa3f5ad62dff7fe305d2654802e8b8cefaf4177640af1c3b083ad2b
|
|
| MD5 |
385597f86ef896c05a6ecc6334943507
|
|
| BLAKE2b-256 |
f57bad5d3b8ec61839cd820b8140d6d19d3f9a62017921f5561115c2384385e8
|
Provenance
The following attestation bundles were made for lairs-0.2.0-py3-none-any.whl:
Publisher:
release.yml on layers-pub/lairs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lairs-0.2.0-py3-none-any.whl -
Subject digest:
675626973fa3f5ad62dff7fe305d2654802e8b8cefaf4177640af1c3b083ad2b - Sigstore transparency entry: 1967028829
- Sigstore integration time:
-
Permalink:
layers-pub/lairs@1bbb97d155e84fb87454c83edf8acf4a3cf7f978 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/layers-pub
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1bbb97d155e84fb87454c83edf8acf4a3cf7f978 -
Trigger Event:
push
-
Statement type: