odatapy 5.0.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.
- odatapy-5.0.0a1/.gitignore +24 -0
- odatapy-5.0.0a1/CHANGELOG.md +48 -0
- odatapy-5.0.0a1/LICENSE +202 -0
- odatapy-5.0.0a1/NOTICE +7 -0
- odatapy-5.0.0a1/PKG-INFO +240 -0
- odatapy-5.0.0a1/PYTHON_ODATA_PORT_PLAN.md +208 -0
- odatapy-5.0.0a1/README.md +201 -0
- odatapy-5.0.0a1/conftest.py +10 -0
- odatapy-5.0.0a1/docs/OLINGO_COMPARISON.md +273 -0
- odatapy-5.0.0a1/examples/demo_service.py +128 -0
- odatapy-5.0.0a1/pyproject.toml +78 -0
- odatapy-5.0.0a1/src/odatapy/__init__.py +29 -0
- odatapy-5.0.0a1/src/odatapy/client/__init__.py +26 -0
- odatapy-5.0.0a1/src/odatapy/client/client.py +295 -0
- odatapy-5.0.0a1/src/odatapy/client/filters.py +118 -0
- odatapy-5.0.0a1/src/odatapy/client/responses.py +99 -0
- odatapy-5.0.0a1/src/odatapy/client/serialization.py +210 -0
- odatapy-5.0.0a1/src/odatapy/client/transport.py +109 -0
- odatapy-5.0.0a1/src/odatapy/client/uri_builder.py +214 -0
- odatapy-5.0.0a1/src/odatapy/data/__init__.py +301 -0
- odatapy-5.0.0a1/src/odatapy/edm/__init__.py +75 -0
- odatapy-5.0.0a1/src/odatapy/edm/csdl.py +294 -0
- odatapy-5.0.0a1/src/odatapy/edm/geo.py +343 -0
- odatapy-5.0.0a1/src/odatapy/edm/json_value.py +129 -0
- odatapy-5.0.0a1/src/odatapy/edm/model.py +513 -0
- odatapy-5.0.0a1/src/odatapy/edm/names.py +27 -0
- odatapy-5.0.0a1/src/odatapy/edm/primitives.py +967 -0
- odatapy-5.0.0a1/src/odatapy/edm/xml_io.py +303 -0
- odatapy-5.0.0a1/src/odatapy/errors.py +122 -0
- odatapy-5.0.0a1/src/odatapy/ext/__init__.py +5 -0
- odatapy-5.0.0a1/src/odatapy/ext/sql.py +133 -0
- odatapy-5.0.0a1/src/odatapy/http/__init__.py +22 -0
- odatapy-5.0.0a1/src/odatapy/http/content_type.py +252 -0
- odatapy-5.0.0a1/src/odatapy/http/header.py +27 -0
- odatapy-5.0.0a1/src/odatapy/http/method.py +18 -0
- odatapy-5.0.0a1/src/odatapy/http/prefer.py +82 -0
- odatapy-5.0.0a1/src/odatapy/http/status.py +54 -0
- odatapy-5.0.0a1/src/odatapy/py.typed +0 -0
- odatapy-5.0.0a1/src/odatapy/server/__init__.py +20 -0
- odatapy-5.0.0a1/src/odatapy/server/adapters/__init__.py +11 -0
- odatapy-5.0.0a1/src/odatapy/server/adapters/asgi.py +86 -0
- odatapy-5.0.0a1/src/odatapy/server/adapters/common.py +90 -0
- odatapy-5.0.0a1/src/odatapy/server/adapters/wsgi.py +82 -0
- odatapy-5.0.0a1/src/odatapy/server/apply.py +177 -0
- odatapy-5.0.0a1/src/odatapy/server/batch.py +261 -0
- odatapy-5.0.0a1/src/odatapy/server/default_processor.py +77 -0
- odatapy-5.0.0a1/src/odatapy/server/deserializer/__init__.py +5 -0
- odatapy-5.0.0a1/src/odatapy/server/deserializer/json_deserializer.py +179 -0
- odatapy-5.0.0a1/src/odatapy/server/deserializer/xml_deserializer.py +81 -0
- odatapy-5.0.0a1/src/odatapy/server/dispatcher.py +270 -0
- odatapy-5.0.0a1/src/odatapy/server/eval.py +221 -0
- odatapy-5.0.0a1/src/odatapy/server/handler.py +164 -0
- odatapy-5.0.0a1/src/odatapy/server/inmemory.py +767 -0
- odatapy-5.0.0a1/src/odatapy/server/negotiator.py +81 -0
- odatapy-5.0.0a1/src/odatapy/server/odata.py +60 -0
- odatapy-5.0.0a1/src/odatapy/server/processor.py +239 -0
- odatapy-5.0.0a1/src/odatapy/server/request.py +116 -0
- odatapy-5.0.0a1/src/odatapy/server/serializer/__init__.py +24 -0
- odatapy-5.0.0a1/src/odatapy/server/serializer/factory.py +23 -0
- odatapy-5.0.0a1/src/odatapy/server/serializer/json_serializer.py +304 -0
- odatapy-5.0.0a1/src/odatapy/server/serializer/metadata.py +339 -0
- odatapy-5.0.0a1/src/odatapy/server/serializer/xml_serializer.py +215 -0
- odatapy-5.0.0a1/src/odatapy/server/uri/__init__.py +81 -0
- odatapy-5.0.0a1/src/odatapy/server/uri/expression.py +214 -0
- odatapy-5.0.0a1/src/odatapy/server/uri/expression_parser.py +279 -0
- odatapy-5.0.0a1/src/odatapy/server/uri/parser.py +420 -0
- odatapy-5.0.0a1/src/odatapy/server/uri/query_options.py +112 -0
- odatapy-5.0.0a1/src/odatapy/server/uri/resource.py +177 -0
- odatapy-5.0.0a1/src/odatapy/server/uri/validator.py +77 -0
- odatapy-5.0.0a1/tests/__init__.py +0 -0
- odatapy-5.0.0a1/tests/sample_edm.py +152 -0
- odatapy-5.0.0a1/tests/test_apply.py +82 -0
- odatapy-5.0.0a1/tests/test_batch.py +131 -0
- odatapy-5.0.0a1/tests/test_client.py +156 -0
- odatapy-5.0.0a1/tests/test_client_xml.py +44 -0
- odatapy-5.0.0a1/tests/test_deferred_features.py +259 -0
- odatapy-5.0.0a1/tests/test_delta.py +38 -0
- odatapy-5.0.0a1/tests/test_edm_model.py +72 -0
- odatapy-5.0.0a1/tests/test_expand.py +72 -0
- odatapy-5.0.0a1/tests/test_ext_sql.py +56 -0
- odatapy-5.0.0a1/tests/test_geo.py +82 -0
- odatapy-5.0.0a1/tests/test_http.py +64 -0
- odatapy-5.0.0a1/tests/test_media.py +76 -0
- odatapy-5.0.0a1/tests/test_primitives.py +313 -0
- odatapy-5.0.0a1/tests/test_release_fixes.py +235 -0
- odatapy-5.0.0a1/tests/test_review_fixes.py +315 -0
- odatapy-5.0.0a1/tests/test_server_e2e.py +214 -0
- odatapy-5.0.0a1/tests/test_server_xml.py +100 -0
- odatapy-5.0.0a1/tests/test_uri_parser.py +218 -0
- odatapy-5.0.0a1/tests/test_wsgi_adapter.py +87 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Byte-compiled / cache
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
.pytest_cache/
|
|
5
|
+
.mypy_cache/
|
|
6
|
+
.ruff_cache/
|
|
7
|
+
.coverage
|
|
8
|
+
htmlcov/
|
|
9
|
+
|
|
10
|
+
# Build / packaging
|
|
11
|
+
build/
|
|
12
|
+
dist/
|
|
13
|
+
*.egg-info/
|
|
14
|
+
.eggs/
|
|
15
|
+
|
|
16
|
+
# Virtual envs
|
|
17
|
+
.venv/
|
|
18
|
+
venv/
|
|
19
|
+
env/
|
|
20
|
+
|
|
21
|
+
# IDE / OS
|
|
22
|
+
.idea/
|
|
23
|
+
.vscode/
|
|
24
|
+
.DS_Store
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses
|
|
5
|
+
[PEP 440](https://peps.python.org/pep-0440/) versions.
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [5.0.0a1] - 2026-09-08
|
|
10
|
+
|
|
11
|
+
First public alpha. The version number tracks the Apache Olingo release the
|
|
12
|
+
library is modelled on (5.0.0); it does **not** claim feature parity. See
|
|
13
|
+
`docs/OLINGO_COMPARISON.md` for the coverage matrix and known gaps.
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
- EDM type system: all OData primitive types with literal grammars and facets,
|
|
17
|
+
CSDL provider model, runtime EDM, `$metadata` XML and JSON CSDL output and
|
|
18
|
+
XML parsing, geospatial types (WKT and GeoJSON).
|
|
19
|
+
- Transport-neutral server pipeline with ASGI and WSGI adapters, consolidated
|
|
20
|
+
processor protocols, and a reusable in-memory reference processor.
|
|
21
|
+
- URI and query-option parsing: resource paths, `$filter` expression tree with
|
|
22
|
+
visitor, `$select`, `$expand` (nested options, `$levels`), `$orderby`, `$top`,
|
|
23
|
+
`$skip`, `$count`, `$search`, `$format`, `$apply` (filter/aggregate/groupby).
|
|
24
|
+
- JSON payload serialization (metadata levels none/minimal/full) and Atom/XML
|
|
25
|
+
payloads, delta responses, media entities, `$ref`, singletons, bound and
|
|
26
|
+
unbound operations, deep insert, `$batch` with changesets, ETag preconditions,
|
|
27
|
+
server-driven paging, and the `Prefer: respond-async` protocol.
|
|
28
|
+
- Client: fluent `URIBuilder`, `$filter` builder, CRUD and operation calls,
|
|
29
|
+
`$metadata` to EDM with caching, JSON and XML response reading, httpx
|
|
30
|
+
transports, and an in-process transport for tests.
|
|
31
|
+
- `odatapy.ext.sql`: `$filter` tree to parameterised SQL `WHERE` clause.
|
|
32
|
+
|
|
33
|
+
### Fixed (pre-release hardening)
|
|
34
|
+
- `X-HTTP-Method` / `X-HTTP-Method-Override` tunnelling is honoured only on
|
|
35
|
+
POST requests, and an unknown tunnelled verb no longer silently becomes GET.
|
|
36
|
+
- `Edm.Double` / `Edm.Single` infinities and NaN are serialized as the JSON
|
|
37
|
+
strings `"INF"`, `"-INF"`, `"NaN"` instead of invalid JSON tokens.
|
|
38
|
+
- `@odata.count` honours `$filter` and `$search` instead of counting the whole
|
|
39
|
+
entity set.
|
|
40
|
+
- `$orderby` places nulls first for ascending and last for descending order, as
|
|
41
|
+
the specification requires.
|
|
42
|
+
- Client `URIBuilder` replaces a system query option that is set twice instead
|
|
43
|
+
of emitting it twice, and percent-encodes path segments and key literals.
|
|
44
|
+
- Client `get_property_value` handles raw `$value` responses; `invoke_action`
|
|
45
|
+
serializes `Decimal`, `datetime`, `UUID` and `bytes` parameters; `bytes`
|
|
46
|
+
property values are written as base64; `update_entity(method="REPLACE")`
|
|
47
|
+
maps to PUT; `ODataClientError` no longer raises while parsing a non-object
|
|
48
|
+
error body.
|
odatapy-5.0.0a1/LICENSE
ADDED
|
@@ -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.
|
odatapy-5.0.0a1/NOTICE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
odatapy
|
|
2
|
+
Copyright 2026 Beroe Inc.
|
|
3
|
+
|
|
4
|
+
This product is a Python port of Apache Olingo OData 4 (https://olingo.apache.org/),
|
|
5
|
+
Copyright The Apache Software Foundation, licensed under the Apache License 2.0.
|
|
6
|
+
Protocol behaviour, type-system semantics and API naming follow Apache Olingo;
|
|
7
|
+
no Apache Olingo source code is redistributed in this package.
|
odatapy-5.0.0a1/PKG-INFO
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: odatapy
|
|
3
|
+
Version: 5.0.0a1
|
|
4
|
+
Summary: OData v4.0 / v4.01 server framework and client for Python, modelled on Apache Olingo
|
|
5
|
+
Project-URL: Homepage, https://github.com/Beroe-Inc/Python-OData-5.0.0
|
|
6
|
+
Project-URL: Source, https://github.com/Beroe-Inc/Python-OData-5.0.0
|
|
7
|
+
Project-URL: Issues, https://github.com/Beroe-Inc/Python-OData-5.0.0/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/Beroe-Inc/Python-OData-5.0.0/blob/main/CHANGELOG.md
|
|
9
|
+
Project-URL: Olingo comparison, https://github.com/Beroe-Inc/Python-OData-5.0.0/blob/main/docs/OLINGO_COMPARISON.md
|
|
10
|
+
Author-email: "Beroe Inc." <amit.goel@beroe-inc.com>
|
|
11
|
+
Maintainer-email: Amit Goel <amit.goel@beroe-inc.com>
|
|
12
|
+
License-Expression: Apache-2.0
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
License-File: NOTICE
|
|
15
|
+
Keywords: asgi,csdl,edm,odata,odata-v4,odata4,olingo,rest,wsgi
|
|
16
|
+
Classifier: Development Status :: 3 - Alpha
|
|
17
|
+
Classifier: Intended Audience :: Developers
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
26
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
27
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
28
|
+
Classifier: Typing :: Typed
|
|
29
|
+
Requires-Python: >=3.10
|
|
30
|
+
Provides-Extra: client
|
|
31
|
+
Requires-Dist: httpx>=0.27; extra == 'client'
|
|
32
|
+
Provides-Extra: dev
|
|
33
|
+
Requires-Dist: httpx>=0.27; extra == 'dev'
|
|
34
|
+
Requires-Dist: mypy; extra == 'dev'
|
|
35
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
|
36
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
37
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
|
|
40
|
+
# odatapy — OData v4 for Python
|
|
41
|
+
|
|
42
|
+
An OData **v4.0 / v4.01** server framework and client for Python, modelled on
|
|
43
|
+
[Apache Olingo OData 4](https://olingo.apache.org/) (Java). It is
|
|
44
|
+
transport-neutral: the server mounts into any ASGI or WSGI application, and the
|
|
45
|
+
client works over httpx or in-process.
|
|
46
|
+
|
|
47
|
+
> **Status: alpha.** The library is usable for JSON-first OData services and
|
|
48
|
+
> clients, and ships with 190+ tests. It is **not** at feature parity with
|
|
49
|
+
> Olingo: the URI parser, serializers and in-memory processor cover the common
|
|
50
|
+
> OData surface but skip or simplify a number of spec areas. Read
|
|
51
|
+
> [Coverage compared with Apache Olingo](#coverage-compared-with-apache-olingo)
|
|
52
|
+
> before relying on it in production. The version number (5.0.0aN) follows the
|
|
53
|
+
> Olingo release the design is modelled on, not a parity claim.
|
|
54
|
+
|
|
55
|
+
## Installation
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install odatapy # server + in-process client (no dependencies)
|
|
59
|
+
pip install "odatapy[client]" # adds httpx for the networked client
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Python 3.10 or newer. No required runtime dependencies.
|
|
63
|
+
|
|
64
|
+
## Features
|
|
65
|
+
|
|
66
|
+
- **EDM type system** — all OData primitive types with literal grammars, facet
|
|
67
|
+
validation and URI-literal encoding; runtime EDM built from a declarative CSDL
|
|
68
|
+
provider or loaded from a `$metadata` XML document.
|
|
69
|
+
- **Server framework** — transport-neutral request pipeline (parse → validate →
|
|
70
|
+
dispatch → processor), consolidated processor protocols, and a reusable
|
|
71
|
+
in-memory reference service.
|
|
72
|
+
- **URI & query options** — resource paths plus `$filter` (expression tree +
|
|
73
|
+
visitor), `$select`, `$expand` (nested options, `$levels`), `$orderby`, `$top`,
|
|
74
|
+
`$skip`, `$count`, `$search`, `$format`, and `$apply` (`filter`/`aggregate`/
|
|
75
|
+
`groupby` evaluated in memory).
|
|
76
|
+
- **Serialization** — JSON (metadata levels none/minimal/full) and Atom/XML
|
|
77
|
+
payloads; `$metadata` as XML (EDMX/CSDL) and JSON CSDL; delta responses.
|
|
78
|
+
- **Protocol features** — media entities (`$value`, `HasStream`), `$batch` with
|
|
79
|
+
changesets and `$<id>` references, bound and unbound functions/actions, deep
|
|
80
|
+
insert with `@odata.bind`, `$ref`, singletons, ETags with `If-Match` /
|
|
81
|
+
`If-None-Match`, server-driven paging, and `Prefer: respond-async`.
|
|
82
|
+
- **Geospatial** — Geography*/Geometry* types with WKT and GeoJSON.
|
|
83
|
+
- **HTTP adapters** — ASGI (FastAPI/Starlette) and WSGI (Flask/Django/gunicorn)
|
|
84
|
+
with `X-HTTP-Method` tunnelling on POST.
|
|
85
|
+
- **Client** — fluent `URIBuilder`, `$filter` builder, CRUD, property updates,
|
|
86
|
+
functions/actions, `$count`, service document, `$metadata` → EDM with caching,
|
|
87
|
+
JSON and XML response reading, httpx transport, and a zero-network in-process
|
|
88
|
+
transport for tests.
|
|
89
|
+
- **Extensions** — `odatapy.ext.sql` translates a `$filter` tree to a
|
|
90
|
+
parameterised SQL `WHERE` clause (a worked `ExpressionVisitor`).
|
|
91
|
+
|
|
92
|
+
## Server in 30 lines
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
from decimal import Decimal
|
|
96
|
+
from odatapy.data import Entity, ValueType
|
|
97
|
+
from odatapy.edm.csdl import *
|
|
98
|
+
from odatapy.server import OData
|
|
99
|
+
from odatapy.server.adapters import ODataWSGIApp
|
|
100
|
+
from odatapy.server.inmemory import InMemoryDataStore, InMemoryProcessor
|
|
101
|
+
|
|
102
|
+
class Provider(CsdlAbstractEdmProvider):
|
|
103
|
+
def get_schemas(self):
|
|
104
|
+
product = CsdlEntityType(
|
|
105
|
+
name="Product", key=[CsdlPropertyRef(name="ID")],
|
|
106
|
+
properties=[
|
|
107
|
+
CsdlProperty(name="ID", type="Edm.Int32", nullable=False),
|
|
108
|
+
CsdlProperty(name="Name", type="Edm.String"),
|
|
109
|
+
CsdlProperty(name="Price", type="Edm.Decimal", precision=10, scale=2),
|
|
110
|
+
],
|
|
111
|
+
)
|
|
112
|
+
container = CsdlEntityContainer(
|
|
113
|
+
name="Container",
|
|
114
|
+
entity_sets=[CsdlEntitySet(name="Products", type="Demo.Product")],
|
|
115
|
+
)
|
|
116
|
+
return [CsdlSchema(namespace="Demo", entity_types=[product], entity_container=container)]
|
|
117
|
+
|
|
118
|
+
odata = OData.new_instance()
|
|
119
|
+
handler = odata.create_handler(odata.create_service_metadata(Provider()))
|
|
120
|
+
store = InMemoryDataStore()
|
|
121
|
+
p = Entity(); p.set_property("ID", 1, ValueType.PRIMITIVE, "Edm.Int32")
|
|
122
|
+
p.set_property("Name", "Apple", ValueType.PRIMITIVE, "Edm.String")
|
|
123
|
+
p.set_property("Price", Decimal("1.50"), ValueType.PRIMITIVE, "Edm.Decimal")
|
|
124
|
+
store.set_entities("Products", [p])
|
|
125
|
+
handler.register(InMemoryProcessor(store))
|
|
126
|
+
|
|
127
|
+
app = ODataWSGIApp(handler) # a WSGI app: mount in Flask/gunicorn/wsgiref
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
A complete runnable service (WSGI + ASGI) is in
|
|
131
|
+
[`examples/demo_service.py`](https://github.com/Beroe-Inc/Python-OData-5.0.0/blob/main/examples/demo_service.py):
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
python examples/demo_service.py
|
|
135
|
+
curl http://localhost:8080/\$metadata
|
|
136
|
+
curl "http://localhost:8080/Products?\$filter=Price gt 2&\$orderby=Price desc"
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
For a real back end, implement the processor protocols in `odatapy.server.processor`
|
|
140
|
+
(entity collection, entity, primitive/complex property, media, reference,
|
|
141
|
+
function/action, batch) and register your implementation instead of
|
|
142
|
+
`InMemoryProcessor`. The in-memory processor is a reference implementation and a
|
|
143
|
+
test oracle, not a production data layer.
|
|
144
|
+
|
|
145
|
+
## Client
|
|
146
|
+
|
|
147
|
+
```python
|
|
148
|
+
from odatapy.client import ODataClient
|
|
149
|
+
from odatapy.client.transport import HttpxTransport
|
|
150
|
+
from odatapy.client.filters import Field, and_
|
|
151
|
+
|
|
152
|
+
client = ODataClient("http://host/svc", HttpxTransport())
|
|
153
|
+
|
|
154
|
+
uri = (client.entity_set_uri("Products")
|
|
155
|
+
.filter(and_(Field("Price").gt(10), Field("Name").startswith("A")))
|
|
156
|
+
.select("Name", "Price").top(10))
|
|
157
|
+
for entity in client.get_entity_set(uri).entities:
|
|
158
|
+
print(entity.get_value("Name"))
|
|
159
|
+
|
|
160
|
+
client.create_entity("Products", {"ID": 42, "Name": "Kiwi", "Price": 3.0})
|
|
161
|
+
client.update_entity(client.entity_uri("Products", 42), {"Price": 3.5}) # PATCH
|
|
162
|
+
client.update_property(client.entity_uri("Products", 42).append_property_segment("Name"), "Kiwi Gold")
|
|
163
|
+
print(client.get_count(client.entity_set_uri("Products")))
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
`HandlerTransport` routes requests to an in-process server handler with no
|
|
167
|
+
network (used throughout the test suite). `AsyncHttpxTransport` provides an
|
|
168
|
+
awaitable transport; the high-level `ODataClient` itself is synchronous today.
|
|
169
|
+
|
|
170
|
+
## Custom back ends: the filter visitor
|
|
171
|
+
|
|
172
|
+
`$filter` parses to an expression tree; implement an `ExpressionVisitor` to
|
|
173
|
+
evaluate or translate it. `odatapy.ext.sql` is a worked example:
|
|
174
|
+
|
|
175
|
+
```python
|
|
176
|
+
from odatapy.ext.sql import filter_to_sql
|
|
177
|
+
where, params = filter_to_sql(uri_info.filter.expression, column_map={"Name": "product_name"})
|
|
178
|
+
# where == "(product_name LIKE ?)", params == ["A%"] (for startswith(Name,'A'))
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Coverage compared with Apache Olingo
|
|
182
|
+
|
|
183
|
+
odatapy is about 12,000 lines of Python against roughly 100,000 lines of Java in
|
|
184
|
+
Olingo's `commons`, `server` and `client` modules. A detailed, file-referenced
|
|
185
|
+
comparison with reproduction snippets is in
|
|
186
|
+
[`docs/OLINGO_COMPARISON.md`](https://github.com/Beroe-Inc/Python-OData-5.0.0/blob/main/docs/OLINGO_COMPARISON.md).
|
|
187
|
+
The short version:
|
|
188
|
+
|
|
189
|
+
| Area | Coverage | Main gaps |
|
|
190
|
+
|---|---|---|
|
|
191
|
+
| Primitive types, literals, facets | High | DateTimeOffset/TimeOfDay precision not enforced; 4.01 abstract types (`Edm.Untyped`, `Edm.PrimitiveType`) missing |
|
|
192
|
+
| CSDL provider + `$metadata` XML | Medium-high | `edmx:Reference`, `Annotations` targets, `Term`, `Scale="variable"`, container `Extends` not modelled; version fixed at 4.0 |
|
|
193
|
+
| `$metadata` JSON CSDL | Medium | Functions/actions/imports/type definitions and `$IsFlags` not emitted; property annotations misplaced |
|
|
194
|
+
| Resource-path parser | Medium | No key-as-segment, type-cast segments, `$crossjoin`/`$all`, lambda in paths; key predicates not validated against the EDM |
|
|
195
|
+
| `$filter` expression parser | Medium | No `in`, `any`/`all`, `$it`/`$root`, `hassubset`; no EDM type binding, so unknown properties are not rejected as 400 |
|
|
196
|
+
| `$search` / `$apply` | Low | Stored as raw strings (no AST); `$apply` evaluation limited to `filter`/`aggregate`/`groupby` |
|
|
197
|
+
| URI validator | Low-medium | Only a subset of Olingo's method × resource × option matrix |
|
|
198
|
+
| JSON serializer | Medium | Derived types and `@odata.type` payload casts ignored; no IEEE754Compatible; incomplete full-metadata annotations; delta format mixes 4.0 and 4.01 |
|
|
199
|
+
| JSON deserializer | Medium | No type/facet validation of incoming values, no strict mode, no action-parameter deserializer |
|
|
200
|
+
| Atom/XML payloads | Low-medium | No navigation links or inline expand, service document namespace wrong, error details dropped |
|
|
201
|
+
| Server pipeline & headers | Medium | No `OData-Version`/`OData-MaxVersion` validation, 406/415 mapped to 400, `Preference-Applied` only for `return=minimal` |
|
|
202
|
+
| `$batch` | Medium | Changesets are not atomic, `$<id>` rewrite is a blind byte replace, binary parts are decoded as UTF-8 |
|
|
203
|
+
| In-memory processor | Medium | Navigation paths in reads, property writes, duplicate-key detection and nested `$expand` options are incomplete |
|
|
204
|
+
| Client | Medium | No batch, streaming/paging iterator, or `$ref` helpers; filter builder covers comparison/logical/string ops only |
|
|
205
|
+
| Not ported | — | DebugSupport, CustomETagSupport, ServiceMetadataETagSupport, CustomContentTypeSupport, Olingo `server-core-ext`, NTLM auth |
|
|
206
|
+
|
|
207
|
+
## Package layout
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
odatapy/
|
|
211
|
+
├── edm/ primitives, geo, names, csdl (provider), model (runtime Edm),
|
|
212
|
+
│ xml_io (metadata parse + XmlEdmProvider), json_value
|
|
213
|
+
├── data/ Entity, Property, ComplexValue, EntityCollection, Link, ContextURL, Delta
|
|
214
|
+
├── http/ ContentType/Accept, HttpMethod, HttpStatusCode, Prefer, headers
|
|
215
|
+
├── errors.py ODataError + exception hierarchy
|
|
216
|
+
├── server/ request/response, handler, dispatcher, processors, negotiator,
|
|
217
|
+
│ uri/ (parser, expression tree, query options, validator),
|
|
218
|
+
│ serializer/ (json, xml, metadata), deserializer/ (json, xml),
|
|
219
|
+
│ batch, apply, eval, inmemory, adapters/ (asgi, wsgi)
|
|
220
|
+
├── client/ client, uri_builder, filters, serialization, transport, responses
|
|
221
|
+
└── ext/ sql (filter → SQL WHERE)
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Development
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
pip install -e ".[dev]"
|
|
228
|
+
pytest -q
|
|
229
|
+
ruff check src tests examples
|
|
230
|
+
python -m build && twine check dist/*
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Releases are published from GitHub Actions with PyPI Trusted Publishing
|
|
234
|
+
(see `.github/workflows/publish.yml`); no API tokens are stored.
|
|
235
|
+
|
|
236
|
+
## License
|
|
237
|
+
|
|
238
|
+
Apache License 2.0. See `LICENSE` and `NOTICE`. Apache Olingo is a trademark of
|
|
239
|
+
The Apache Software Foundation; this project is an independent port and is not
|
|
240
|
+
endorsed by the ASF.
|