SchemaPublisher
atmosphere.SchemaPublisher(client)
Publishes PackableSample schemas to ATProto.
This class introspects a PackableSample class to extract its field definitions and publishes them as an ATProto schema record.
Examples
>>> @atdata.packable
... class MySample:
... image: NDArray
... label: str
...
>>> client = AtmosphereClient()
>>> client.login("handle", "password")
>>>
>>> publisher = SchemaPublisher(client)
>>> uri = publisher.publish(MySample, version="1.0.0")
>>> print(uri)
at://did:plc:.../ac.foundation.dataset.sampleSchema/...
Methods
| publish |
Publish a PackableSample schema to ATProto. |
publish
atmosphere.SchemaPublisher.publish(
sample_type,
*,
name=None,
version='1.0.0',
description=None,
metadata=None,
rkey=None,
)
Publish a PackableSample schema to ATProto.
Parameters
| sample_type |
Type[ST] |
The PackableSample class to publish. |
required |
| name |
Optional[str] |
Human-readable name. Defaults to the class name. |
None |
| version |
str |
Semantic version string (e.g., ‘1.0.0’). |
'1.0.0' |
| description |
Optional[str] |
Human-readable description. |
None |
| metadata |
Optional[dict] |
Arbitrary metadata dictionary. |
None |
| rkey |
Optional[str] |
Optional explicit record key. If not provided, a TID is generated. |
None |
Returns
|
AtUri |
The AT URI of the created schema record. |
Raises
|
ValueError |
If sample_type is not a dataclass or client is not authenticated. |
|
TypeError |
If a field type is not supported. |