Metadata-Version: 2.1
Name: statelydb
Version: 0.9.0
Summary: Python client for StatelyDB API
Home-page: https://stately.cloud
License: Apache-2.0
Keywords: stately,statelydb,statelycloud
Author: Stately Cloud
Author-email: support@stately.cloud
Requires-Python: >=3.12,<4.0
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Dist: aiohttp (>=3.9.5,<4.0.0)
Requires-Dist: asyncio (>=3.4.3,<4.0.0)
Requires-Dist: googleapis-common-protos (>=1.65.0,<2.0.0)
Requires-Dist: grpclib (>=0.4.7,<0.5.0)
Requires-Dist: protobuf (>=5.27.1,<6.0.0)
Project-URL: Documentation, https://docs.stately.cloud
Project-URL: Repository, https://github.com/StatelyCloud/python-sdk
Description-Content-Type: text/markdown

# StatelyDB SDK for Python

This is the Python SDK for [StatelyDB](https://stately.cloud).

### Getting started:

##### Disclaimer:

We're still in an invite-only preview mode - if you're interested, please reach out to [preview@stately.cloud](mailto:preview@stately.cloud?subject=Early%20Access%20Program).

When you join the preview program, we'll set you up with a few bits of information:

1. `STATELY_CLIENT_ID` - a client identifier so we know what client you are.
2. `STATELY_CLIENT_SECRET` - a sensitive secret that lets your applications authenticate with the API.
3. A store ID that identifies which store in your organization you're using.
4. Access to our in-depth [Getting Started Guide].

Begin by following our [Getting Started Guide] which will help you define, generate, and publish a DB schema so that it can be used.

##### Install the SDK

```sh
pip install statelydb
```


### Usage:

Create an authenticated client, then import your item types from your generated schema module and use the client!

```python
from schema import Client, MyItem
async def put_my_item() -> None:
    # Create a client. This will use the environment variables
    # STATELY_CLIENT_ID and STATELY_CLIENT_SECRET for your client.
    client = Client(store_id=<store-id>)

    # Instantiate an item from your schema
    item = MyItem(name="Jane Doe")

    # put and get the item!
    put_result = await client.put(item)
    get_result = await client.get(MyItem, put_result.key_path())
    assert put_result == get_result
```

---

[Getting Started Guide]: https://docs.stately.cloud/guides/getting-started/
[Defining Schema]: https://docs.stately.cloud/guides/schema/
