python-arango-async 1.2.6__tar.gz → 1.2.8__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.
Files changed (116) hide show
  1. python_arango_async-1.2.8/.agents/skills/python-arango-async-development/SKILL.md +89 -0
  2. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/.circleci/config.yml +2 -9
  3. {python_arango_async-1.2.6/python_arango_async.egg-info → python_arango_async-1.2.8}/PKG-INFO +1 -1
  4. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/arangoasync/client.py +14 -7
  5. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/arangoasync/connection.py +2 -0
  6. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/arangoasync/database.py +26 -10
  7. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/arangoasync/graph.py +3 -2
  8. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/arangoasync/typings.py +28 -0
  9. python_arango_async-1.2.8/arangoasync/version.py +1 -0
  10. python_arango_async-1.2.8/docs/authentication.rst +121 -0
  11. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/graph.rst +39 -0
  12. {python_arango_async-1.2.6 → python_arango_async-1.2.8/python_arango_async.egg-info}/PKG-INFO +1 -1
  13. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/python_arango_async.egg-info/SOURCES.txt +1 -0
  14. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/python_arango_async.egg-info/scm_file_list.json +1 -0
  15. python_arango_async-1.2.8/python_arango_async.egg-info/scm_version.json +8 -0
  16. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/test_aql.py +2 -2
  17. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/test_connection.py +43 -0
  18. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/test_graph.py +78 -2
  19. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/test_typings.py +23 -0
  20. python_arango_async-1.2.6/arangoasync/version.py +0 -1
  21. python_arango_async-1.2.6/docs/authentication.rst +0 -117
  22. python_arango_async-1.2.6/python_arango_async.egg-info/scm_version.json +0 -8
  23. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/.github/workflows/codeql.yaml +0 -0
  24. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/.github/workflows/docs.yaml +0 -0
  25. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/.github/workflows/pypi.yaml +0 -0
  26. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/.gitignore +0 -0
  27. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/.pre-commit-config.yaml +0 -0
  28. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/.readthedocs.yaml +0 -0
  29. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/AGENTS.md +0 -0
  30. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/LICENSE +0 -0
  31. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/README.md +0 -0
  32. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/arangoasync/__init__.py +0 -0
  33. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/arangoasync/aql.py +0 -0
  34. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/arangoasync/auth.py +0 -0
  35. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/arangoasync/backup.py +0 -0
  36. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/arangoasync/cluster.py +0 -0
  37. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/arangoasync/collection.py +0 -0
  38. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/arangoasync/compression.py +0 -0
  39. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/arangoasync/cursor.py +0 -0
  40. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/arangoasync/errno.py +0 -0
  41. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/arangoasync/exceptions.py +0 -0
  42. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/arangoasync/executor.py +0 -0
  43. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/arangoasync/foxx.py +0 -0
  44. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/arangoasync/http.py +0 -0
  45. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/arangoasync/job.py +0 -0
  46. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/arangoasync/logger.py +0 -0
  47. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/arangoasync/replication.py +0 -0
  48. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/arangoasync/request.py +0 -0
  49. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/arangoasync/resolver.py +0 -0
  50. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/arangoasync/response.py +0 -0
  51. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/arangoasync/result.py +0 -0
  52. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/arangoasync/serialization.py +0 -0
  53. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/admin.rst +0 -0
  54. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/analyzer.rst +0 -0
  55. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/aql.rst +0 -0
  56. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/async.rst +0 -0
  57. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/backup.rst +0 -0
  58. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/certificates.rst +0 -0
  59. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/cluster.rst +0 -0
  60. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/collection.rst +0 -0
  61. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/compression.rst +0 -0
  62. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/conf.py +0 -0
  63. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/cursor.rst +0 -0
  64. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/database.rst +0 -0
  65. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/document.rst +0 -0
  66. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/errno.rst +0 -0
  67. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/errors.rst +0 -0
  68. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/foxx.rst +0 -0
  69. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/helpers.rst +0 -0
  70. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/http.rst +0 -0
  71. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/index.rst +0 -0
  72. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/indexes.rst +0 -0
  73. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/logging.rst +0 -0
  74. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/migration.rst +0 -0
  75. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/overview.rst +0 -0
  76. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/serialization.rst +0 -0
  77. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/specs.rst +0 -0
  78. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/static/logo.png +0 -0
  79. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/task.rst +0 -0
  80. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/transaction.rst +0 -0
  81. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/user.rst +0 -0
  82. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/docs/view.rst +0 -0
  83. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/pyproject.toml +0 -0
  84. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/python_arango_async.egg-info/dependency_links.txt +0 -0
  85. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/python_arango_async.egg-info/requires.txt +0 -0
  86. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/python_arango_async.egg-info/top_level.txt +0 -0
  87. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/setup.cfg +0 -0
  88. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/setup.py +0 -0
  89. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/starter.sh +0 -0
  90. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/__init__.py +0 -0
  91. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/conftest.py +0 -0
  92. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/helpers.py +0 -0
  93. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/static/cluster-3.12.conf +0 -0
  94. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/static/cluster-4.0.conf +0 -0
  95. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/static/keyfile +0 -0
  96. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/static/service.zip +0 -0
  97. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/static/single-3.12.conf +0 -0
  98. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/static/single-4.0.conf +0 -0
  99. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/test_analyzer.py +0 -0
  100. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/test_async.py +0 -0
  101. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/test_backup.py +0 -0
  102. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/test_client.py +0 -0
  103. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/test_cluster.py +0 -0
  104. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/test_collection.py +0 -0
  105. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/test_compression.py +0 -0
  106. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/test_cursor.py +0 -0
  107. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/test_database.py +0 -0
  108. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/test_document.py +0 -0
  109. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/test_foxx.py +0 -0
  110. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/test_http.py +0 -0
  111. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/test_imports.py +0 -0
  112. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/test_resolver.py +0 -0
  113. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/test_task.py +0 -0
  114. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/test_transaction.py +0 -0
  115. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/test_user.py +0 -0
  116. {python_arango_async-1.2.6 → python_arango_async-1.2.8}/tests/test_view.py +0 -0
