Metadata-Version: 2.4
Name: atproto_jetstream
Version: 0.3.0
Summary: Receive Jetstream events from the AT Protocol
License-Expression: MIT
License-File: LICENSE
Requires-Dist: aiohttp>=3.13.3
Requires-Python: >=3.14
Project-URL: Repository, https://tangled.org/@nauta.one/atproto_jetstream
Project-URL: Issues, https://tangled.org/@nauta.one/atproto_jetstream/issues
Description-Content-Type: text/markdown

# atproto_jetstream

Small, typed, and async package to receive [Jetstream][jetstream] events from the [AT Protocol][atproto].

## install

Using your package manager, install the [`atproto_jetstream`][pypi] dependency.

- `pip install atproto_jetstream`
- `uv add atproto_jetstream`

## usage

```python
from asyncio import run
from atproto_jetstream import Jetstream, JetstreamOptions


async def main():
    options = JetstreamOptions("wss://jetstream1.us-east.bsky.network/subscribe")
    async with Jetstream(options) as stream:
        async for event in stream:
            match event.kind:
                case "account":
                    print(event.account)
                case "identity":
                    print(event.identity)
                case "commit":
                    print(event.commit)


if __name__ == "__main__":
    run(main())
```

## development

You need to download the [`zstd_dictionary`][zstd_dictionary] file from the Jetstream repository.
A Make recipe is provided to do so:

```sh
make atproto_jetstream/zstd_dictionary
```

[atproto]: https://atproto.com/
[jetstream]: https://docs.bsky.app/blog/jetstream
[pypi]: https://pypi.org/project/atproto_jetstream/
[zstd_dictionary]: https://github.com/bluesky-social/jetstream/tree/main/pkg/models
