jsondb-cloud 1.0.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,63 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ tags: ["v*"]
7
+ pull_request:
8
+ branches: [main]
9
+
10
+ jobs:
11
+ ci:
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ python-version: ["3.9", "3.12", "3.13"]
17
+
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+
21
+ - uses: actions/setup-python@v5
22
+ with:
23
+ python-version: ${{ matrix.python-version }}
24
+
25
+ - name: Install dependencies
26
+ run: pip install -e ".[dev]"
27
+
28
+ - name: Ruff
29
+ run: ruff check src/ tests/
30
+
31
+ - name: Mypy
32
+ run: mypy src/
33
+
34
+ - name: Pytest
35
+ run: pytest
36
+
37
+ publish:
38
+ needs: [ci]
39
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
40
+ runs-on: ubuntu-latest
41
+ permissions:
42
+ contents: read
43
+ id-token: write
44
+ steps:
45
+ - uses: actions/checkout@v4
46
+
47
+ - uses: actions/setup-python@v5
48
+ with:
49
+ python-version: "3.12"
50
+
51
+ - name: Install build tools
52
+ run: pip install build hatchling
53
+
54
+ - name: Set version 1.0.{build}
55
+ env:
56
+ BUILD_NUMBER: ${{ github.run_number }}
57
+ run: sed -i "s/^version = .*/version = \"1.0.${BUILD_NUMBER}\"/" pyproject.toml
58
+
59
+ - name: Build
60
+ run: python -m build
61
+
62
+ - name: Publish to PyPI
63
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,5 @@
1
+ __pycache__/
2
+ *.egg-info/
3
+ .pytest_cache/
4
+ dist/
5
+ build/
@@ -0,0 +1,152 @@
1
+ Metadata-Version: 2.4
2
+ Name: jsondb-cloud
3
+ Version: 1.0.4
4
+ Summary: The official Python SDK for jsondb.cloud — a hosted JSON document database.
5
+ Project-URL: Homepage, https://jsondb.cloud
6
+ Project-URL: Documentation, https://jsondb.cloud/docs/sdks/python
7
+ Project-URL: Repository, https://github.com/JsonDBCloud/python
8
+ Project-URL: Issues, https://github.com/JsonDBCloud/python/issues
9
+ Author-email: "jsondb.cloud" <support@jsondb.cloud>
10
+ License-Expression: MIT
11
+ Keywords: api,database,document-database,json,jsondb,sdk
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Database
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Typing :: Typed
24
+ Requires-Python: >=3.9
25
+ Requires-Dist: httpx>=0.24.0
26
+ Provides-Extra: dev
27
+ Requires-Dist: mypy>=1.0; extra == 'dev'
28
+ Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
29
+ Requires-Dist: pytest>=7.0; extra == 'dev'
30
+ Requires-Dist: respx>=0.20; extra == 'dev'
31
+ Requires-Dist: ruff>=0.1; extra == 'dev'
32
+ Description-Content-Type: text/markdown
33
+
34
+ # jsondb-cloud
35
+
36
+ The official Python SDK for [jsondb.cloud](https://jsondb.cloud) — a hosted JSON document database.
37
+
38
+ [![PyPI version](https://img.shields.io/pypi/v/jsondb-cloud)](https://pypi.org/project/jsondb-cloud/)
39
+ [![Downloads](https://img.shields.io/pypi/dm/jsondb-cloud)](https://pypi.org/project/jsondb-cloud/)
40
+ [![CI](https://github.com/JsonDBCloud/python/actions/workflows/ci.yml/badge.svg)](https://github.com/JsonDBCloud/python/actions)
41
+ [![Python](https://img.shields.io/badge/python-%3E%3D3.9-blue)](https://python.org)
42
+ [![GitHub stars](https://img.shields.io/github/stars/JsonDBCloud/python)](https://github.com/JsonDBCloud/python)
43
+ [![Last commit](https://img.shields.io/github/last-commit/JsonDBCloud/python)](https://github.com/JsonDBCloud/python)
44
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
45
+ [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/jsondb-cloud)](https://pypi.org/project/jsondb-cloud/)
46
+
47
+ ## Install
48
+
49
+ ```bash
50
+ pip install jsondb-cloud
51
+ ```
52
+
53
+ ## Quick Start
54
+
55
+ ```python
56
+ from jsondb_cloud import JsonDB
57
+
58
+ db = JsonDB(api_key="jdb_sk_live_xxxx")
59
+ users = db.collection("users")
60
+
61
+ # Create
62
+ user = users.create({"name": "Alice", "email": "alice@example.com"})
63
+
64
+ # Read
65
+ user = users.get(user["_id"])
66
+
67
+ # List with filtering
68
+ admins = users.list(filter={"role": "admin", "age": {"$gte": 21}}, sort="-createdAt", limit=10)
69
+
70
+ # Update
71
+ users.update(user["_id"], {"name": "Alice Updated", "email": "alice@example.com"})
72
+
73
+ # Patch (partial update)
74
+ users.patch(user["_id"], {"age": 31})
75
+
76
+ # Delete
77
+ users.delete(user["_id"])
78
+ ```
79
+
80
+ ## Configuration
81
+
82
+ ```python
83
+ db = JsonDB(
84
+ api_key="jdb_sk_live_xxxx", # required
85
+ project="v1", # project namespace (default: "v1")
86
+ base_url="https://api.jsondb.cloud", # API endpoint
87
+ timeout=30.0, # request timeout in seconds
88
+ max_retries=3, # retries on 429/5xx errors
89
+ headers={"X-Custom": "val"}, # extra headers for every request
90
+ )
91
+ ```
92
+
93
+ `AsyncJsonDB` accepts the same options and supports `async with` for automatic cleanup.
94
+
95
+ ## API
96
+
97
+ All methods are available on both `Collection` (sync) and `AsyncCollection` (async).
98
+
99
+ | Category | Methods |
100
+ |----------|---------|
101
+ | **CRUD** | `create`, `get`, `list`, `update`, `patch`, `json_patch`, `delete` |
102
+ | **Bulk** | `bulk_create`, `bulk` |
103
+ | **Count** | `count` |
104
+ | **Schema** | `get_schema`, `set_schema`, `remove_schema`, `validate` |
105
+ | **Versioning** | `list_versions`, `get_version`, `restore_version`, `diff_versions` |
106
+ | **Webhooks** | `create_webhook`, `list_webhooks`, `get_webhook`, `update_webhook`, `delete_webhook`, `test_webhook` |
107
+ | **Import/Export** | `import_documents`, `export_documents` |
108
+
109
+ See the [full API reference](https://jsondb.cloud/docs/sdks/python) for details.
110
+
111
+ ## Async Usage
112
+
113
+ ```python
114
+ from jsondb_cloud import AsyncJsonDB
115
+
116
+ async with AsyncJsonDB(api_key="jdb_sk_live_xxxx") as db:
117
+ users = db.collection("users")
118
+ user = await users.create({"name": "Alice"})
119
+ page = await users.list(filter={"role": "admin"})
120
+ ```
121
+
122
+ ## Error Handling
123
+
124
+ ```python
125
+ from jsondb_cloud import JsonDB, NotFoundError, QuotaExceededError, JsonDBError
126
+
127
+ try:
128
+ user = users.get("nonexistent")
129
+ except NotFoundError as e:
130
+ print(f"Not found: {e.document_id}")
131
+ except QuotaExceededError as e:
132
+ print(f"Limit: {e.limit}, Current: {e.current}")
133
+ except JsonDBError as e:
134
+ print(f"Error: {e.code} - {e.message} (HTTP {e.status})")
135
+ ```
136
+
137
+ ## Documentation
138
+
139
+ Full documentation at [jsondb.cloud/docs/sdks/python](https://jsondb.cloud/docs/sdks/python).
140
+
141
+ ## Related Packages
142
+
143
+ | Package | Description |
144
+ |---------|-------------|
145
+ | [@jsondb-cloud/client](https://github.com/JsonDBCloud/node) | JavaScript/TypeScript SDK |
146
+ | [@jsondb-cloud/mcp](https://github.com/JsonDBCloud/mcp) | MCP server for AI agents |
147
+ | [@jsondb-cloud/cli](https://github.com/JsonDBCloud/cli) | CLI tool |
148
+ | [jsondb-cloud](https://github.com/JsonDBCloud/python) (PyPI) | Python SDK |
149
+
150
+ ## License
151
+
152
+ MIT
@@ -0,0 +1,119 @@
1
+ # jsondb-cloud
2
+
3
+ The official Python SDK for [jsondb.cloud](https://jsondb.cloud) — a hosted JSON document database.
4
+
5
+ [![PyPI version](https://img.shields.io/pypi/v/jsondb-cloud)](https://pypi.org/project/jsondb-cloud/)
6
+ [![Downloads](https://img.shields.io/pypi/dm/jsondb-cloud)](https://pypi.org/project/jsondb-cloud/)
7
+ [![CI](https://github.com/JsonDBCloud/python/actions/workflows/ci.yml/badge.svg)](https://github.com/JsonDBCloud/python/actions)
8
+ [![Python](https://img.shields.io/badge/python-%3E%3D3.9-blue)](https://python.org)
9
+ [![GitHub stars](https://img.shields.io/github/stars/JsonDBCloud/python)](https://github.com/JsonDBCloud/python)
10
+ [![Last commit](https://img.shields.io/github/last-commit/JsonDBCloud/python)](https://github.com/JsonDBCloud/python)
11
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
12
+ [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/jsondb-cloud)](https://pypi.org/project/jsondb-cloud/)
13
+
14
+ ## Install
15
+
16
+ ```bash
17
+ pip install jsondb-cloud
18
+ ```
19
+
20
+ ## Quick Start
21
+
22
+ ```python
23
+ from jsondb_cloud import JsonDB
24
+
25
+ db = JsonDB(api_key="jdb_sk_live_xxxx")
26
+ users = db.collection("users")
27
+
28
+ # Create
29
+ user = users.create({"name": "Alice", "email": "alice@example.com"})
30
+
31
+ # Read
32
+ user = users.get(user["_id"])
33
+
34
+ # List with filtering
35
+ admins = users.list(filter={"role": "admin", "age": {"$gte": 21}}, sort="-createdAt", limit=10)
36
+
37
+ # Update
38
+ users.update(user["_id"], {"name": "Alice Updated", "email": "alice@example.com"})
39
+
40
+ # Patch (partial update)
41
+ users.patch(user["_id"], {"age": 31})
42
+
43
+ # Delete
44
+ users.delete(user["_id"])
45
+ ```
46
+
47
+ ## Configuration
48
+
49
+ ```python
50
+ db = JsonDB(
51
+ api_key="jdb_sk_live_xxxx", # required
52
+ project="v1", # project namespace (default: "v1")
53
+ base_url="https://api.jsondb.cloud", # API endpoint
54
+ timeout=30.0, # request timeout in seconds
55
+ max_retries=3, # retries on 429/5xx errors
56
+ headers={"X-Custom": "val"}, # extra headers for every request
57
+ )
58
+ ```
59
+
60
+ `AsyncJsonDB` accepts the same options and supports `async with` for automatic cleanup.
61
+
62
+ ## API
63
+
64
+ All methods are available on both `Collection` (sync) and `AsyncCollection` (async).
65
+
66
+ | Category | Methods |
67
+ |----------|---------|
68
+ | **CRUD** | `create`, `get`, `list`, `update`, `patch`, `json_patch`, `delete` |
69
+ | **Bulk** | `bulk_create`, `bulk` |
70
+ | **Count** | `count` |
71
+ | **Schema** | `get_schema`, `set_schema`, `remove_schema`, `validate` |
72
+ | **Versioning** | `list_versions`, `get_version`, `restore_version`, `diff_versions` |
73
+ | **Webhooks** | `create_webhook`, `list_webhooks`, `get_webhook`, `update_webhook`, `delete_webhook`, `test_webhook` |
74
+ | **Import/Export** | `import_documents`, `export_documents` |
75
+
76
+ See the [full API reference](https://jsondb.cloud/docs/sdks/python) for details.
77
+
78
+ ## Async Usage
79
+
80
+ ```python
81
+ from jsondb_cloud import AsyncJsonDB
82
+
83
+ async with AsyncJsonDB(api_key="jdb_sk_live_xxxx") as db:
84
+ users = db.collection("users")
85
+ user = await users.create({"name": "Alice"})
86
+ page = await users.list(filter={"role": "admin"})
87
+ ```
88
+
89
+ ## Error Handling
90
+
91
+ ```python
92
+ from jsondb_cloud import JsonDB, NotFoundError, QuotaExceededError, JsonDBError
93
+
94
+ try:
95
+ user = users.get("nonexistent")
96
+ except NotFoundError as e:
97
+ print(f"Not found: {e.document_id}")
98
+ except QuotaExceededError as e:
99
+ print(f"Limit: {e.limit}, Current: {e.current}")
100
+ except JsonDBError as e:
101
+ print(f"Error: {e.code} - {e.message} (HTTP {e.status})")
102
+ ```
103
+
104
+ ## Documentation
105
+
106
+ Full documentation at [jsondb.cloud/docs/sdks/python](https://jsondb.cloud/docs/sdks/python).
107
+
108
+ ## Related Packages
109
+
110
+ | Package | Description |
111
+ |---------|-------------|
112
+ | [@jsondb-cloud/client](https://github.com/JsonDBCloud/node) | JavaScript/TypeScript SDK |
113
+ | [@jsondb-cloud/mcp](https://github.com/JsonDBCloud/mcp) | MCP server for AI agents |
114
+ | [@jsondb-cloud/cli](https://github.com/JsonDBCloud/cli) | CLI tool |
115
+ | [jsondb-cloud](https://github.com/JsonDBCloud/python) (PyPI) | Python SDK |
116
+
117
+ ## License
118
+
119
+ MIT