@@ -0,0 +1,89 @@
1
+ ---
2
+ name: python-arango-async-development
3
+ description: >-
4
+ Maintain and extend python-arango-async, the asyncio ArangoDB Python driver.
5
+ Use for driver features, bug fixes, refactoring, and related tests or
6
+ documentation, rather than application code that uses the driver.
7
+ ---
8
+
9
+ # Async Python driver development
10
+
11
+ Follow the repository's [AGENTS.md](../../../AGENTS.md) for setup, validation
12
+ commands, and contribution rules.
13
+
14
+ Before changing an operation, trace a neighboring method with a similar
15
+ request and response shape. Public API methods usually construct a `Request`,
16
+ define a synchronous response handler, and call
17
+ `await self._executor.execute(request, response_handler)`.
18
+ See `arangoasync/request.py`, `arangoasync/executor.py`, and the API group
19
+ being changed. Keep request construction and response conversion at the same
20
+ layer as neighboring operations.
21
+
22
+ Preserve executor dispatch. It supports default execution, transactions, and
23
+ ArangoDB background jobs. Calling the connection or HTTP client directly can
24
+ bypass transaction headers and job handling. Preserve `Result[T]` annotations
25
+ where applicable: after awaiting an operation, its result may be `T`,
26
+ `AsyncJob[T]`, or `None`, depending on the execution context.
27
+
28
+ Distinguish asyncio I/O from ArangoDB asynchronous API execution.
29
+ `begin_async_execution()` selects server-side background jobs; it does not
30
+ make an otherwise synchronous driver asynchronous. Follow existing boundaries
31
+ between synchronous wrapper factories and awaited operations rather than
32
+ adding `async` or `await` indiscriminately.
33
+
34
+ For endpoint or option changes, verify the server HTTP API for the targeted
35
+ ArangoDB versions. Map Python option names to the specified wire names and
36
+ locations: endpoint path, `params`, `headers`, or `data`. Preserve existing
37
+ defaults and distinguish omitted options from explicit `False`, `0`, or empty
38
+ values. Where `None` means omission, use `is not None`. `Request.normalized_params()`
39
+ stringifies supplied values, including `None`; omit such query entries before
40
+ constructing the request. Keep explicit JSON nulls where the body requires them.
41
+
42
+ Preserve typed option and response wrappers in `arangoasync/typings.py`.
43
+ Follow neighboring uses of `JsonWrapper`, `.to_dict()`, validation, and typed
44
+ properties rather than replacing wrappers with plain dictionaries. Keep public
45
+ signatures, annotations, Sphinx docstrings, and response shapes aligned.
46
+
47
+ Respect configurable serialization. Inspect whether an operation uses the
48
+ executor's serializer/deserializer for API payloads and metadata, or the
49
+ collection's document serializer/deserializer for user documents. Preserve
50
+ `Collection[T, U, V]` contracts, including distinct single-document and
51
+ multiple-document deserialization results. Do not replace these hooks with
52
+ direct JSON calls or assume custom documents are dictionaries.
53
+ See `arangoasync/serialization.py` and `docs/serialization.rst`.
54
+
55
+ Follow neighboring handlers' success checks and special-status handling.
56
+ Preserve revision-conflict exceptions, missing-resource options, and silent
57
+ results. Raise operation-specific exceptions from `arangoasync/exceptions.py`
58
+ with `(resp, request)` to retain HTTP and ArangoDB error details.
59
+
60
+ For client, transport, cursor, or job changes, preserve awaited cleanup and
61
+ existing async context-manager behavior. Avoid blocking I/O or sleeps in
62
+ coroutines. Keep transport changes compatible with the `HTTPClient` abstraction
63
+ in `arangoasync/http.py`. Inspect connection and resolver behavior before changing
64
+ authentication, host failover, or retries.
65
+
66
+ Cursors use async iteration and retain mutable batch state. Preserve batch
67
+ boundaries, exhaustion behavior, and server-resource cleanup. Cursors obtained
68
+ from background jobs fetch subsequent batches through a non-job executor;
69
+ transaction cursors must retain their transaction context.
70
+ See `arangoasync/aql.py`, `arangoasync/cursor.py`, and `arangoasync/job.py`.
71
+
72
+ Add focused regression coverage in the relevant `tests/test_*.py` module,
73
+ reusing fixtures and helpers from `tests/conftest.py` and `tests/helpers.py`.
74
+ Follow existing `pytest.mark.asyncio` and `pytest_asyncio.fixture` patterns.
75
+ Cover affected request mapping, result conversion, and error behavior;
76
+ exercise related execution contexts when the change affects them.
77
+
78
+ Pytest normally contacts ArangoDB during configuration, even for database-free
79
+ tests or collection. Use `--skip-arango-setup` only for tests whose fixture
80
+ dependencies need no server, for example:
81
+
82
+ python -m pytest tests/test_imports.py tests/test_typings.py --skip-arango-setup
83
+
84
+ This flag bypasses setup; it does not make integration tests run offline.
85
+ For server behavior, use a disposable instance and the commands in AGENTS.md.
86
+ Pass `--cluster` only for an actual cluster; the flag does not start one.
87
+ Check version and capability skips: skipped cases do not validate the change.
88
+ Start with affected tests, expand for changed contracts, and report unverified
89
+ behavior.
@@ -29,13 +29,6 @@ workflows:
29
29
  matrix:
