AtmosphereIndex

atmosphere.AtmosphereIndex(client, *, data_store=None)

ATProto index implementing AbstractIndex protocol.

Wraps SchemaPublisher/Loader and DatasetPublisher/Loader to provide a unified interface compatible with LocalIndex.

Optionally accepts a PDSBlobStore for writing dataset shards as ATProto blobs, enabling fully decentralized dataset storage.

Examples

>>> client = AtmosphereClient()
>>> client.login("handle.bsky.social", "app-password")
>>>
>>> # Without blob storage (external URLs only)
>>> index = AtmosphereIndex(client)
>>>
>>> # With PDS blob storage
>>> store = PDSBlobStore(client)
>>> index = AtmosphereIndex(client, data_store=store)
>>> entry = index.insert_dataset(dataset, name="my-data")

Attributes

Name Description
data_store The PDS blob store for writing shards, or None if not configured.
datasets Lazily iterate over all dataset entries (AbstractIndex protocol).
schemas Lazily iterate over all schema records (AbstractIndex protocol).

Methods

Name Description
decode_schema Reconstruct a Python type from a schema record.
get_dataset Get a dataset by AT URI.
get_schema Get a schema record by AT URI.
insert_dataset Insert a dataset into ATProto.
list_datasets Get all dataset entries as a materialized list (AbstractIndex protocol).
list_schemas Get all schema records as a materialized list (AbstractIndex protocol).
publish_schema Publish a schema to ATProto.

decode_schema

atmosphere.AtmosphereIndex.decode_schema(ref)

Reconstruct a Python type from a schema record.

Parameters

Name Type Description Default
ref str AT URI of the schema record. required

Returns

Name Type Description
Type[Packable] Dynamically generated Packable type.

Raises

Name Type Description
ValueError If schema cannot be decoded.

get_dataset

atmosphere.AtmosphereIndex.get_dataset(ref)

Get a dataset by AT URI.

Parameters

Name Type Description Default
ref str AT URI of the dataset record. required

Returns

Name Type Description
AtmosphereIndexEntry AtmosphereIndexEntry for the dataset.

Raises

Name Type Description
ValueError If record is not a dataset.

get_schema

atmosphere.AtmosphereIndex.get_schema(ref)

Get a schema record by AT URI.

Parameters

Name Type Description Default
ref str AT URI of the schema record. required

Returns

Name Type Description
dict Schema record dictionary.

Raises

Name Type Description
ValueError If record is not a schema.

insert_dataset

atmosphere.AtmosphereIndex.insert_dataset(
    ds,
    *,
    name,
    schema_ref=None,
    **kwargs,
)

Insert a dataset into ATProto.

Parameters

Name Type Description Default
ds Dataset The Dataset to publish. required
name str Human-readable name. required
schema_ref Optional[str] Optional schema AT URI. If None, auto-publishes schema. None
**kwargs Additional options (description, tags, license). {}

Returns

Name Type Description
AtmosphereIndexEntry AtmosphereIndexEntry for the inserted dataset.

list_datasets

atmosphere.AtmosphereIndex.list_datasets(repo=None)

Get all dataset entries as a materialized list (AbstractIndex protocol).

Parameters

Name Type Description Default
repo Optional[str] DID of repository. Defaults to authenticated user. None

Returns

Name Type Description
list[AtmosphereIndexEntry] List of AtmosphereIndexEntry for each dataset.

list_schemas

atmosphere.AtmosphereIndex.list_schemas(repo=None)

Get all schema records as a materialized list (AbstractIndex protocol).

Parameters

Name Type Description Default
repo Optional[str] DID of repository. Defaults to authenticated user. None

Returns

Name Type Description
list[dict] List of schema records as dictionaries.

publish_schema

atmosphere.AtmosphereIndex.publish_schema(
    sample_type,
    *,
    version='1.0.0',
    **kwargs,
)

Publish a schema to ATProto.

Parameters

Name Type Description Default
sample_type Type[Packable] A Packable type (PackableSample subclass or @packable-decorated). required
version str Semantic version string. '1.0.0'
**kwargs Additional options (description, metadata). {}

Returns

Name Type Description
str AT URI of the schema record.