aerospike-sdk 0.9.0a1__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 (70) hide show
  1. aerospike_sdk-0.9.0a1/LICENSE +201 -0
  2. aerospike_sdk-0.9.0a1/PKG-INFO +240 -0
  3. aerospike_sdk-0.9.0a1/README.md +207 -0
  4. aerospike_sdk-0.9.0a1/VERSION +1 -0
  5. aerospike_sdk-0.9.0a1/aerospike_sdk/__init__.py +136 -0
  6. aerospike_sdk-0.9.0a1/aerospike_sdk/ael/__init__.py +34 -0
  7. aerospike_sdk-0.9.0a1/aerospike_sdk/ael/antlr4/generated/ConditionLexer.py +459 -0
  8. aerospike_sdk-0.9.0a1/aerospike_sdk/ael/antlr4/generated/ConditionListener.py +1200 -0
  9. aerospike_sdk-0.9.0a1/aerospike_sdk/ael/antlr4/generated/ConditionParser.py +8578 -0
  10. aerospike_sdk-0.9.0a1/aerospike_sdk/ael/antlr4/generated/ConditionVisitor.py +673 -0
  11. aerospike_sdk-0.9.0a1/aerospike_sdk/ael/antlr4/generated/__init__.py +0 -0
  12. aerospike_sdk-0.9.0a1/aerospike_sdk/ael/arithmetic_filter.py +262 -0
  13. aerospike_sdk-0.9.0a1/aerospike_sdk/ael/exceptions.py +50 -0
  14. aerospike_sdk-0.9.0a1/aerospike_sdk/ael/exp_visitor.py +3108 -0
  15. aerospike_sdk-0.9.0a1/aerospike_sdk/ael/filter_gen.py +571 -0
  16. aerospike_sdk-0.9.0a1/aerospike_sdk/ael/filter_visitor.py +505 -0
  17. aerospike_sdk-0.9.0a1/aerospike_sdk/ael/parser.py +323 -0
  18. aerospike_sdk-0.9.0a1/aerospike_sdk/aio/__init__.py +38 -0
  19. aerospike_sdk-0.9.0a1/aerospike_sdk/aio/background.py +496 -0
  20. aerospike_sdk-0.9.0a1/aerospike_sdk/aio/client.py +648 -0
  21. aerospike_sdk-0.9.0a1/aerospike_sdk/aio/cluster.py +158 -0
  22. aerospike_sdk-0.9.0a1/aerospike_sdk/aio/cluster_definition.py +478 -0
  23. aerospike_sdk-0.9.0a1/aerospike_sdk/aio/info.py +285 -0
  24. aerospike_sdk-0.9.0a1/aerospike_sdk/aio/operations/__init__.py +35 -0
  25. aerospike_sdk-0.9.0a1/aerospike_sdk/aio/operations/batch.py +554 -0
  26. aerospike_sdk-0.9.0a1/aerospike_sdk/aio/operations/cdt_read.py +700 -0
  27. aerospike_sdk-0.9.0a1/aerospike_sdk/aio/operations/cdt_write.py +1013 -0
  28. aerospike_sdk-0.9.0a1/aerospike_sdk/aio/operations/index.py +238 -0
  29. aerospike_sdk-0.9.0a1/aerospike_sdk/aio/operations/query.py +5660 -0
  30. aerospike_sdk-0.9.0a1/aerospike_sdk/aio/operations/udf.py +311 -0
  31. aerospike_sdk-0.9.0a1/aerospike_sdk/aio/session.py +1279 -0
  32. aerospike_sdk-0.9.0a1/aerospike_sdk/aio/tls_builder.py +198 -0
  33. aerospike_sdk-0.9.0a1/aerospike_sdk/aio/transactional_session.py +180 -0
  34. aerospike_sdk-0.9.0a1/aerospike_sdk/background_shared.py +90 -0
  35. aerospike_sdk-0.9.0a1/aerospike_sdk/dataset.py +264 -0
  36. aerospike_sdk-0.9.0a1/aerospike_sdk/error_strategy.py +93 -0
  37. aerospike_sdk-0.9.0a1/aerospike_sdk/exceptions.py +375 -0
  38. aerospike_sdk-0.9.0a1/aerospike_sdk/exp.py +159 -0
  39. aerospike_sdk-0.9.0a1/aerospike_sdk/index_monitor.py +220 -0
  40. aerospike_sdk-0.9.0a1/aerospike_sdk/policy/__init__.py +38 -0
  41. aerospike_sdk-0.9.0a1/aerospike_sdk/policy/behavior.py +399 -0
  42. aerospike_sdk-0.9.0a1/aerospike_sdk/policy/behavior_registry.py +51 -0
  43. aerospike_sdk-0.9.0a1/aerospike_sdk/policy/behavior_settings.py +163 -0
  44. aerospike_sdk-0.9.0a1/aerospike_sdk/policy/policy_mapper.py +196 -0
  45. aerospike_sdk-0.9.0a1/aerospike_sdk/policy/system_settings.py +61 -0
  46. aerospike_sdk-0.9.0a1/aerospike_sdk/py.typed +0 -0
  47. aerospike_sdk-0.9.0a1/aerospike_sdk/record_result.py +177 -0
  48. aerospike_sdk-0.9.0a1/aerospike_sdk/record_stream.py +408 -0
  49. aerospike_sdk-0.9.0a1/aerospike_sdk/sync/__init__.py +42 -0
  50. aerospike_sdk-0.9.0a1/aerospike_sdk/sync/background.py +265 -0
  51. aerospike_sdk-0.9.0a1/aerospike_sdk/sync/client.py +895 -0
  52. aerospike_sdk-0.9.0a1/aerospike_sdk/sync/cluster.py +188 -0
  53. aerospike_sdk-0.9.0a1/aerospike_sdk/sync/cluster_definition.py +434 -0
  54. aerospike_sdk-0.9.0a1/aerospike_sdk/sync/info.py +116 -0
  55. aerospike_sdk-0.9.0a1/aerospike_sdk/sync/operations/__init__.py +27 -0
  56. aerospike_sdk-0.9.0a1/aerospike_sdk/sync/operations/batch.py +215 -0
  57. aerospike_sdk-0.9.0a1/aerospike_sdk/sync/operations/index.py +143 -0
  58. aerospike_sdk-0.9.0a1/aerospike_sdk/sync/operations/query.py +2700 -0
  59. aerospike_sdk-0.9.0a1/aerospike_sdk/sync/operations/udf.py +203 -0
  60. aerospike_sdk-0.9.0a1/aerospike_sdk/sync/record_stream.py +106 -0
  61. aerospike_sdk-0.9.0a1/aerospike_sdk/sync/session.py +600 -0
  62. aerospike_sdk-0.9.0a1/aerospike_sdk/sync/tls_builder.py +199 -0
  63. aerospike_sdk-0.9.0a1/aerospike_sdk/sync/transactional_session.py +160 -0
  64. aerospike_sdk-0.9.0a1/aerospike_sdk.egg-info/PKG-INFO +240 -0
  65. aerospike_sdk-0.9.0a1/aerospike_sdk.egg-info/SOURCES.txt +68 -0
  66. aerospike_sdk-0.9.0a1/aerospike_sdk.egg-info/dependency_links.txt +1 -0
  67. aerospike_sdk-0.9.0a1/aerospike_sdk.egg-info/requires.txt +18 -0
  68. aerospike_sdk-0.9.0a1/aerospike_sdk.egg-info/top_level.txt +1 -0
  69. aerospike_sdk-0.9.0a1/pyproject.toml +78 -0
  70. aerospike_sdk-0.9.0a1/setup.cfg +4 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,240 @@