30
30
  parameters:
31
31
  python_version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
32
- - integration-test:
33
- name: ArangoDB (enterprise, 3.12.10 << matrix.arangodb_config >>)
34
- matrix:
35
- parameters:
36
- arangodb_config: ["single", "cluster"]
37
- arangodb_image: ["arangodb/enterprise:3.12.10"]
38
- arangodb_conf_version: ["3.12"]
39
32
  - integration-test:
40
33
  name: ArangoDB (enterprise, 3.12.9 << matrix.arangodb_config >>)
41
34
  matrix:
@@ -51,11 +44,11 @@ workflows:
51
44
  arangodb_image: [ "arangodb/core-preview:4.0-nightly" ]
52
45
  arangodb_conf_version: [ "4.0" ]
53
46
  - integration-test:
54
- name: ArangoDB (enterprise-preview, 3.12-nightly << matrix.arangodb_config >>)
47
+ name: ArangoDB (enterprise, 3.12-latest << matrix.arangodb_config >>)
55
48
  matrix:
56
49
  parameters:
57
50
  arangodb_config: ["single", "cluster"]
58
- arangodb_image: ["arangodb/enterprise-preview:3.12-nightly"]
51
+ arangodb_image: ["arangodb/enterprise:3.12"]
59
52
  arangodb_conf_version: ["3.12"]
60
53
 
