Skip to content

Commit d6b3c88

Browse files
committed
chore: update Python SDK to 16.0.0
1 parent 98d20c3 commit d6b3c88

File tree

5 files changed

+9
-69
lines changed

5 files changed

+9
-69
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Change Log
22

3-
## 16.0.0rc1
3+
## 16.0.0
44

55
* Breaking change: All service methods now return typed Pydantic models instead of `Dict[str, Any]`
66
* Breaking change: Models with dynamic fields (e.g., `Row`, `Document`) now store user-defined data in a typed `.data` property instead of direct attribute access

README.md

Lines changed: 3 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,10 @@ client = Client()
4949
### Make Your First Request
5050
Once your SDK object is set, create any of the Appwrite service objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the [API References](https://appwrite.io/docs) section.
5151

52-
All service methods return typed Pydantic models, so you can access response fields as attributes:
53-
5452
```python
5553
users = Users(client)
5654

57-
user = users.create(ID.unique(), email = "email@example.com", phone = "+123456789", password = "password", name = "Walter O'Brien")
58-
59-
print(user.name) # "Walter O'Brien"
60-
print(user.email) # "email@example.com"
61-
print(user.id) # The generated user ID
55+
result = users.create(ID.unique(), email = "email@example.com", phone = "+123456789", password = "password", name = "Walter O'Brien")
6256
```
6357

6458
### Full Example
@@ -78,60 +72,7 @@ client = Client()
7872

7973
users = Users(client)
8074

81-
user = users.create(ID.unique(), email = "email@example.com", phone = "+123456789", password = "password", name = "Walter O'Brien")
82-
83-
print(user.name) # Access fields as attributes
84-
print(user.to_dict()) # Convert to dictionary if needed
85-
```
86-
87-
### Type Safety with Models
88-
89-
The Appwrite Python SDK provides type safety when working with database rows through generic methods. Methods like `get_row`, `list_rows`, and others accept a `model_type` parameter that allows you to specify your custom Pydantic model for full type safety.
90-
91-
```python
92-
from pydantic import BaseModel
93-
from datetime import datetime
94-
from typing import Optional
95-
from appwrite.client import Client
96-
from appwrite.services.tables_db import TablesDB
97-
98-
# Define your custom model matching your table schema
99-
class Post(BaseModel):
100-
postId: int
101-
authorId: int
102-
title: str
103-
content: str
104-
createdAt: datetime
105-
updatedAt: datetime
106-
isPublished: bool
107-
excerpt: Optional[str] = None
108-
109-
client = Client()
110-
# ... configure your client ...
111-
112-
tables_db = TablesDB(client)
113-
114-
# Fetch a single row with type safety
115-
row = tables_db.get_row(
116-
database_id="your-database-id",
117-
table_id="your-table-id",
118-
row_id="your-row-id",
119-
model_type=Post # Pass your custom model type
120-
)
121-
122-
print(row.data.title) # Fully typed - IDE autocomplete works
123-
print(row.data.postId) # int type, not Any
124-
print(row.data.createdAt) # datetime type
125-
126-
# Fetch multiple rows with type safety
127-
result = tables_db.list_rows(
128-
database_id="your-database-id",
129-
table_id="your-table-id",
130-
model_type=Post
131-
)
132-
133-
for row in result.rows:
134-
print(f"{row.data.title} by {row.data.authorId}")
75+
result = users.create(ID.unique(), email = "email@example.com", phone = "+123456789", password = "password", name = "Walter O'Brien")
13576
```
13677

13778
### Error Handling
@@ -140,8 +81,7 @@ The Appwrite Python SDK raises `AppwriteException` object with `message`, `code`
14081
```python
14182
users = Users(client)
14283
try:
143-
user = users.create(ID.unique(), email = "email@example.com", phone = "+123456789", password = "password", name = "Walter O'Brien")
144-
print(user.name)
84+
result = users.create(ID.unique(), email = "email@example.com", phone = "+123456789", password = "password", name = "Walter O'Brien")
14585
except AppwriteException as e:
14686
print(e.message)
14787
```

appwrite/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ def __init__(self):
1515
self._endpoint = 'https://cloud.appwrite.io/v1'
1616
self._global_headers = {
1717
'content-type': '',
18-
'user-agent' : f'AppwritePythonSDK/16.0.0rc1 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})',
18+
'user-agent' : f'AppwritePythonSDK/16.0.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})',
1919
'x-sdk-name': 'Python',
2020
'x-sdk-platform': 'server',
2121
'x-sdk-language': 'python',
22-
'x-sdk-version': '16.0.0rc1',
22+
'x-sdk-version': '16.0.0',
2323
'X-Appwrite-Response-Format' : '1.8.0',
2424
}
2525

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "appwrite"
7-
version = "16.0.0rc1"
7+
version = "16.0.0"
88
description = "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API"
99
readme = "README.md"
1010
requires-python = ">=3.9"

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
setuptools.setup(
99
name = 'appwrite',
1010
packages = setuptools.find_packages(),
11-
version = '16.0.0rc1',
11+
version = '16.0.0',
1212
license='BSD-3-Clause',
1313
description = 'Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API',
1414
long_description = long_description,
@@ -18,7 +18,7 @@
1818
maintainer = 'Appwrite Team',
1919
maintainer_email = 'team@appwrite.io',
2020
url = 'https://appwrite.io/support',
21-
download_url='https://github.com/appwrite/sdk-for-python/archive/16.0.0rc1.tar.gz',
21+
download_url='https://github.com/appwrite/sdk-for-python/archive/16.0.0.tar.gz',
2222
install_requires=[
2323
'requests',
2424
'pydantic>=2,<3',

0 commit comments

Comments
 (0)