cypher-dsl 0.1.0a2__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 (143) hide show
  1. cypher_dsl-0.1.0a2/CHANGELOG.md +8 -0
  2. cypher_dsl-0.1.0a2/LICENSE +202 -0
  3. cypher_dsl-0.1.0a2/Makefile +39 -0
  4. cypher_dsl-0.1.0a2/NOTICE +60 -0
  5. cypher_dsl-0.1.0a2/PKG-INFO +168 -0
  6. cypher_dsl-0.1.0a2/README.md +152 -0
  7. cypher_dsl-0.1.0a2/docs/_static/docs.css +8 -0
  8. cypher_dsl-0.1.0a2/docs/adr/0001-record-architecture-decisions.md +44 -0
  9. cypher_dsl-0.1.0a2/docs/adr/0002-port-vocabulary-not-java-api.md +57 -0
  10. cypher_dsl-0.1.0a2/docs/adr/0003-select-target-by-declared-server-release.md +70 -0
  11. cypher_dsl-0.1.0a2/docs/adr/0004-reuse-syntax-through-visitors.md +70 -0
  12. cypher_dsl-0.1.0a2/docs/adr/0005-inline-literals-and-explicit-parameters.md +98 -0
  13. cypher_dsl-0.1.0a2/docs/adr/0006-keep-runtime-independent-of-drivers.md +45 -0
  14. cypher_dsl-0.1.0a2/docs/adr/0007-support-upstream-maintained-python.md +26 -0
  15. cypher_dsl-0.1.0a2/docs/adr/0008-carry-scope-in-frames-and-registered-rules.md +88 -0
  16. cypher_dsl-0.1.0a2/docs/adr/index.md +18 -0
  17. cypher_dsl-0.1.0a2/docs/adr/template.md +24 -0
  18. cypher_dsl-0.1.0a2/docs/api.rst +22 -0
  19. cypher_dsl-0.1.0a2/docs/composing.rst +156 -0
  20. cypher_dsl-0.1.0a2/docs/conf.py +319 -0
  21. cypher_dsl-0.1.0a2/docs/contributor/architecture.md +162 -0
  22. cypher_dsl-0.1.0a2/docs/contributor/index.md +11 -0
  23. cypher_dsl-0.1.0a2/docs/contributor/testing.md +82 -0
  24. cypher_dsl-0.1.0a2/docs/errors.rst +79 -0
  25. cypher_dsl-0.1.0a2/docs/getting-started.rst +335 -0
  26. cypher_dsl-0.1.0a2/docs/index.rst +48 -0
  27. cypher_dsl-0.1.0a2/docs/llms.txt +24 -0
  28. cypher_dsl-0.1.0a2/docs/parameters.rst +276 -0
  29. cypher_dsl-0.1.0a2/docs/patterns.rst +230 -0
  30. cypher_dsl-0.1.0a2/docs/reading.rst +429 -0
  31. cypher_dsl-0.1.0a2/docs/running.rst +204 -0
  32. cypher_dsl-0.1.0a2/docs/subqueries.rst +212 -0
  33. cypher_dsl-0.1.0a2/docs/targets.rst +173 -0
  34. cypher_dsl-0.1.0a2/docs/writing.rst +267 -0
  35. cypher_dsl-0.1.0a2/noxfile.py +132 -0
  36. cypher_dsl-0.1.0a2/pyproject.toml +93 -0
  37. cypher_dsl-0.1.0a2/pyproject.toml.orig +52 -0
  38. cypher_dsl-0.1.0a2/src/cypher_dsl/__init__.py +180 -0
  39. cypher_dsl-0.1.0a2/src/cypher_dsl/api.py +45 -0
  40. cypher_dsl-0.1.0a2/src/cypher_dsl/ast.py +113 -0
  41. cypher_dsl-0.1.0a2/src/cypher_dsl/clauses/__init__.py +1 -0
  42. cypher_dsl-0.1.0a2/src/cypher_dsl/clauses/base.py +23 -0
  43. cypher_dsl-0.1.0a2/src/cypher_dsl/clauses/call.py +217 -0
  44. cypher_dsl-0.1.0a2/src/cypher_dsl/clauses/match.py +137 -0
  45. cypher_dsl-0.1.0a2/src/cypher_dsl/clauses/projection.py +226 -0
  46. cypher_dsl-0.1.0a2/src/cypher_dsl/clauses/unwind.py +87 -0
  47. cypher_dsl-0.1.0a2/src/cypher_dsl/clauses/write.py +571 -0
  48. cypher_dsl-0.1.0a2/src/cypher_dsl/errors.py +35 -0
  49. cypher_dsl-0.1.0a2/src/cypher_dsl/expressions/__init__.py +1 -0
  50. cypher_dsl-0.1.0a2/src/cypher_dsl/expressions/base.py +339 -0
  51. cypher_dsl-0.1.0a2/src/cypher_dsl/expressions/collections.py +162 -0
  52. cypher_dsl-0.1.0a2/src/cypher_dsl/expressions/functions.py +190 -0
  53. cypher_dsl-0.1.0a2/src/cypher_dsl/expressions/operators.py +337 -0
  54. cypher_dsl-0.1.0a2/src/cypher_dsl/expressions/properties.py +63 -0
  55. cypher_dsl-0.1.0a2/src/cypher_dsl/expressions/values.py +445 -0
  56. cypher_dsl-0.1.0a2/src/cypher_dsl/features.py +27 -0
  57. cypher_dsl-0.1.0a2/src/cypher_dsl/patterns/__init__.py +1 -0
  58. cypher_dsl-0.1.0a2/src/cypher_dsl/patterns/nodes.py +377 -0
  59. cypher_dsl-0.1.0a2/src/cypher_dsl/patterns/relationships.py +309 -0
  60. cypher_dsl-0.1.0a2/src/cypher_dsl/py.typed +0 -0
  61. cypher_dsl-0.1.0a2/src/cypher_dsl/registry.py +39 -0
  62. cypher_dsl-0.1.0a2/src/cypher_dsl/render/__init__.py +1 -0
  63. cypher_dsl-0.1.0a2/src/cypher_dsl/render/bindings.py +71 -0
  64. cypher_dsl-0.1.0a2/src/cypher_dsl/render/calls.py +36 -0
  65. cypher_dsl-0.1.0a2/src/cypher_dsl/render/capabilities.py +189 -0
  66. cypher_dsl-0.1.0a2/src/cypher_dsl/render/configuration.py +68 -0
  67. cypher_dsl-0.1.0a2/src/cypher_dsl/render/context.py +20 -0
  68. cypher_dsl-0.1.0a2/src/cypher_dsl/render/expressions.py +176 -0
  69. cypher_dsl-0.1.0a2/src/cypher_dsl/render/filters.py +21 -0
  70. cypher_dsl-0.1.0a2/src/cypher_dsl/render/fragments.py +18 -0
  71. cypher_dsl-0.1.0a2/src/cypher_dsl/render/layout.py +68 -0
  72. cypher_dsl-0.1.0a2/src/cypher_dsl/render/literals.py +285 -0
  73. cypher_dsl-0.1.0a2/src/cypher_dsl/render/patterns.py +75 -0
  74. cypher_dsl-0.1.0a2/src/cypher_dsl/render/pretty.py +247 -0
  75. cypher_dsl-0.1.0a2/src/cypher_dsl/render/projections.py +54 -0
  76. cypher_dsl-0.1.0a2/src/cypher_dsl/render/renderer.py +131 -0
  77. cypher_dsl-0.1.0a2/src/cypher_dsl/render/rules.py +84 -0
  78. cypher_dsl-0.1.0a2/src/cypher_dsl/render/statements.py +67 -0
  79. cypher_dsl-0.1.0a2/src/cypher_dsl/render/targets.py +94 -0
  80. cypher_dsl-0.1.0a2/src/cypher_dsl/render/traversal.py +100 -0
  81. cypher_dsl-0.1.0a2/src/cypher_dsl/render/unwind.py +23 -0
  82. cypher_dsl-0.1.0a2/src/cypher_dsl/render/updates.py +80 -0
  83. cypher_dsl-0.1.0a2/src/cypher_dsl/statements/__init__.py +1 -0
  84. cypher_dsl-0.1.0a2/src/cypher_dsl/statements/analysis.py +155 -0
  85. cypher_dsl-0.1.0a2/src/cypher_dsl/statements/builder.py +695 -0
  86. cypher_dsl-0.1.0a2/src/cypher_dsl/statements/composition.py +123 -0
  87. cypher_dsl-0.1.0a2/src/cypher_dsl/statements/frames.py +161 -0
  88. cypher_dsl-0.1.0a2/src/cypher_dsl/statements/rules/__init__.py +68 -0
  89. cypher_dsl-0.1.0a2/src/cypher_dsl/statements/rules/base.py +199 -0
  90. cypher_dsl-0.1.0a2/src/cypher_dsl/statements/rules/call.py +144 -0
  91. cypher_dsl-0.1.0a2/src/cypher_dsl/statements/rules/flow.py +115 -0
  92. cypher_dsl-0.1.0a2/src/cypher_dsl/statements/rules/match.py +64 -0
  93. cypher_dsl-0.1.0a2/src/cypher_dsl/statements/rules/patterns.py +58 -0
  94. cypher_dsl-0.1.0a2/src/cypher_dsl/statements/rules/projection.py +280 -0
  95. cypher_dsl-0.1.0a2/src/cypher_dsl/statements/rules/writes.py +249 -0
  96. cypher_dsl-0.1.0a2/src/cypher_dsl/statements/validation.py +125 -0
  97. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_analysis.py +198 -0
  98. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_ast.py +146 -0
  99. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_bulk.py +236 -0
  100. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_calls.py +901 -0
  101. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_capability_floors.py +124 -0
  102. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_clause_order_parity.py +58 -0
  103. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_collections.py +196 -0
  104. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_composition.py +227 -0
  105. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_construct_renderers.py +348 -0
  106. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_constructor_ownership.py +104 -0
  107. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_consumer_shapes.py +227 -0
  108. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_features.py +23 -0
  109. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_frames.py +87 -0
  110. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_functions.py +214 -0
  111. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_instance_layout.py +84 -0
  112. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_layout.py +25 -0
  113. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_match.py +169 -0
  114. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_merge_actions.py +180 -0
  115. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_operators.py +248 -0
  116. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_parameters.py +178 -0
  117. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_patterns.py +307 -0
  118. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_pretty.py +303 -0
  119. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_pretty_layout.py +76 -0
  120. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_projection.py +625 -0
  121. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_public_surface.py +258 -0
  122. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_registry.py +42 -0
  123. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_render_rules.py +59 -0
  124. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_render_traversal.py +101 -0
  125. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_renderer_pipeline.py +100 -0
  126. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_rendering.py +541 -0
  127. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_semantic_rules.py +670 -0
  128. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_statement_scope.py +36 -0
  129. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_statement_validation.py +252 -0
  130. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_target_selection.py +203 -0
  131. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_targets.py +94 -0
  132. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_type_aliases.py +33 -0
  133. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_values.py +216 -0
  134. cypher_dsl-0.1.0a2/tests/cypher_dsl/test_writes.py +527 -0
  135. cypher_dsl-0.1.0a2/tests/smoke/check_install.py +74 -0
  136. cypher_dsl-0.1.0a2/tests/typing/nominal_contracts.py +52 -0
  137. cypher_dsl-0.1.0a2/tests/typing/public_api.py +153 -0
  138. cypher_dsl-0.1.0a2/tests/typing/rendering_rules.py +31 -0
  139. cypher_dsl-0.1.0a2/tools/__init__.py +6 -0
  140. cypher_dsl-0.1.0a2/tools/check_cypher.py +126 -0
  141. cypher_dsl-0.1.0a2/tools/ci_sessions.py +207 -0
  142. cypher_dsl-0.1.0a2/tools/record_cypher.py +63 -0
  143. cypher_dsl-0.1.0a2/uv.lock +1342 -0