61
54
  jobs:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-arango-async
3
- Version: 1.2.6
3
+ Version: 1.2.8
4
4
  Summary: Async Python Driver for ArangoDB
5
5
  Author-email: Alexandru Petenchea <alexandru.petenchea@arangodb.com>, Anthony Mahanna <anthony.mahanna@arangodb.com>
6
6
  Maintainer-email: Alexandru Petenchea <alexandru.petenchea@arangodb.com>, Anthony Mahanna <anthony.mahanna@arangodb.com>
@@ -163,16 +163,22 @@ class ArangoClient:
163
163
  - "basic": HTTP authentication.
164
164
  Requires the `auth` parameter. The `token` parameter is ignored.
165
165
  - "jwt": User JWT authentication.
166
- At least one of the `auth` or `token` parameters are required.
167
- If `auth` is provided, but the `token` is not, the token will be
168
- refreshed automatically. This assumes that the clocks of the server
169
- and client are synchronized.
166
+ At least one of `auth` or `token` is required.
167
+ Credentials in `auth` allow token acquisition and renewal,
168
+ including when an initial `token` is provided. Without a token,
169
+ acquisition happens on the first request. After HTTP 401,
170
+ a locally expired token triggers renewal and one replay.
171
+ Keep client and server clocks synchronized.
170
172
  - "superuser": Superuser JWT authentication.
171
173
  The `token` parameter is required. The `auth` parameter is ignored.
172
- auth (Auth | None): Login information (username and password) or
173
- access token.
174
- token (JwtToken | None): JWT token.
174
+ auth (Auth | str | None): Login information (username and password) or
175
+ access token. A string is used as the password with an empty username.
176
+ token (JwtToken | None): Initial JWT token. With `auth_method="jwt"`,
177
+ provide `auth` as well to allow renewal. Without credentials,
178
+ a 401 after local expiration raises `JWTRefreshError`.
175
179
  verify (bool): Verify the connection by sending a test request.
180
+ For JWT authentication without an initial token, this also triggers
181
+ acquisition before returning the database wrapper.
176
182
  compression (CompressionManager | None): If set, supersedes the
177
183
  client-level compression settings.
178
184
  serializer (Serializer | None): If set, supersedes the client-level
@@ -186,6 +192,7 @@ class ArangoClient:
186
192
  Raises:
187
193
  ValueError: If the authentication is invalid.
188
194
  ServerConnectionError: If `verify` is `True` and the connection fails.
195
+ JWTRefreshError: If `verify` is `True` and JWT acquisition or renewal fails.
189
196
  """
190
197
  connection: Connection
191
198
 
@@ -178,6 +178,7 @@ class BaseConnection(ABC):
178
178
 
179
179
  if request.prefix_needed:
180
180
  request.endpoint = f"{self._db_endpoint}{request.endpoint}"
181
+ request.prefix_needed = False
181
182
  host_index = self._host_resolver.get_host_index()
182
183
  for tries in range(self._host_resolver.max_tries):
183
184
  try:
@@ -432,6 +433,7 @@ class JwtConnection(BaseConnection):
432
433
  ):
433
434
  # If the token has expired, refresh it and retry the request
434
435
  await self.refresh_token()
436
+ request.headers["authorization"] = self._auth_header
435
437
  resp = await self.process_request(request)
436
438
  return resp
437
439
 
@@ -1240,11 +1240,18 @@ class Database:
1240
1240
  edge collection), "from" (list of vertex collection names) and "to"
1241
1241
  (list of vertex collection names).
1242
1242
  is_disjoint (bool | None): Whether to create a Disjoint SmartGraph
1243
- instead of a regular SmartGraph (Enterprise Edition only).
1244
- is_smart (bool | None): Define if the created graph should be smart
1245
- (Enterprise Edition only).
1243
+ instead of a regular SmartGraph. Only has an effect with
1244
+ `smart_graph_attribute` or `is_smart` (Enterprise Edition only).
1245
+ Deprecated: use `GraphOptions.is_disjoint` instead.
1246
+ is_smart (bool | None): If `True`, create a SmartGraph when
1247
+ `options.smart_graph_attribute` is set, or an EnterpriseGraph
1248
+ otherwise. Ignored for SatelliteGraphs (Enterprise Edition only).
1249
+ Deprecated: use `GraphOptions.is_smart` instead.
1246
1250
  options (GraphOptions | dict | None): Options for creating collections
1247
- within this graph.
1251
+ within this graph. Setting `smart_graph_attribute` creates a
1252
+ SmartGraph even if `is_smart` is omitted or `False`. Explicit
1253
+ `is_smart` and `is_disjoint` arguments override the corresponding
1254
+ entries in these options.
1248
1255
  orphan_collections (list | None): An array of additional vertex
1249
1256
  collections. Documents in these collections do not have edges
1250
1257
  within this graph.
@@ -1260,6 +1267,15 @@ class Database:
1260
1267
  References:
1261
1268
  - `create-a-graph <https://docs.arango.ai/arangodb/stable/develop/http-api/graphs/named-graphs/#create-a-graph>`__
1262
1269
  """ # noqa: E501
