Metadata-Version: 2.4
Name: atproto
Version: 0.0.72
Summary: The AT Protocol SDK
License-Expression: MIT
License-File: LICENSE
Keywords: library,sdk,codegen,xrpc,xrpc-client,atprotocol,atproto,lexicon,parser,schema,bluesky,bluesky-api,at,uri,atp,nsid,did,cid
Author: Ilya (Marshal)
Author-email: ilya@marshal.dev
Requires-Python: >=3.9,<3.15
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Pre-processors
Requires-Dist: click (>=8.1.3,<9)
Requires-Dist: cryptography (>=41.0.7,<51)
Requires-Dist: dnspython (>=2.4.0,<3)
Requires-Dist: httpx (>=0.25.0,<0.29.0)
Requires-Dist: libipld (>=3.0.1,<4)
Requires-Dist: pydantic (>=2.7,<3)
Requires-Dist: typing-extensions (>=4.8.0,<5)
Requires-Dist: websockets (>=15,<18)
Requires-Dist: zstandard (>=0.24.0,<0.26.0)
Project-URL: Documentation, https://atproto.blue
Project-URL: Homepage, https://atproto.blue
Project-URL: Repository, https://github.com/MarshalX/atproto
Project-URL: changes, https://github.com/MarshalX/atproto/blob/main/CHANGES.md
Project-URL: issues, https://github.com/MarshalX/atproto/issues
Project-URL: sponsoring, https://github.com/sponsors/MarshalX
Description-Content-Type: text/markdown

<p align="center">
    <a href="https://github.com/MarshalX/atproto">
        <img alt="Logo of atproto SDK for Python by Midjourney'" src="https://github.com/MarshalX/atproto/raw/main/.github/images/logo.png">
    </a>
    <br>
    <b>Autogenerated from lexicons, well type hinted, documented, sync and async SDK for Python</b>
    <br>
    <a href="https://atproto.blue">
        Documentation
    </a>
    •
    <a href="https://atproto.blue/en/latest/guides/">
        Guides
    </a>
    •
    <a href="https://atproto.blue/en/latest/examples/">
        Examples
    </a>
    •
    <a href="https://discord.gg/PCyVJXU9jN">
        Discord Bluesky API
    </a>
</p>

## The AT Protocol SDK

> ⚠️ Under construction. Until the 1.0.0 release compatibility between versions is not guaranteed.

```python
from atproto import Client, client_utils


def main():
    client = Client()
    profile = client.login('my-handle', 'my-password')
    print('Welcome,', profile.display_name)

    text = client_utils.TextBuilder().text('Hello World from ').link('Python SDK', 'https://atproto.blue')
    post = client.send_post(text)
    client.like(post.uri, post.cid)


if __name__ == '__main__':
    main()
```

<details>
  <summary>Code snippet of async version</summary>

```python
import asyncio

from atproto import AsyncClient, client_utils


async def main():
    client = AsyncClient()
    profile = await client.login('my-handle', 'my-password')
    print('Welcome,', profile.display_name)

    text = client_utils.TextBuilder().text('Hello World from ').link('Python SDK', 'https://atproto.blue')
    post = await client.send_post(text)
    await client.like(post.uri, post.cid)


if __name__ == '__main__':
    asyncio.run(main())
```
</details>

### Installing

```bash
pip install atproto
```

Python 3.9 or higher.

### What you get

This SDK attempts to implement everything that ATProto provides. There is support for Lexicon schemas, XRPC clients, Firehose, Jetstream, Identity, DID keys, signatures, and more. All models, queries, and procedures are generated automatically. The main focus is on the lexicons of atproto.com and bsky.app, but there is no vendor lock on it. Point the code generator at your own lexicon schemas and it produces the same typed models and clients for them. The SDK also provides utilities to work with CID, NSID, AT URI schemes, DAG-CBOR, CAR files, DID documents and more.

