{"id":4437,"library":"atproto","title":"AT Protocol SDK for Python","description":"The `atproto` library is the official Python SDK for the AT Protocol, the decentralized social networking protocol behind Bluesky. It provides support for Lexicon Schemes, XRPC clients, Firehose, Identity, DID keys, signatures, and more, with all models, queries, and procedures automatically generated. As of version 0.0.65, the SDK is actively developed with frequent releases, though it remains in a pre-1.0.0 state where backward compatibility is not strictly guaranteed.","status":"active","version":"0.0.65","language":"en","source_language":"en","source_url":"https://github.com/MarshalX/atproto","tags":["atprotocol","bluesky","decentralized","social","sdk","xrpc","firehose"],"install":[{"cmd":"pip install atproto","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Requires Python 3.9 or higher. Support for Python 3.8 was dropped in v0.0.63.","package":"python","optional":false},{"reason":"Highly recommended for significant performance improvements in CAR decoding for custom feeds and firehose, leveraging Rust for heavy lifting. Update with `pip install -U libipld`.","package":"libipld","optional":true},{"reason":"Updated to v15 in v0.0.63; potential for stability differences with the new async client.","package":"websockets","optional":false},{"reason":"Updated in v0.0.63; may introduce new warnings or require changes due to Pydantic v2 migration and related breaking changes.","package":"pydantic","optional":false}],"imports":[{"symbol":"Client","correct":"from atproto import Client"},{"symbol":"AsyncClient","correct":"from atproto import AsyncClient"},{"note":"Used for accessing low-level API models (e.g., `models.AppBskyFeedPost.Record`).","symbol":"models","correct":"from atproto import models"},{"note":"Provides utility functions like `TextBuilder` for rich text posts.","symbol":"client_utils","correct":"from atproto import client_utils"}],"quickstart":{"code":"import os\nfrom atproto import Client\n\ndef main():\n    client = Client()\n    try:\n        # Use environment variables for sensitive credentials\n        handle = os.environ.get('ATPROTO_USERNAME', 'your-handle.bsky.social')\n        password = os.environ.get('ATPROTO_PASSWORD', 'your-app-password')\n\n        profile = client.login(handle, password)\n        print(f\"Welcome, {profile.display_name}!\")\n\n        # Send a simple text post\n        post_text = \"Hello World from the AT Protocol Python SDK! #atproto #python\"\n        response = client.send_post(text=post_text)\n        print(f\"Posted: {post_text}\\nURI: {response.uri}\")\n\n    except Exception as e:\n        print(f\"An error occurred: {e}\")\n\nif __name__ == '__main__':\n    main()","lang":"python","description":"This quickstart demonstrates how to initialize the synchronous `Client`, log in using environment variables for credentials, and send a simple text post to the AT Protocol network (e.g., Bluesky)."},"warnings":[{"fix":"Upgrade Python to 3.9 or later.","message":"Python 3.8 support was officially dropped in `atproto` v0.0.63. Users on Python 3.8 must upgrade their Python version to 3.9 or newer.","severity":"breaking","affected_versions":">=0.0.63"},{"fix":"Review the changelog for specific version updates. Update model instantiation to use keyword arguments, convert field names to snake_case, and adjust API calls to use the correct `client.app.bsky` namespace.","message":"Significant breaking changes occurred due to Pydantic v2 migration and `libipld` integration, particularly noticeable when upgrading from much older versions. These include: positional arguments for model instantiation are no longer supported (use keyword arguments); `createdAt` (camelCase) fields are now `created_at` (snake_case); the root namespace for Bluesky API calls changed from `client.bsky` to `client.app.bsky`; and fields conflicting with Pydantic reserved names have a `_` suffix (e.g., `validation` is now `validation_`).","severity":"breaking","affected_versions":"likely around 0.0.4x to 0.0.5x, fully in >=0.0.63"},{"fix":"Upgrade to `atproto` v0.0.61 or higher.","message":"Version 0.0.60 contained a bug that broke session refreshing. This was fixed in version 0.0.61.","severity":"gotcha","affected_versions":"0.0.60"},{"fix":"Regularly review release notes and test your application when upgrading. Pin exact versions for production environments.","message":"The SDK is marked as 'Under construction' and 'Until the 1.0.0 release compatibility between versions is not guaranteed'. This means breaking changes can occur in minor versions without extensive prior notice.","severity":"gotcha","affected_versions":"<1.0.0"},{"fix":"Consult the official documentation for advanced usage and low-level API interactions.","message":"The high-level `Client` provides a simplified API ('syntax sugar') but does not cover the full range of AT Protocol functionalities. For advanced or niche operations, developers may need to interact with the lower-level XRPC API via namespaces (e.g., `client.com.atproto.server`) and models (from `atproto.models`).","severity":"gotcha","affected_versions":"All versions"},{"fix":"Report any unexpected stability issues or Pydantic warnings to the library maintainers for investigation.","message":"Upgrading `websockets` to v15 and `pydantic` in `atproto` v0.0.63 may lead to 'differences in stability' or 'new strange warnings' from `pydantic`.","severity":"gotcha","affected_versions":">=0.0.63"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}