1270
+ if is_smart is not None or is_disjoint is not None:
1271
+ warn(
1272
+ "The separate is_smart and is_disjoint arguments are deprecated; "
1273
+ "pass these flags through GraphOptions or the options "
1274
+ "dictionary instead.",
1275
+ DeprecationWarning,
1276
+ stacklevel=2,
1277
+ )
1278
+
1263
1279
  params: Params = {}
1264
1280
  if wait_for_sync is not None:
1265
1281
  params["waitForSync"] = wait_for_sync
@@ -1267,15 +1283,15 @@ class Database:
1267
1283
  data: Json = {"name": name}
1268
1284
  if edge_definitions is not None:
1269
1285
  data["edgeDefinitions"] = edge_definitions
1270
- if is_disjoint is not None:
1271
- data["isDisjoint"] = is_disjoint
1272
- if is_smart is not None:
1273
- data["isSmart"] = is_smart
1274
1286
  if options is not None:
1275
1287
  if isinstance(options, GraphOptions):
1276
- data["options"] = options.to_dict()
1288
+ data["options"] = options.to_dict().copy()
1277
1289
  else:
1278
- data["options"] = options
1290
+ data["options"] = options.copy()
1291
+ if is_disjoint is not None:
1292
+ data.setdefault("options", {})["isDisjoint"] = is_disjoint
1293
+ if is_smart is not None:
1294
+ data.setdefault("options", {})["isSmart"] = is_smart
1279
1295
  if orphan_collections is not None:
1280
1296
  data["orphanCollections"] = orphan_collections
1281
1297
 