- **Sync and async clients** with identical method sets.
- **Type hints everywhere**, so your IDE can navigate the whole protocol.
- **A high-level client** for common tasks, with the complete XRPC surface underneath it.
- **Real-time streaming** over the Firehose or Jetstream, including archive backfill.
- **Your own lexicons**, compiled into an importable package by `atp gen custom`.

### Documentation

The documentation is live at [atproto.blue](https://atproto.blue/).

|                                                                                                                               |                                                    |
| ----------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------- |
| 🚀 [Quickstart](https://atproto.blue/en/latest/getting-started/quickstart/)                                                    | Install, log in, post, read a timeline             |
| 📚 [Guides](https://atproto.blue/en/latest/guides/)                                                                            | Posting, reading, streaming, identity, errors      |
| 💡 [Examples](https://atproto.blue/en/latest/examples/)                                                                        | Every runnable example, inlined                    |
| 🧩 [Custom lexicons](https://atproto.blue/en/latest/cli/custom-lexicons/)                                                      | Generate models and clients from your own lexicons |
| 🛠 [The `atp` CLI](https://atproto.blue/en/latest/cli/)                                                                        | The code generator's command line                  |
| 💬 [Direct messages](https://atproto.blue/en/latest/guides/direct-messages/)                                                   | Chats, messages, and reactions                     |
| 🔥 [Firehose](https://atproto.blue/en/latest/guides/firehose/) & [Jetstream](https://atproto.blue/en/latest/guides/jetstream/) | Data streaming from the whole network              |
| 🌐 [Identity](https://atproto.blue/en/latest/guides/identity/)                                                                 | DID and handle resolvers                           |
| 📖 [Model reference](https://atproto.blue/en/latest/models/lexicons/)                                                          | Every lexicon on the network, as a Pydantic model  |
| 🍿 [Feed generator](https://atproto.blue/en/latest/guides/feed-generator/)                                                     | Build a custom feed, end to end                    |

This is the SDK's documentation, not the protocol's. For the protocol itself, see [atproto.com](https://atproto.com/docs) and [bsky.network/docs](https://bsky.network/docs/bluesky-api).

### SDK structure

The SDK is built upon the following components:

| Package                | Description                                                                 |
| ---------------------- | --------------------------------------------------------------------------- |
| `atproto`              | Import shortcuts to other packages.                                         |
| `atproto_cli`          | CLI tool to generate code.                                                  |
| `atproto_client`       | XRPC Client, data models, and utils like rich text helper.                  |
| `atproto_codegen`      | Code generator of models, clients, and namespaces.                          |
| `atproto_core`         | Tools to work with NSID, AT URI Schemes, CID, CAR files, and DID Documents. |
| `atproto_crypto`       | Crypto utils like multibase, signature verification, work with DID keys.    |
| `atproto_firehose`     | Firehose (data streaming) client and models.                                |
| `atproto_identity`     | Identity resolvers for DID, Handle, AT Protocol data, signing keys.         |
| `atproto_jetstream`    | Jetstream v2 (data streaming) client and models.                            |
| `atproto_lexicon`      | Lexicon parser.                                                             |
| `atproto_server`       | Server-side utils like JWT.                                                 |
| `atproto_subscription` | Websocket subscription runtime behind the streaming clients.                |

I highly recommend that you use the `atproto` package to import everything that you need. It contains shortcuts to all other packages.

### Getting help

You can get help in several ways:
- Report bugs, request new features by [creating an issue](https://github.com/MarshalX/atproto/issues/new).
- Ask questions by [starting a discussion](https://github.com/MarshalX/atproto/discussions/new).
- Ask questions in [Discord server](https://discord.gg/PCyVJXU9jN).

### Change log

The full change log is available in [CHANGES.md](https://github.com/MarshalX/atproto/blob/main/CHANGES.md).

### Contributing

Contributions of all sizes are welcome. The contribution guidelines will be presented later.

### License

MIT