1
+ Metadata-Version: 2.4
2
+ Name: aerospike-sdk
3
+ Version: 0.9.0a1
4
+ Summary: Aerospike Python SDK - a modern, developer-friendly interface for Aerospike
5
+ Classifier: Development Status :: 3 - Alpha
6
+ Classifier: Intended Audience :: Developers
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Programming Language :: Python :: 3.10
9
+ Classifier: Programming Language :: Python :: 3.11
10
+ Classifier: Programming Language :: Python :: 3.12
11
+ Classifier: Programming Language :: Python :: 3.13
12
+ Classifier: Programming Language :: Python :: 3.14
13
+ Requires-Python: <3.15,>=3.10
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: aerospike-async==0.4.0a1
17
+ Requires-Dist: antlr4-python3-runtime>=4.13.0
18
+ Provides-Extra: dev
19
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
20
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
21
+ Requires-Dist: pytest-env>=1.1.0; extra == "dev"
22
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
23
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
24
+ Requires-Dist: antlr4-python3-runtime>=4.13.0; extra == "dev"
25
+ Provides-Extra: docs
26
+ Requires-Dist: sphinx>=8.0; extra == "docs"
27
+ Requires-Dist: furo; extra == "docs"
28
+ Requires-Dist: myst-parser>=4.0; extra == "docs"
29
+ Requires-Dist: sphinx-design; extra == "docs"
30
+ Requires-Dist: sphinx-autodoc-typehints; extra == "docs"
31
+ Requires-Dist: sphinx-autobuild; extra == "docs"
32
+ Dynamic: license-file
33
+
34
+ # Aerospike Python SDK
35
+
36
+ A high-level API on the Aerospike Python Async Client, providing an intuitive and chainable interface for database operations.
37
+
38
+ > **Status:** Public preview (alpha). Not yet production-ready; feedback welcome via GitHub Issues.
39
+
40
+ ## Prerequisites
41
+
42
+ - **Python** 3.10 - 3.14 (recommended: [pyenv](https://github.com/pyenv/pyenv) with a dedicated environment for this repo)
43
+ - **Aerospike server** -- required for integration tests
44
+ - **Rust toolchain** (rustc + cargo) -- only needed if building the Aerospike Python Async Client from source
45
+ - **Java 11+** -- required for the one-time AEL parser build (`make generate-ael`)
46
+
47
+ ## Install the Aerospike Python Async Client
48
+
49
+ This SDK depends on the [Aerospike Python Async Client](https://github.com/aerospike/aerospike-client-python-async),
50
+ published on PyPI as [`aerospike-async`](https://pypi.org/project/aerospike-async/).
51
+ The version is pinned in `pyproject.toml` under `[project] dependencies`. A normal
52
+ `pip install -e ".[dev]"` resolves it from PyPI automatically -- no Rust toolchain
53
+ or git checkout required for ordinary development.
54
+
55
+ ### Local PAC checkout (development against an unreleased PAC tree)
56
+
57
+ To test against a sibling PAC working tree (e.g. for a feature not yet on PyPI),
58
+ install it editable first and pass `--no-deps` to this SDK so pip doesn't try
59
+ to re-resolve PAC from PyPI:
60
+
61
+ ```bash
62
+ pip install -e /path/to/aerospike-client-python-async
63
+ pip install -e ".[dev]" --no-deps
64
+ ```
65
+
66
+ Or use `requirements-local.txt` (gitignored path example).
67
+
68
+ ## Install this package
69
+
70
+ Use the interpreter from your pyenv environment (see `.cursor/rules/guiding-principles.mdc` for the usual env name), then:
71
+
72
+ ```bash
73
+ make generate-ael # one-time: build the ANTLR AEL parser (requires Java 11+)
74
+ pip install -e ".[dev]"
75
+ ```
76
+
77
+ `make generate-ael` only needs to be re-run if `aerospike_sdk/ael/antlr4/Condition.g4` changes.
78
+
79
+ ## Configuration
80
+
81
+ Copy `aerospike.env.example` to `aerospike.env` in the repo root and adjust hosts or ports. `aerospike.env` is not committed.
82
+
83
+ ```bash
84
+ cp aerospike.env.example aerospike.env
85
+ source aerospike.env
86
+ ```
87
+
88
+ Pytest loads `aerospike.env` when present; otherwise `conftest.py` loads `aerospike.env.example` for unset variables only (so CI env vars still win).
89
+
90
+ ## Running Tests
91
+
92
+ ```bash
93
+ make test # all tests
94
+ make test-unit # unit tests only
95
+ make test-int # integration tests only (requires running Aerospike server)
96
+ ```
97
+
98
+ ### macOS File Descriptor Limit
99
+
100
+ On macOS, you may encounter `OSError: [Errno 24] Too many open files` when running the full test suite. The default limit (256) is not enough for the concurrent async connections created during testing.
101
+
102
+ ```bash
103
+ ulimit -n 4096
104
+ ```
105
+
106
+ To make this permanent, add it to your shell profile (`~/.zshrc` or `~/.bash_profile`).
107
+
108
+ ## Documentation
109
+
110
+ API docs are built with [Sphinx](https://www.sphinx-doc.org/) (Furo theme, MyST-Parser for Markdown).
111
+
112
+ ```bash
113
+ pip install -e ".[docs]" # one-time: install Sphinx toolchain
114
+
115
+ make docs # build static HTML to docs/_build/html/
116
+ make docs-serve # live-reloading local preview
117
+ ```
118
+
119
+ Docstrings use Google style with Sphinx cross-references (`:meth:`, `:class:`, etc.).
120
+
121
+ ## Development
122
+
123
+ ```bash
124
+ # Regenerate the ANTLR AEL parser (only needed if Condition.g4 changes)
125
+ make generate-ael
126
+
127
+ # Lint
128
+ ruff check .
129
+ ```
130
+
131
+ ## Usage
132
+
133
+ ```python
134
+ import asyncio
135
+ from aerospike_sdk import Behavior, DataSet, Client
136
+
137
+ async def main():
138
+ async with Client("localhost:3100") as client:
139
+ session = client.create_session(Behavior.DEFAULT)
140
+ users = DataSet.of("test", "users")
141
+
142
+ # High-level key-value operations
143
+ await session.upsert(key=users.id(1)).put({"name": "Alice", "age": 28, "country": "UK"})
144
+ await session.upsert(key=users.id(2)).put({"name": "Bob", "age": 35, "country": "US"})
145
+
146
+ # Query with string AEL -- stream results one at a time (memory-efficient)
147
+ results = await (
148
+ session.query(users)
149
+ .where("$.age > %s and $.country == '%s'", 25, "US")
150
+ .execute()
151
+ )
152
+ async for rec in results:
153
+ print(rec.bins)
154
+
155
+ # execute() returns a lazy async stream
156
+ all_users = await session.query(users).execute()
157
+ # collect() drains the stream into a list
158
+ user_list = await all_users.collect()
159
+
160
+ asyncio.run(main())
161
+ ```
162
+
163
+ ## Versioning
164
+
165
+ PSDK follows [SemVer](https://semver.org/) for releases. Pre-releases use the
166
+ `MAJOR.MINOR.PATCH-{alpha,beta,rc}.N` form (e.g. `0.1.0-alpha.1`). PyPI
167
+ normalizes these on upload to the equivalent PEP 440 spelling (`0.1.0a1`).
168
+
169
+ ### Single source of truth
170
+
171
+ The top-level `VERSION` file is the only place where the version lives:
172
+
173
+ ```
174
+ 0.9.0-alpha.1
175
+ ```
176
+
177
+ `pyproject.toml` reads it dynamically:
178
+
179
+ ```toml
180
+ [project]
181
+ dynamic = ["version"]
182
+
183
+ [tool.setuptools.dynamic]
184
+ version = {file = "VERSION"}
185
+ ```
186
+
187
+ So the wheel and the working tree are guaranteed to match.
188
+
189
+ ### Bumping the version
190
+
191
+ Bumps are manual and happen in PRs against `dev`. Promotion workflows
192
+ (`dev → stage → main`) do not mutate the version.
193
+
194
+ ```bash
195
+ # 1. Edit VERSION:
196
+ # e.g. 0.1.0-alpha.1 → 0.1.0-alpha.2
197
+ echo '0.1.0-alpha.2' > VERSION
198
+
199
+ # 2. Confirm:
200
+ bin/get-version # prints 0.1.0-alpha.2
201
+
202
+ # 3. Open a PR against dev with just this change.
203
+ ```
204
+
205
+ ### Bumping the PAC pin
206
+
207
+ PSDK depends on a published release of the
208
+ [Aerospike Python Async Client](https://github.com/aerospike/aerospike-client-python-async)
209
+ on PyPI as `aerospike-async`. The pin lives in `pyproject.toml` under
210
+ `[project] dependencies`:
211
+
212
+ ```toml
213
+ "aerospike-async==0.4.0a1",
214
+ ```
215
+
216
+ To bump: change the version to the new release on PyPI, then reinstall:
217
+
218
+ ```bash
219
+ pip install --upgrade "aerospike-async==0.4.0aN"
220
+ ```
221
+
222
+ Open the PR against `dev`. PSDK's own `VERSION` does not need to change for
223
+ a PAC pin bump unless the underlying API contract has shifted enough to
224
+ warrant it.
225
+
226
+ ### Reading the version programmatically
227
+
228
+ Anywhere a build script, CI step, or release tool needs the version:
229
+
230
+ ```bash
231
+ bin/get-version # → 0.9.0-alpha.1
232
+ ```
233
+
234
+ The script reads `VERSION` and trims trailing whitespace. No Python or
235
+ setuptools runtime dependency — usable from any shell, container, or CI
236
+ environment.
237
+
238
+ ## License
239
+
240
+ Apache License 2.0. See [LICENSE](LICENSE) for details.
@@ -0,0 +1,207 @@
1
+ # Aerospike Python SDK
2
+
3
+ A high-level API on the Aerospike Python Async Client, providing an intuitive and chainable interface for database operations.
4
+
5
+ > **Status:** Public preview (alpha). Not yet production-ready; feedback welcome via GitHub Issues.
6
+
7
+ ## Prerequisites
8
+
9
+ - **Python** 3.10 - 3.14 (recommended: [pyenv](https://github.com/pyenv/pyenv) with a dedicated environment for this repo)
10
+ - **Aerospike server** -- required for integration tests
11
+ - **Rust toolchain** (rustc + cargo) -- only needed if building the Aerospike Python Async Client from source
12
+ - **Java 11+** -- required for the one-time AEL parser build (`make generate-ael`)
13
+
14
+ ## Install the Aerospike Python Async Client
15
+
16
+ This SDK depends on the [Aerospike Python Async Client](https://github.com/aerospike/aerospike-client-python-async),
17
+ published on PyPI as [`aerospike-async`](https://pypi.org/project/aerospike-async/).
18
+ The version is pinned in `pyproject.toml` under `[project] dependencies`. A normal
19
+ `pip install -e ".[dev]"` resolves it from PyPI automatically -- no Rust toolchain
20
+ or git checkout required for ordinary development.
21
+
22
+ ### Local PAC checkout (development against an unreleased PAC tree)
23
+
24
+ To test against a sibling PAC working tree (e.g. for a feature not yet on PyPI),
25
+ install it editable first and pass `--no-deps` to this SDK so pip doesn't try
26
+ to re-resolve PAC from PyPI:
27
+
28
+ ```bash
29
+ pip install -e /path/to/aerospike-client-python-async
30
+ pip install -e ".[dev]" --no-deps
31
+ ```
32
+
33
+ Or use `requirements-local.txt` (gitignored path example).
34
+
35
+ ## Install this package
36
+
37
+ Use the interpreter from your pyenv environment (see `.cursor/rules/guiding-principles.mdc` for the usual env name), then:
38
+
39
+ ```bash
40
+ make generate-ael # one-time: build the ANTLR AEL parser (requires Java 11+)
41
+ pip install -e ".[dev]"
42
+ ```
43
+
44
+ `make generate-ael` only needs to be re-run if `aerospike_sdk/ael/antlr4/Condition.g4` changes.
45
+
46
+ ## Configuration
47
+
48
+ Copy `aerospike.env.example` to `aerospike.env` in the repo root and adjust hosts or ports. `aerospike.env` is not committed.
49
+
50
+ ```bash
51
+ cp aerospike.env.example aerospike.env
52
+ source aerospike.env
53
+ ```
54
+
55
+ Pytest loads `aerospike.env` when present; otherwise `conftest.py` loads `aerospike.env.example` for unset variables only (so CI env vars still win).
56
+
57
+ ## Running Tests
58
+
59
+ ```bash
60
+ make test # all tests
61
+ make test-unit # unit tests only
62
+ make test-int # integration tests only (requires running Aerospike server)
63
+ ```
64
+
65
+ ### macOS File Descriptor Limit
66
+
67
+ On macOS, you may encounter `OSError: [Errno 24] Too many open files` when running the full test suite. The default limit (256) is not enough for the concurrent async connections created during testing.
68
+
69
+ ```bash
70
+ ulimit -n 4096
71
+ ```
72
+
73
+ To make this permanent, add it to your shell profile (`~/.zshrc` or `~/.bash_profile`).
74
+
75
+ ## Documentation
76
+
77
+ API docs are built with [Sphinx](https://www.sphinx-doc.org/) (Furo theme, MyST-Parser for Markdown).
78
+
79
+ ```bash
80
+ pip install -e ".[docs]" # one-time: install Sphinx toolchain
81
+
82
+ make docs # build static HTML to docs/_build/html/
83
+ make docs-serve # live-reloading local preview
84
+ ```
85
+
86
+ Docstrings use Google style with Sphinx cross-references (`:meth:`, `:class:`, etc.).
87
+
88
+ ## Development
89
+
90
+ ```bash
91
+ # Regenerate the ANTLR AEL parser (only needed if Condition.g4 changes)
92
+ make generate-ael
93
+
94
+ # Lint
95
+ ruff check .
96
+ ```
97
+
98
+ ## Usage
99
+
100
+ ```python
101
+ import asyncio
102
+ from aerospike_sdk import Behavior, DataSet, Client
103
+
104
+ async def main():
105
+ async with Client("localhost:3100") as client:
106
+ session = client.create_session(Behavior.DEFAULT)
107
+ users = DataSet.of("test", "users")
108
+
109
+ # High-level key-value operations
110
+ await session.upsert(key=users.id(1)).put({"name": "Alice", "age": 28, "country": "UK"})
111
+ await session.upsert(key=users.id(2)).put({"name": "Bob", "age": 35, "country": "US"})
112
+
113
+ # Query with string AEL -- stream results one at a time (memory-efficient)
114
+ results = await (
115
+ session.query(users)
116
+ .where("$.age > %s and $.country == '%s'", 25, "US")
117
+ .execute()
118
+ )
119
+ async for rec in results:
120
+ print(rec.bins)
121
+
122
+ # execute() returns a lazy async stream
123
+ all_users = await session.query(users).execute()
124
+ # collect() drains the stream into a list
125
+ user_list = await all_users.collect()
126
+
127
+ asyncio.run(main())
128
+ ```
129
+
130
+ ## Versioning
131
+
132
+ PSDK follows [SemVer](https://semver.org/) for releases. Pre-releases use the
133
+ `MAJOR.MINOR.PATCH-{alpha,beta,rc}.N` form (e.g. `0.1.0-alpha.1`). PyPI
134
+ normalizes these on upload to the equivalent PEP 440 spelling (`0.1.0a1`).
135
+
136
+ ### Single source of truth
137
+
138
+ The top-level `VERSION` file is the only place where the version lives:
139
+
140
+ ```
141
+ 0.9.0-alpha.1
142
+ ```
143
+
144
+ `pyproject.toml` reads it dynamically:
145
+
146
+ ```toml
147
+ [project]
148
+ dynamic = ["version"]
149
+
150
+ [tool.setuptools.dynamic]
151
+ version = {file = "VERSION"}
152
+ ```
153
+
154
+ So the wheel and the working tree are guaranteed to match.
155
+
156
+ ### Bumping the version
157
+
158
+ Bumps are manual and happen in PRs against `dev`. Promotion workflows
159
+ (`dev → stage → main`) do not mutate the version.
160
+
161
+ ```bash
162
+ # 1. Edit VERSION:
163
+ # e.g. 0.1.0-alpha.1 → 0.1.0-alpha.2
164
+ echo '0.1.0-alpha.2' > VERSION
165
+
166
+ # 2. Confirm:
167
+ bin/get-version # prints 0.1.0-alpha.2
168
+
169
+ # 3. Open a PR against dev with just this change.
170
+ ```
171
+
172
+ ### Bumping the PAC pin
173
+
174
+ PSDK depends on a published release of the
175
+ [Aerospike Python Async Client](https://github.com/aerospike/aerospike-client-python-async)
176
+ on PyPI as `aerospike-async`. The pin lives in `pyproject.toml` under
177
+ `[project] dependencies`:
178
+
179
+ ```toml
180
+ "aerospike-async==0.4.0a1",
181
+ ```
182
+
183
+ To bump: change the version to the new release on PyPI, then reinstall:
184
+
185
+ ```bash
186
+ pip install --upgrade "aerospike-async==0.4.0aN"
187
+ ```
188
+
189
+ Open the PR against `dev`. PSDK's own `VERSION` does not need to change for
190
+ a PAC pin bump unless the underlying API contract has shifted enough to
191
+ warrant it.
192
+
193
+ ### Reading the version programmatically
194
+
195
+ Anywhere a build script, CI step, or release tool needs the version:
196
+
197
+ ```bash
198
+ bin/get-version # → 0.9.0-alpha.1
199
+ ```
200
+
201
+ The script reads `VERSION` and trims trailing whitespace. No Python or
202
+ setuptools runtime dependency — usable from any shell, container, or CI
203
+ environment.
204
+
205
+ ## License
206
+
207
+ Apache License 2.0. See [LICENSE](LICENSE) for details.
@@ -0,0 +1 @@
1
+ 0.9.0-alpha.1