@@ -87,10 +87,11 @@ class Graph(Generic[T, U, V]):
87
87
  """Get the properties of the graph.
88
88
 
89
89
  Returns:
90
- GraphProperties: Properties of the graph.
90
+ GraphProperties: Properties of the graph, including `is_smart`,
91
+ `is_disjoint`, and `smart_graph_attribute`.
91
92
 
92
93
  Raises:
93
- GraphProperties: If the operation fails.
94
+ GraphPropertiesError: If the operation fails.
94
95
 
95
96
  References:
96
97
  - `get-a-graph <https://docs.arango.ai/arangodb/stable/develop/http-api/graphs/named-graphs/#get-a-graph>`__
@@ -1873,6 +1873,16 @@ class GraphProperties(JsonWrapper):
1873
1873
  """Check if the graph is a smart graph."""
1874
1874
  return cast(bool, self._data.get("isSmart", False))
1875
1875
 
1876
+ @property
1877
+ def is_disjoint(self) -> bool:
1878
+ """Check if the graph is a Disjoint SmartGraph."""
1879
+ return cast(bool, self._data.get("isDisjoint", False))
1880
+
1881
+ @property
1882
+ def smart_graph_attribute(self) -> Optional[str]:
1883
+ """Return the sharding attribute for a SmartGraph, if present."""
1884
+ return cast(Optional[str], self._data.get("smartGraphAttribute"))
1885
+
1876
1886
  @property
1877
1887
  def is_satellite(self) -> bool:
1878
1888
  """Check if the graph is a satellite graph."""
@@ -1963,6 +1973,10 @@ class GraphOptions(JsonWrapper):
1963
1973
  Enterprise Edition.
1964
1974
  write_concern (int | None): The write concern for new collections in the
1965
1975
  graph.
1976
+ is_smart (bool | None): Create a SmartGraph when `smart_graph_attribute`
1977
+ is set, or an EnterpriseGraph otherwise. Ignored for SatelliteGraphs.
1978
+ is_disjoint (bool | None): Create a Disjoint SmartGraph. Only has an
1979
+ effect with `smart_graph_attribute` or `is_smart`.
1966
1980
 
1967
1981
  References:
1968
1982
  - `create-a-graph <https://docs.arango.ai/arangodb/stable/develop/http-api/graphs/named-graphs/#create-a-graph>`__
@@ -1975,6 +1989,8 @@ class GraphOptions(JsonWrapper):
1975
1989
  satellites: Optional[List[str]] = None,
1976
1990
  smart_graph_attribute: Optional[str] = None,
1977
1991
  write_concern: Optional[int] = None,
1992
+ is_smart: Optional[bool] = None,
1993
+ is_disjoint: Optional[bool] = None,
1978
1994
  ) -> None:
1979
1995
  data: Json = dict()
1980
1996
  if number_of_shards is not None:
@@ -1987,8 +2003,20 @@ class GraphOptions(JsonWrapper):
1987
2003
  data["smartGraphAttribute"] = smart_graph_attribute
1988
2004
  if write_concern is not None:
1989
2005
  data["writeConcern"] = write_concern
2006
+ if is_smart is not None:
2007
+ data["isSmart"] = is_smart
2008
+ if is_disjoint is not None:
2009
+ data["isDisjoint"] = is_disjoint
1990
2010
  super().__init__(data)
1991
2011
 
2012
+ @property
2013
+ def is_smart(self) -> Optional[bool]:
2014
+ return cast(Optional[bool], self._data.get("isSmart"))
2015
+
2016
+ @property
2017
+ def is_disjoint(self) -> Optional[bool]:
2018
+ return cast(Optional[bool], self._data.get("isDisjoint"))
2019
+
1992
2020
  @property
1993
2021
  def number_of_shards(self) -> Optional[int]:
1994
2022
  return cast(int, self._data.get("numberOfShards"))
@@ -0,0 +1 @@
1
+ __version__ = "1.2.8"
@@ -0,0 +1,121 @@
1
+ Authentication
2
+ --------------
3
+
4
+ Two HTTP authentication methods are supported out of the box:
5
+
6
+ 1. Basic username and password authentication
7
+ 2. JSON Web Tokens (JWT)
8
+
9
+ Basic Authentication
10
+ ====================
11
+
12
+ This is the default authentication method.
13
+
14
+ Example:
15
+
16
+ .. code-block:: python
17
+
18
+ from arangoasync import ArangoClient
19
+ from arangoasync.auth import Auth
20
+
21
+ # Initialize the client for ArangoDB.
22
+ async with ArangoClient(hosts="http://localhost:8529") as client:
23
+ auth = Auth(
24
+ username="root",
25
+ password="passwd",
26
+ encoding="utf-8" # Encoding for the password, default is utf-8.
27
+ )
28
+
29
+ # Connect to "test" database as root user.
30
+ db = await client.db(
31
+ "test", # database name
32
+ auth_method="basic", # use basic authentication (default)
33
+ auth=auth, # authentication details
34
+ verify=True, # verify the connection (optional)
35
+ )
36
+
37
+ JSON Web Tokens (JWT)
38
+ =====================
39
+
40
+ JWTs are sent as Bearer tokens in the HTTP ``Authorization`` header.
41
+ Use ``auth_method="jwt"`` with credentials, a token, or both.
42
+
43
+ Tokens with renewal credentials
44
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45
+
46
+ Provide ``auth`` to allow token acquisition and renewal. Without an initial
47
+ ``token``, acquisition happens on the first request; ``verify=True`` triggers
48
+ that request during ``await client.db()``. Providing both ``auth`` and ``token``
49
+ uses the supplied token initially and retains credentials for renewal.
50
+
51
+ For each database request, the renewal policy is:
52
+
53
+ 1. Send the request with the current token.
54
+ 2. If the response has HTTP status 401 and the token is past its locally
55
+ recorded expiration, obtain a replacement using the retained credentials.
56
+ 3. Retry the original request once with the replacement token. A second
57
+ rejection is returned to the operation's response handler without another
58
+ renewal or replay.
59
+
60
+ If acquisition fails, the original request is not replayed and the error
61
+ propagates. Authentication failures during acquisition raise
62
+ :class:`arangoasync.exceptions.JWTRefreshError`.
63
+
64
+ The ArangoDB error code is not checked; other responses do not trigger renewal.
65
+ There is no proactive renewal or Basic authentication fallback.
66
+ Keep client and server clocks synchronized for local expiration checks.
67
+
68
+ .. code-block:: python
69
+
70
+ from arangoasync import ArangoClient
71
+ from arangoasync.auth import Auth
72
+
73
+ async with ArangoClient(hosts="http://localhost:8529") as client:
74
+ db = await client.db(
75
+ "test", auth_method="jwt",
76
+ auth=Auth(username="root", password="passwd"), verify=True
77
+ )
78
+ # Explicit refresh uses the retained credentials.
79
+ await db.connection.refresh_token()
80
+
81
+ Tokens without renewal credentials
82
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
83
+
84
+ Provide ``token`` without ``auth`` when the application supplies replacements.
85
+ Pass a :class:`arangoasync.auth.JwtToken`; constructing one with an expired token
86
+ raises ``jwt.exceptions.ExpiredSignatureError``. A token-only connection receiving
87
+ HTTP 401 after local expiry currently raises
88
+ :class:`arangoasync.exceptions.JWTRefreshError` because it lacks renewal credentials.
89
+
90
+ Replace tokens through ``db.connection.token``. Existing wrappers sharing that
91
+ connection use the replacement on subsequent requests; separate ``client.db()``
92
+ calls remain independent.
93
+
94
+ .. code-block:: python
95
+
96
+ from arangoasync import ArangoClient
97
+ from arangoasync.auth import JwtToken
98
+
99
+ # Token strings come from the application's provider.
100
+ async with ArangoClient(hosts="http://localhost:8529") as client:
101
+ db = await client.db(
102
+ "test", auth_method="jwt", token=JwtToken(encoded_token), verify=True
103
+ )
104
+ db.connection.token = JwtToken(replacement_encoded_token)
105
+
106
+ Superuser tokens
107
+ ~~~~~~~~~~~~~~~~
108
+
109
+ Use ``auth_method="superuser"`` with a ``JwtToken``. The driver ignores ``auth``
110
+ and performs no automatic renewal or replay. Token validation and replacement
111
+ work as above. With ``verify=True``, a rejected superuser token raises
112
+ :class:`arangoasync.exceptions.ServerConnectionError` during ``await client.db()``.
113
+
114
+ Within a client context, generate a token using the server's JWT secret:
115
+
116
+ .. code-block:: python
117
+
118
+ token = JwtToken.generate_token("secret")
119
+ db = await client.db(
120
+ "test", auth_method="superuser", token=token, verify=True
121
+ )
@@ -42,6 +42,45 @@ For more information, refer to `ArangoDB Manual`_.
42
42
  # Delete the graph.
43
43
  await db.delete_graph("school")
44
44
 
45
+ Graph creation options
46
+ ======================
47
+
48
+ Pass ``GraphOptions(is_smart=True)`` as ``options`` to create an EnterpriseGraph
49
+ without a user-defined sharding attribute. Set ``GraphOptions.smart_graph_attribute``
50
+ to create a SmartGraph; ``is_smart=True`` is then optional. Every vertex must
51
+ contain the named attribute.
52
+
53
+ Set ``is_disjoint=True`` in ``GraphOptions`` with a smart graph attribute to create
54
+ a Disjoint SmartGraph, which rejects edges between vertices with different
55
+ attribute values.
56
+ For example, on an Enterprise cluster:
57
+
58
+ .. code-block:: python
59
+
60
+ from arangoasync.typings import GraphOptions
61
+
62
+ regional = await db.create_graph(
63
+ "regional",
64
+ edge_definitions=[{
65
+ "collection": "routes",
66
+ "from": ["places"],
67
+ "to": ["places"],
68
+ }],
69
+ options=GraphOptions(
70
+ number_of_shards=3,
71
+ smart_graph_attribute="region",
72
+ is_disjoint=True,
73
+ ),
74
+ )
75
+ properties = await regional.properties()
76
+ assert properties.is_disjoint is True
77
+ assert properties.smart_graph_attribute == "region"
78
+
79
+ The separate ``create_graph(is_smart=..., is_disjoint=...)`` arguments are
80
+ deprecated. Pass these flags through ``GraphOptions`` or a raw ``options``
81
+ dictionary instead. Existing separate arguments still take precedence over
82
+ matching entries in ``options``, including explicit ``False`` values.
83
+
45
84
  .. _edge-definitions:
46
85
 
47
86
  Edge Definitions
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-arango-async
3
- Version: 1.2.6
3
+ Version: 1.2.8
4
4
  Summary: Async Python Driver for ArangoDB
5
5
  Author-email: Alexandru Petenchea <alexandru.petenchea@arangodb.com>, Anthony Mahanna <anthony.mahanna@arangodb.com>
6
6
  Maintainer-email: Alexandru Petenchea <alexandru.petenchea@arangodb.com>, Anthony Mahanna <anthony.mahanna@arangodb.com>
@@ -8,6 +8,7 @@ pyproject.toml
8
8
  setup.cfg
9
9
  setup.py
10
10
  starter.sh
11
+ .agents/skills/python-arango-async-development/SKILL.md
11
12
  .circleci/config.yml
12
13
  .github/workflows/codeql.yaml
13
14
  .github/workflows/docs.yaml
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "files": [
3
+ ".agents/skills/python-arango-async-development/SKILL.md",
3
4
  ".circleci/config.yml",
4
5
  ".github/workflows/codeql.yaml",
5
6
  ".github/workflows/docs.yaml",
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "1.2.8",
3
+ "distance": 0,
4
+ "node": "g1d6884bc5fe53f2ac38833f2462897468cbf4a27",
5
+ "dirty": false,
6
+ "branch": "HEAD",
7
+ "node_date": "2026-11-26"
8
+ }
@@ -52,8 +52,8 @@ async def test_simple_query(db, bad_db, doc_col, docs):
52
52
 
53
53
 
54
54
  @pytest.mark.asyncio
55
- async def test_query_tracking(db, bad_db):
56
- aql = db.aql
55
+ async def test_query_tracking(sys_db, bad_db):
56
+ aql = sys_db.aql
57
57
 
58
58
  # Get the current tracking properties.
59
59
  tracking = await aql.tracking()
@@ -1,5 +1,9 @@
1
+ import time
1
2
  import zlib
3
+ from datetime import datetime, timezone
4
+ from unittest.mock import patch
2
5
 
6
+ import jwt
3
7
  import pytest
4
8
 
5
9
  from arangoasync.auth import Auth, JwtToken
@@ -230,6 +234,45 @@ async def test_JwtConnection_ping_success(
230
234
  assert connection3.token != connection1.token
231
235
 
232
236
 
237
+ @pytest.mark.asyncio
238
+ async def test_JwtConnection_expired_token_recovery(
239
+ client_session, url, sys_db_name, root, password, pytestconfig
240
+ ):
241
+ client = AioHTTPClient()
242
+ session = client_session(client, url)
243
+ issued_at = int(time.time()) - 120
244
+ encoded_token = jwt.encode(
245
+ {
246
+ "preferred_username": root,
247
+ "iss": "arangodb",
248
+ "iat": issued_at,
249
+ "exp": issued_at + 60,
250
+ },
251
+ key=pytestconfig.getoption("secret"),
252
+ algorithm="HS256",
253
+ )
254
+
255
+ # Accept the token while valid, then restore the clock before dispatch.
256
+ with patch("jwt.api_jwt.datetime") as clock:
257
+ clock.now.return_value = datetime.fromtimestamp(issued_at, timezone.utc)
258
+ expired_token = JwtToken(encoded_token)
259
+
260
+ assert expired_token.needs_refresh()
261
+ connection = JwtConnection(
262
+ sessions=[session],
263
+ host_resolver=DefaultHostResolver(1),
264
+ http_client=client,
265
+ db_name=sys_db_name,
266
+ auth=Auth(username=root, password=password),
267
+ token=expired_token,
268
+ )
269
+
270
+ # Expect that the token is renewed automatically.
271
+ assert await connection.ping() == 200
272
+ assert connection.token.token != expired_token.token
273
+ assert not connection.token.needs_refresh()
274
+
275
+
233
276
  @pytest.mark.asyncio
234
277
  async def test_JwtSuperuserConnection_ping_success(
235
278
  client_session, url, sys_db_name, token