@@ -0,0 +1,8 @@
1
+ # Changelog
2
+
3
+ ## [0.1.0a1]
4
+ - first release
5
+
6
+ ## [0.1.0a2]
7
+ - added `CALL { … }` subqueries through `call()` and `optional_call()`
8
+ - pretty printing
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,39 @@
1
+ .DEFAULT_GOAL := help
2
+
3
+ .PHONY: help deps test test-cov lint format format-check typing docs package cypher-audit matrix
4
+
5
+ help: ## Show the available targets.
6
+ @awk 'BEGIN {FS = ":.*## "; printf "Targets:\n"} /^[a-z-]+:.*## / {printf " %-14s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
7
+
8
+ deps: ## Install the locked development and test groups.
9
+ uv sync --group dev --group test
10
+
11
+ test: ## Run the unit suite on the current interpreter.
12
+ uv run --group test pytest
13
+
14
+ test-cov: ## Run the unit suite on the current interpreter and report coverage.
15
+ uv run --group test pytest --cov=cypher_dsl --cov-report=term-missing
16
+
17
+ lint: ## Check the source with Ruff.
18
+ uv run ruff check .
19
+
20
+ format: ## Format the source with Ruff.
21
+ uv run ruff format .
22
+
23
+ format-check: ## Check formatting without writing.
24
+ uv run ruff format --check .
25
+
26
+ typing: ## Run mypy in strict mode.
27
+ uv run mypy
28
+
29
+ docs: ## Build the documentation without network access.
30
+ uv run nox -s docs
31
+
32
+ package: ## Build an sdist and wheel, then smoke the installed wheel.
33
+ uv run nox -s package
34
+
35
+ cypher-audit: ## Check rendered statements against a running server (NEO4J_PASSWORD required).
36
+ uv run --group audit python -m tools.check_cypher
37
+
38
+ matrix: ## Run every unique Nox job once through the aggregate session.
39
+ uv run nox -s matrix
@@ -0,0 +1,60 @@
1
+ cypher-dsl-python
2
+
3
+ An independent implementation of a Cypher query DSL in Python. It is not an official Neo4j
4
+ product. No endorsement, governance, ownership or release process has been agreed with
5
+ Neo4j, Inc.
6
+
7
+ Derived material
8
+
9
+ The AST vocabulary, the dialect names, the rendering and escaping rules and many test
10
+ scenarios derive from the Java project Neo4j Cypher-DSL,
11
+ https://github.com/neo4j/cypher-dsl, which is distributed under the Apache License,
12
+ Version 2.0.
13
+
14
+ Copyright (c) 2019-2026 "Neo4j,"
15
+ Neo4j Sweden AB [https://neo4j.com]
16
+
17
+ Licensed under the Apache License, Version 2.0. The full text is in LICENSE.
18
+
19
+ Credit for the original implementation and the original test suite belongs to that
20
+ project and its contributors.
21
+
22
+ The correspondence was traced against neo4j/cypher-dsl at commit d3b17e42, one commit
23
+ after release 2025.3.6. Only that state was traced; material added upstream after it is
24
+ not claimed.
25
+
26
+ Where the code corresponds
27
+
28
+ src/cypher_dsl/render/ rendering order, dialect names, escaping, literals
29
+ src/cypher_dsl/clauses/ clause order and clause-local placement
30
+ src/cypher_dsl/expressions/ function names, operators and predicates
31
+ src/cypher_dsl/patterns/ pattern identity, direction and chains
32
+ src/cypher_dsl/statements.py finalisation, unions and decorations
33
+
34
+ Modules that exist only for this implementation include the error types,
35
+ render/bindings.py, render/capabilities.py and the comparison and traversal helpers in
36
+ ast.py.
37
+
38
+ Ported tests
39
+
40
+ Many test scenarios and their expected Cypher come from the upstream test suite. Where a
41
+ Python test module was traced to a specific upstream test file, the module names that file
42
+ in a comment at the top. Modules without that comment hold contracts for this
43
+ implementation, and their derivation was not traced.
44
+
45
+ Changes to the derived material
46
+
47
+ - Java source and tests are translated to Python. The public surface is built from
48
+ factory functions, Python operators and keyword arguments, as recorded in
49
+ docs/adr/0002-port-vocabulary-not-java-api.md.
50
+ - Tests are rewritten for pytest. JUnit, AssertJ and generated model support are not
51
+ carried over.
52
+ - Rendering that intentionally differs is stated beside the expectation that pins it,
53
+ rather than left implicit.
54
+
55
+ Licensing
56
+
57
+ The distribution as a whole is released under the Apache License, Version 2.0. See
58
+ LICENSE. Derived material stays under the upstream Apache-2.0 terms, and the copyright
59
+ notice above applies to it. Apache-2.0 grants no rights in the Neo4j or Cypher
60
+ trademarks.
@@ -0,0 +1,168 @@
1
+ Metadata-Version: 2.4
2
+ Name: cypher-dsl
3
+ Version: 0.1.0a2
4
+ Summary: CPython DSl to constuct Cypher queries.
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ License-File: NOTICE
8
+ Classifier: Programming Language :: Python :: 3.11
9
+ Classifier: Programming Language :: Python :: 3.12
10
+ Classifier: Programming Language :: Python :: 3.13
11
+ Classifier: Programming Language :: Python :: 3.14
12
+ Classifier: Programming Language :: Python :: 3.15
13
+ Classifier: Typing :: Typed
14
+ Requires-Python: >=3.11
15
+ Description-Content-Type: text/markdown
16
+
17
+ # cypher-dsl-python
18
+
19
+ Build Cypher queries as Python syntax objects and render them to text plus parameters. The
20
+ AST vocabulary and rendering behaviour follow the Java Neo4j
21
+ [Cypher-DSL](https://github.com/neo4j/cypher-dsl). This is not an official Neo4j product.
22
+
23
+ The library covers a read and write subset of Cypher 5. It has no runtime dependencies,
24
+ ships `py.typed` and never opens a connection. Drivers, transactions and schema
25
+ installation belong to the application or its test harness.
26
+
27
+ ## Documentation
28
+
29
+ The user guide and API reference are published at
30
+ https://neo-technology-field.github.io/cypher-dsl-python/.
31
+
32
+ ## Install
33
+
34
+ ```sh
35
+ pip install cypher-dsl
36
+ ```
37
+
38
+ In a uv project, use `uv add cypher-dsl`. Python 3.11 to 3.15 are supported.
39
+
40
+ ## Build and render a statement
41
+
42
+ ```python
43
+ from cypher_dsl import Configuration, Renderer, match, node, param
44
+
45
+ movie = node("Movie", name="m")
46
+ statement = match(movie).where(movie["released"] < param("year", 2000)).returning(movie["title"])
47
+ rendered = Renderer.get(Configuration(server_version="5.26")).render(statement)
48
+
49
+ print(rendered.cypher)
50
+ print(rendered.parameters)
51
+ ```
52
+
53
+ ```text
54
+ MATCH (m:Movie) WHERE m.released < $year RETURN m.title
55
+ {'year': 2000}
56
+ ```
57
+
58
+ The statement is frozen, and a bound parameter occurrence is part of the tree. It carries
59
+ no separate mutable binding bag, and every render returns fresh parameter containers. To
60
+ reuse one template with different request values, leave the parameter unbound and supply
61
+ the value in your execution layer.
62
+
63
+ ## Bind a value or leave the parameter open
64
+
65
+ `param(name)` is unbound and `param(name, value)` is bound. Rendering reports what the
66
+ caller still has to supply instead of inventing a value:
67
+
68
+ ```python
69
+ from cypher_dsl import Configuration, Renderer, match, node, param
70
+
71
+ person = node("Person", name="p")
72
+ statement = match(person).where(person["email"] == param("email")).returning(person["display_name"])
73
+ rendered = Renderer.get(Configuration(server_version="5.26")).render(statement)
74
+
75
+ print(rendered.cypher)
76
+ print(rendered.parameters)
77
+ print(sorted(rendered.unbound_parameters))
78
+ ```
79
+
80
+ ```text
81
+ MATCH (p:Person) WHERE p.email = $email RETURN p.display_name
82
+ {}
83
+ ['email']
84
+ ```
85
+
86
+ A bare string in a projection is a variable name, so a string value needs `lit()`.
87
+ Literals are snapshotted at construction, and inline `bytes` is rejected in favour of a
88
+ bound parameter.
89
+
90
+ ## Choose a target
91
+
92
+ - `server_version` is required. Declare the Neo4j release the rendered text will run on, such as
93
+ `Configuration(server_version="5.26")`. Neo4j 5.26 LTS is the minimum. Earlier 5.x releases
94
+ and 4.x are unsupported.
95
+ - `Language.AUTO` is the default. It selects a language per statement from the syntax requirements,
96
+ not the newest language the server offers. Statements without a language floor remain unprefixed.
97
+ - Pin `Language.CYPHER_5` or `Language.CYPHER_25` when the text must always name its language.
98
+ A `CYPHER 25` pin requires Neo4j 2025.06. Every supported release accepts the `CYPHER 5`
99
+ prefix. Pinning also rejects syntax that requires a different language.
100
+ - `Language.NONE` suppresses the prefix but still checks the declared release. The database's
101
+ default language then decides the grammar. A compatible release does not guarantee that its
102
+ configured default can parse the query text.
103
+
104
+ ```python
105
+ from cypher_dsl import Configuration, Language
106
+
107
+ automatic = Configuration(server_version="2026.10")
108
+ cypher_5 = Configuration(server_version="2026.10", language=Language.CYPHER_5)
109
+ cypher_25 = Configuration(server_version="2026.10", language=Language.CYPHER_25)
110
+ database_default = Configuration(server_version="2026.10", language=Language.NONE)
111
+ ```
112
+
113
+ The library never probes a server. The declared release is the single source of truth for capability checks.
114
+ See [Choose a target](docs/targets.rst) for the floor table and sources.
115
+ The `pretty_print` option renders multi-line text for reading; the default renders one line.
116
+
117
+ ## What is not available
118
+
119
+ - No OGM, driver connection, transaction or schema installation.
120
+ - No `CALL` procedures (`CALL db.labels()`, `YIELD`), `SEARCH`, path selectors, quantified
121
+ path patterns or catalogue analysis.
122
+ - No Cypher parser. The input is Python construction, not query text.
123
+ - No automatic parameter binding.
124
+ - No inline bytes literal.
125
+ - No complete semantic validator. Clause order, known references and bindings are checked.
126
+ Server-side semantics are not.
127
+
128
+ ## Where this comes from
129
+
130
+ The vocabulary is not mine. The general architecture, AST names, the rendering and escaping
131
+ rules and many of the test scenarios come from the Java
132
+ [Cypher-DSL](https://github.com/neo4j/cypher-dsl), which is Apache-2.0. Thanks to the
133
+ authors and contributors of that project.
134
+
135
+ The correspondence was traced against the upstream repository at commit `d3b17e42`, one
136
+ commit after the 2025.3.6 release. `NOTICE` lists what was taken from where, and a test
137
+ module that ports scenarios names the upstream test file at the top of the module.
138
+
139
+ This is an independent project. It is not an official Neo4j product, and nothing here is
140
+ endorsed or governed by Neo4j, Inc.
141
+
142
+ ## Work on the package
143
+
144
+ The user documentation is the Sphinx site under `docs/`. Contributor documentation is
145
+ repository-only Markdown and is not part of the published site:
146
+
147
+ - [Architecture](docs/contributor/architecture.md): rendering stages, occurrence analysis, shared rules and target checks.
148
+ - [Testing the package](docs/contributor/testing.md): what the unit suite guarantees, and the optional server audit of the rendered corpus.
149
+ - [Architecture decisions](docs/adr/index.md): the accepted, superseded and rejected records.
150
+
151
+ ```sh
152
+ make deps # uv sync --group dev --group test
153
+ make test # uv run --group test pytest
154
+ make matrix # every session once on every supported interpreter
155
+ make lint
156
+ make format-check
157
+ make typing
158
+ make docs # Sphinx build
159
+ make package # Nox package session: sdist, wheel, installed smoke test
160
+ ```
161
+
162
+ `make help` lists the targets. Unit tests assert rendered text and parameters offline and
163
+ need no database. `make cypher-audit` checks a corpus of rendered statements against a
164
+ running server when you change a rendering rule.
165
+
166
+ ## Licence
167
+
168
+ Apache-2.0. See `LICENSE` and `NOTICE`.
@@ -0,0 +1,152 @@
1
+ # cypher-dsl-python
2
+
3
+ Build Cypher queries as Python syntax objects and render them to text plus parameters. The
4
+ AST vocabulary and rendering behaviour follow the Java Neo4j
5
+ [Cypher-DSL](https://github.com/neo4j/cypher-dsl). This is not an official Neo4j product.
6
+
7
+ The library covers a read and write subset of Cypher 5. It has no runtime dependencies,
8
+ ships `py.typed` and never opens a connection. Drivers, transactions and schema
9
+ installation belong to the application or its test harness.
10
+
11
+ ## Documentation
12
+
13
+ The user guide and API reference are published at
14
+ https://neo-technology-field.github.io/cypher-dsl-python/.
15
+
16
+ ## Install
17
+
18
+ ```sh
19
+ pip install cypher-dsl
20
+ ```
21
+
22
+ In a uv project, use `uv add cypher-dsl`. Python 3.11 to 3.15 are supported.
23
+
24
+ ## Build and render a statement
25
+
26
+ ```python
27
+ from cypher_dsl import Configuration, Renderer, match, node, param
28
+
29
+ movie = node("Movie", name="m")
30
+ statement = match(movie).where(movie["released"] < param("year", 2000)).returning(movie["title"])
31
+ rendered = Renderer.get(Configuration(server_version="5.26")).render(statement)
32
+
33
+ print(rendered.cypher)
34
+ print(rendered.parameters)
35
+ ```
36
+
37
+ ```text
38
+ MATCH (m:Movie) WHERE m.released < $year RETURN m.title
39
+ {'year': 2000}
40
+ ```
41
+
42
+ The statement is frozen, and a bound parameter occurrence is part of the tree. It carries
43
+ no separate mutable binding bag, and every render returns fresh parameter containers. To
44
+ reuse one template with different request values, leave the parameter unbound and supply
45
+ the value in your execution layer.
46
+
47
+ ## Bind a value or leave the parameter open
48
+
49
+ `param(name)` is unbound and `param(name, value)` is bound. Rendering reports what the
50
+ caller still has to supply instead of inventing a value:
51
+
52
+ ```python
53
+ from cypher_dsl import Configuration, Renderer, match, node, param
54
+
55
+ person = node("Person", name="p")
56
+ statement = match(person).where(person["email"] == param("email")).returning(person["display_name"])
57
+ rendered = Renderer.get(Configuration(server_version="5.26")).render(statement)
58
+
59
+ print(rendered.cypher)
60
+ print(rendered.parameters)
61
+ print(sorted(rendered.unbound_parameters))
62
+ ```
63
+
64
+ ```text
65
+ MATCH (p:Person) WHERE p.email = $email RETURN p.display_name
66
+ {}
67
+ ['email']
68
+ ```
69
+
70
+ A bare string in a projection is a variable name, so a string value needs `lit()`.
71
+ Literals are snapshotted at construction, and inline `bytes` is rejected in favour of a
72
+ bound parameter.
73
+
74
+ ## Choose a target
75
+
76
+ - `server_version` is required. Declare the Neo4j release the rendered text will run on, such as
77
+ `Configuration(server_version="5.26")`. Neo4j 5.26 LTS is the minimum. Earlier 5.x releases
78
+ and 4.x are unsupported.
79
+ - `Language.AUTO` is the default. It selects a language per statement from the syntax requirements,
80
+ not the newest language the server offers. Statements without a language floor remain unprefixed.
81
+ - Pin `Language.CYPHER_5` or `Language.CYPHER_25` when the text must always name its language.
82
+ A `CYPHER 25` pin requires Neo4j 2025.06. Every supported release accepts the `CYPHER 5`
83
+ prefix. Pinning also rejects syntax that requires a different language.
84
+ - `Language.NONE` suppresses the prefix but still checks the declared release. The database's
85
+ default language then decides the grammar. A compatible release does not guarantee that its
86
+ configured default can parse the query text.
87
+
88
+ ```python
89
+ from cypher_dsl import Configuration, Language
90
+
91
+ automatic = Configuration(server_version="2026.10")
92
+ cypher_5 = Configuration(server_version="2026.10", language=Language.CYPHER_5)
93
+ cypher_25 = Configuration(server_version="2026.10", language=Language.CYPHER_25)
94
+ database_default = Configuration(server_version="2026.10", language=Language.NONE)
95
+ ```
96
+
97
+ The library never probes a server. The declared release is the single source of truth for capability checks.
98
+ See [Choose a target](docs/targets.rst) for the floor table and sources.
99
+ The `pretty_print` option renders multi-line text for reading; the default renders one line.
100
+
101
+ ## What is not available
102
+
103
+ - No OGM, driver connection, transaction or schema installation.
104
+ - No `CALL` procedures (`CALL db.labels()`, `YIELD`), `SEARCH`, path selectors, quantified
105
+ path patterns or catalogue analysis.
106
+ - No Cypher parser. The input is Python construction, not query text.
107
+ - No automatic parameter binding.
108
+ - No inline bytes literal.
109
+ - No complete semantic validator. Clause order, known references and bindings are checked.
110
+ Server-side semantics are not.
111
+
112
+ ## Where this comes from
113
+
114
+ The vocabulary is not mine. The general architecture, AST names, the rendering and escaping
115
+ rules and many of the test scenarios come from the Java
116
+ [Cypher-DSL](https://github.com/neo4j/cypher-dsl), which is Apache-2.0. Thanks to the
117
+ authors and contributors of that project.
118
+
119
+ The correspondence was traced against the upstream repository at commit `d3b17e42`, one
120
+ commit after the 2025.3.6 release. `NOTICE` lists what was taken from where, and a test
121
+ module that ports scenarios names the upstream test file at the top of the module.
122
+
123
+ This is an independent project. It is not an official Neo4j product, and nothing here is
124
+ endorsed or governed by Neo4j, Inc.
125
+
126
+ ## Work on the package
127
+
128
+ The user documentation is the Sphinx site under `docs/`. Contributor documentation is
129
+ repository-only Markdown and is not part of the published site:
130
+
131
+ - [Architecture](docs/contributor/architecture.md): rendering stages, occurrence analysis, shared rules and target checks.
132
+ - [Testing the package](docs/contributor/testing.md): what the unit suite guarantees, and the optional server audit of the rendered corpus.
133
+ - [Architecture decisions](docs/adr/index.md): the accepted, superseded and rejected records.
134
+
135
+ ```sh
136
+ make deps # uv sync --group dev --group test
137
+ make test # uv run --group test pytest
138
+ make matrix # every session once on every supported interpreter
139
+ make lint
140
+ make format-check
141
+ make typing
142
+ make docs # Sphinx build
143
+ make package # Nox package session: sdist, wheel, installed smoke test
144
+ ```
145
+
146
+ `make help` lists the targets. Unit tests assert rendered text and parameters offline and
147
+ need no database. `make cypher-audit` checks a corpus of rendered statements against a
148
+ running server when you change a rendering rule.
149
+
150
+ ## Licence
151
+
152
+ Apache-2.0. See `LICENSE` and `NOTICE`.
@@ -0,0 +1,8 @@
1
+ /* Code blocks keep Alabaster's line height and vertical padding, but use a narrow
2
+ horizontal inset and a smaller font. The theme's 30px sides and 0.9em code size shrink
3
+ the code column to about 69 characters, and its line-highlight rule already assumes a
4
+ 12px inset. At 0.8em the desktop column fits 77 characters. */
5
+ pre {
6
+ font-size: 0.8em;
7
+ padding: 7px 12px;
8
+ }