chtypes 2.0.0.dev0__py3-none-any.whl → 2.0.0.dev1__py3-none-any.whl
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.
- chtypes/_abi2/_decls.py +67 -14
- chtypes/_abi2/_errmap.py +1 -1
- chtypes/_abi2/_loader.py +28 -15
- chtypes/_abi2/_vocab.py +1 -1
- chtypes/library.py +3 -1
- {chtypes-2.0.0.dev0.dist-info → chtypes-2.0.0.dev1.dist-info}/METADATA +1 -1
- {chtypes-2.0.0.dev0.dist-info → chtypes-2.0.0.dev1.dist-info}/RECORD +10 -10
- {chtypes-2.0.0.dev0.dist-info → chtypes-2.0.0.dev1.dist-info}/WHEEL +0 -0
- {chtypes-2.0.0.dev0.dist-info → chtypes-2.0.0.dev1.dist-info}/entry_points.txt +0 -0
- {chtypes-2.0.0.dev0.dist-info → chtypes-2.0.0.dev1.dist-info}/licenses/LICENSE +0 -0
chtypes/_abi2/_decls.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# GENERATED by scripts/abi-v1/gen.py --major 2 from spec/abi-v2/abi.json (CHS_ABI_FINGERPRINT sha256:
|
|
1
|
+
# GENERATED by scripts/abi-v1/gen.py --major 2 from spec/abi-v2/abi.json (CHS_ABI_FINGERPRINT sha256:d87e91be2bbe75b985c38224268c2f7dc5d8236dab0a4b4d61357c6dfdc1a232) — DO NOT EDIT # noqa: E501
|
|
2
2
|
"""The Python binding's generated ABI v2 layer: ctypes signatures, the handle
|
|
3
3
|
classes, the two-phase resolve functions and invoke_by_name(), the test-only
|
|
4
4
|
dispatcher the conformance suite drives from tests/fixtures/abi-v2/cases.json.
|
|
@@ -19,7 +19,7 @@ from dataclasses import dataclass, field
|
|
|
19
19
|
from . import _errmap
|
|
20
20
|
|
|
21
21
|
CHS_ABI_VERSION = 2
|
|
22
|
-
CHS_ABI_FINGERPRINT = "sha256:
|
|
22
|
+
CHS_ABI_FINGERPRINT = "sha256:d87e91be2bbe75b985c38224268c2f7dc5d8236dab0a4b4d61357c6dfdc1a232"
|
|
23
23
|
|
|
24
24
|
# The description's stability: "unstable" while this generation is being
|
|
25
25
|
# designed, so CHS_ABI_FINGERPRINT moves with every change, and "locked" after
|
|
@@ -61,6 +61,7 @@ _STATUS_OK = 0
|
|
|
61
61
|
HANDLE_FREE: dict[str, str] = {
|
|
62
62
|
"chs_buf": "chs_buf_free",
|
|
63
63
|
"chs_error": "chs_error_free",
|
|
64
|
+
"chs_server": "chs_server_free",
|
|
64
65
|
"chs_schema": "chs_schema_free",
|
|
65
66
|
"chs_filter": "chs_filter_free",
|
|
66
67
|
"chs_block": "chs_block_free",
|
|
@@ -102,6 +103,8 @@ ALL_SYMBOLS: tuple[str, ...] = (
|
|
|
102
103
|
"chs_schema_create",
|
|
103
104
|
"chs_schema_describe",
|
|
104
105
|
"chs_schema_free",
|
|
106
|
+
"chs_server_create",
|
|
107
|
+
"chs_server_free",
|
|
105
108
|
"chs_set_defaults",
|
|
106
109
|
"chs_shutdown",
|
|
107
110
|
"chs_type_validate",
|
|
@@ -174,6 +177,10 @@ class ErrorHandle(Handle):
|
|
|
174
177
|
"""A `chs_error` the library owns the free function for."""
|
|
175
178
|
|
|
176
179
|
|
|
180
|
+
class ServerHandle(Handle):
|
|
181
|
+
"""A `chs_server` the library owns the free function for."""
|
|
182
|
+
|
|
183
|
+
|
|
177
184
|
class SchemaHandle(Handle):
|
|
178
185
|
"""A `chs_schema` the library owns the free function for."""
|
|
179
186
|
|
|
@@ -189,6 +196,7 @@ class BlockHandle(Handle):
|
|
|
189
196
|
_HANDLE_CLASS: dict[str, type[Handle]] = {
|
|
190
197
|
"chs_buf": BufHandle,
|
|
191
198
|
"chs_error": ErrorHandle,
|
|
199
|
+
"chs_server": ServerHandle,
|
|
192
200
|
"chs_schema": SchemaHandle,
|
|
193
201
|
"chs_filter": FilterHandle,
|
|
194
202
|
"chs_block": BlockHandle,
|
|
@@ -324,12 +332,24 @@ _add(
|
|
|
324
332
|
_P("out", "out_handle", "chs_buf"),
|
|
325
333
|
_P("err", "out_error", "chs_error", nullable=True),
|
|
326
334
|
)
|
|
335
|
+
_add(
|
|
336
|
+
"chs_server_create",
|
|
337
|
+
"status",
|
|
338
|
+
"chs_status",
|
|
339
|
+
_P("profile", "bytes_in", None),
|
|
340
|
+
_P("options", "bytes_in", None),
|
|
341
|
+
_P("out", "out_handle", "chs_server"),
|
|
342
|
+
_P("err", "out_error", "chs_error", nullable=True),
|
|
343
|
+
)
|
|
344
|
+
_add("chs_server_free", "void", None, _P("server", "handle", "chs_server", nullable=True))
|
|
327
345
|
_add(
|
|
328
346
|
"chs_schema_create",
|
|
329
347
|
"status",
|
|
330
348
|
"chs_status",
|
|
349
|
+
_P("server", "handle", "chs_server", nullable=True),
|
|
331
350
|
_P("create_table", "bytes_in", None),
|
|
332
351
|
_P("settings", "bytes_in", None),
|
|
352
|
+
_P("options", "bytes_in", None),
|
|
333
353
|
_P("out", "out_handle", "chs_schema"),
|
|
334
354
|
_P("err", "out_error", "chs_error", nullable=True),
|
|
335
355
|
)
|
|
@@ -486,6 +506,18 @@ def resolve_abi_version(lib: ctypes.CDLL) -> Callable[..., object]:
|
|
|
486
506
|
return fn
|
|
487
507
|
|
|
488
508
|
|
|
509
|
+
def resolve_build_info(lib: ctypes.CDLL) -> Callable[..., object]:
|
|
510
|
+
"""Loader step 4's dlsym: `chs_build_info` ALONE, so the fingerprint can be
|
|
511
|
+
compared before step 6's full sweep (rule r6 beats a missing symbol,
|
|
512
|
+
public issue #537). Absent is MissingSymbol, the step 4 refusal."""
|
|
513
|
+
try:
|
|
514
|
+
fn = lib.chs_build_info
|
|
515
|
+
except AttributeError:
|
|
516
|
+
raise MissingSymbol("chs_build_info") from None
|
|
517
|
+
_set_signature(fn, FUNCTIONS["chs_build_info"])
|
|
518
|
+
return fn
|
|
519
|
+
|
|
520
|
+
|
|
489
521
|
class Api:
|
|
490
522
|
"""Every described symbol, resolved and signature-typed, step 6
|
|
491
523
|
(plan section 3.2). Constructed ONLY by resolve_all(): the constructor
|
|
@@ -703,19 +735,42 @@ class Api:
|
|
|
703
735
|
self._check(status, err)
|
|
704
736
|
return _read_buf(self, out.value)
|
|
705
737
|
|
|
738
|
+
def server_create(
|
|
739
|
+
self,
|
|
740
|
+
profile: bytes | None,
|
|
741
|
+
options: bytes | None,
|
|
742
|
+
) -> ServerHandle:
|
|
743
|
+
"""The generated call wrapper for chs_server_create (thread class any).
|
|
744
|
+
|
|
745
|
+
Raises the class the status maps to on a non-OK status."""
|
|
746
|
+
out = ctypes.c_void_p()
|
|
747
|
+
err = ctypes.c_void_p()
|
|
748
|
+
status = self._raw["chs_server_create"](
|
|
749
|
+
*_bytes_in(profile),
|
|
750
|
+
*_bytes_in(options),
|
|
751
|
+
ctypes.byref(out),
|
|
752
|
+
ctypes.byref(err),
|
|
753
|
+
)
|
|
754
|
+
self._check(status, err)
|
|
755
|
+
return ServerHandle(out.value, self._raw["chs_server_free"])
|
|
756
|
+
|
|
706
757
|
def schema_create(
|
|
707
758
|
self,
|
|
759
|
+
server: ServerHandle | None,
|
|
708
760
|
create_table: bytes | None,
|
|
709
761
|
settings: bytes | None,
|
|
762
|
+
options: bytes | None,
|
|
710
763
|
) -> SchemaHandle:
|
|
711
|
-
"""The generated call wrapper for chs_schema_create (thread class
|
|
764
|
+
"""The generated call wrapper for chs_schema_create (thread class shared).
|
|
712
765
|
|
|
713
766
|
Raises the class the status maps to on a non-OK status."""
|
|
714
767
|
out = ctypes.c_void_p()
|
|
715
768
|
err = ctypes.c_void_p()
|
|
716
769
|
status = self._raw["chs_schema_create"](
|
|
770
|
+
None if server is None else server.value,
|
|
717
771
|
*_bytes_in(create_table),
|
|
718
772
|
*_bytes_in(settings),
|
|
773
|
+
*_bytes_in(options),
|
|
719
774
|
ctypes.byref(out),
|
|
720
775
|
ctypes.byref(err),
|
|
721
776
|
)
|
|
@@ -925,17 +980,15 @@ _API_KEY = object()
|
|
|
925
980
|
|
|
926
981
|
|
|
927
982
|
def resolve_all(lib: ctypes.CDLL) -> Api:
|
|
928
|
-
"""Every described symbol, in sorted, deterministic order --
|
|
929
|
-
INCLUDED, even though _loader.py's
|
|
930
|
-
resolved
|
|
931
|
-
below needs every symbol reachable through ONE
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
chs_clickhouse_version included -- loader step 4 needs chs_build_info
|
|
938
|
-
already resolved, which is exactly why this sweep must run before it."""
|
|
983
|
+
"""Every described symbol, in sorted, deterministic order -- the handshake
|
|
984
|
+
symbols INCLUDED, even though _loader.py's steps 3 and 4 (resolve_abi_version,
|
|
985
|
+
resolve_build_info) already resolved theirs before this runs: the test-only
|
|
986
|
+
invoke_by_name() dispatcher below needs every symbol reachable through ONE
|
|
987
|
+
Api, and re-resolving an already-present symbol is harmless. The first
|
|
988
|
+
symbol ctypes cannot dlsym raises MissingSymbol(name); _loader.py's step 6
|
|
989
|
+
turns that into "missing_symbol:<name>", matching every missing-<sym> stub
|
|
990
|
+
variant. Step 6 runs AFTER step 4's fingerprint comparison, so a library
|
|
991
|
+
with another fingerprint is refused with rule r6's message first."""
|
|
939
992
|
raw: dict = {}
|
|
940
993
|
for name in ALL_SYMBOLS:
|
|
941
994
|
try:
|
chtypes/_abi2/_errmap.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# GENERATED by scripts/abi-v1/gen.py --major 2 from spec/abi-v2/abi.json (CHS_ABI_FINGERPRINT sha256:
|
|
1
|
+
# GENERATED by scripts/abi-v1/gen.py --major 2 from spec/abi-v2/abi.json (CHS_ABI_FINGERPRINT sha256:d87e91be2bbe75b985c38224268c2f7dc5d8236dab0a4b4d61357c6dfdc1a232) — DO NOT EDIT # noqa: E501
|
|
2
2
|
"""spec/abi-v2/sdk.json's error-mapping tables, as references to the
|
|
3
3
|
public classes (python/src/chtypes/errors.py, re-exported by
|
|
4
4
|
python/src/chtypes/_abi2/_errors.py). Only the MAPPING is generated: the
|
chtypes/_abi2/_loader.py
CHANGED
|
@@ -9,15 +9,20 @@ wired up; `predicate` is passed through exactly as that seam promises.
|
|
|
9
9
|
Every `chs_*` spelling in this module is forbidden by
|
|
10
10
|
scripts/abi-v1/check-no-hand-decls.py (it is not a generated file), so this
|
|
11
11
|
calls ONLY python/src/chtypes/_abi2/_decls.py's non-`chs_`-prefixed surface:
|
|
12
|
-
`resolve_abi_version()`, `resolve_all()`, and the `Api` object they return.
|
|
13
|
-
|
|
14
|
-
Steps 1-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
`resolve_abi_version()`, `resolve_build_info()`, `resolve_all()`, and the `Api` object they return.
|
|
13
|
+
|
|
14
|
+
Steps 1-7 run in the documented order, the order Go, TypeScript and Rust
|
|
15
|
+
run: glibc (1), dlopen (2), `chs_abi_version` alone (3), `chs_build_info`
|
|
16
|
+
alone, parsed strictly and its fingerprint compared (4: rule r6's exact
|
|
17
|
+
message wins here), the signed-statement cross-check (5), and only then the
|
|
18
|
+
resolve-every-declared-symbol sweep (6). A library with another fingerprint
|
|
19
|
+
that also lacks a symbol this SDK declares (every fingerprint move that adds
|
|
20
|
+
an export meets one) is therefore refused with r6's message, never as
|
|
21
|
+
`missing_symbol:<name>` (public issue #537; the stub variant
|
|
22
|
+
`fingerprint-other-missing-symbol`). A symbol missing from step 4's own
|
|
23
|
+
`chs_build_info` is still `missing_symbol:chs_build_info`, and
|
|
24
|
+
`tests/fixtures/abi-v2/cases.json`'s other `missing-<sym>` variants still
|
|
25
|
+
expect `missing_symbol:<name>` from step 6. Step 7
|
|
21
26
|
calls the image's once-per-image zone setup (empty zone = UTC unless the
|
|
22
27
|
caller supplies one) and then its default settings.
|
|
23
28
|
"""
|
|
@@ -198,15 +203,15 @@ def _open(
|
|
|
198
203
|
if version != _decls.CHS_ABI_VERSION:
|
|
199
204
|
_refuse("abi_version", path, want=_decls.CHS_ABI_VERSION, got=version)
|
|
200
205
|
|
|
206
|
+
# Step 4: chs_build_info ALONE, parsed strictly, then the fingerprint
|
|
207
|
+
# compared. Rule r6 is decided here, before the step 6 sweep can name a
|
|
208
|
+
# missing symbol instead (#537).
|
|
201
209
|
try:
|
|
202
|
-
|
|
210
|
+
build_info_fn = _decls.resolve_build_info(lib)
|
|
203
211
|
except _decls.MissingSymbol as e:
|
|
204
212
|
_refuse(f"missing_symbol:{e.name}", path, want=e.name, got=None)
|
|
205
|
-
# _refuse always raises
|
|
206
|
-
|
|
207
|
-
raise
|
|
208
|
-
|
|
209
|
-
raw = api.build_info()
|
|
213
|
+
raise # never reached: _refuse always raises
|
|
214
|
+
raw = build_info_fn()
|
|
210
215
|
if raw is None:
|
|
211
216
|
_refuse("build_info_malformed", path, got="chs_build_info() returned NULL")
|
|
212
217
|
info = _parse_build_info(raw, path)
|
|
@@ -214,9 +219,17 @@ def _open(
|
|
|
214
219
|
if info["abi_fingerprint"] != _decls.CHS_ABI_FINGERPRINT:
|
|
215
220
|
_refuse_fingerprint(path, info.get("abi_fingerprint"))
|
|
216
221
|
|
|
222
|
+
# Step 5: the signed predicate against build_info.
|
|
217
223
|
if not skip_step5:
|
|
218
224
|
_cross_check(info, predicate, path)
|
|
219
225
|
|
|
226
|
+
# Step 6: resolve every declared symbol.
|
|
227
|
+
try:
|
|
228
|
+
api = _decls.resolve_all(lib)
|
|
229
|
+
except _decls.MissingSymbol as e:
|
|
230
|
+
_refuse(f"missing_symbol:{e.name}", path, want=e.name, got=None)
|
|
231
|
+
raise # never reached: _refuse always raises
|
|
232
|
+
|
|
220
233
|
# Step 7: the once-per-image setup (docs/reference/bindings-v1.md section
|
|
221
234
|
# 6): the image zone (empty = UTC), then the default settings when there
|
|
222
235
|
# are any. After every handshake check and before any other call. A
|
chtypes/_abi2/_vocab.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# GENERATED by scripts/abi-v1/gen.py --major 2 from spec/abi-v2/abi.json (CHS_ABI_FINGERPRINT sha256:
|
|
1
|
+
# GENERATED by scripts/abi-v1/gen.py --major 2 from spec/abi-v2/abi.json (CHS_ABI_FINGERPRINT sha256:d87e91be2bbe75b985c38224268c2f7dc5d8236dab0a4b4d61357c6dfdc1a232) — DO NOT EDIT # noqa: E501
|
|
2
2
|
"""The Python binding's generated vocabularies, from spec/abi-v2/abi.json: the C
|
|
3
3
|
enums (`Format`, `Status`), the document vocabularies (`Outcome`, `FilterOutcome`,
|
|
4
4
|
`Verdict`, `DefaultKind`, `Reason`, `Source`, `DiscoverQueryParam`) with the facts the
|
chtypes/library.py
CHANGED
|
@@ -399,5 +399,7 @@ class Library:
|
|
|
399
399
|
a compiled type always takes the image zone, never the profile's."""
|
|
400
400
|
statement = to_bytes(create_table, "create_table")
|
|
401
401
|
settings_bytes = settings_json(settings, session_timezone)
|
|
402
|
-
|
|
402
|
+
# No server (NULL) and no options (none, which is `{}`): the schema is on
|
|
403
|
+
# the image's own server, exactly as before the server profile existed.
|
|
404
|
+
handle = self._api.schema_create(None, statement, settings_bytes, None)
|
|
403
405
|
return Schema(self, handle)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: chtypes
|
|
3
|
-
Version: 2.0.0.
|
|
3
|
+
Version: 2.0.0.dev1
|
|
4
4
|
Summary: Python binding for the chtypes artifacts: ClickHouse's own type system, per version, behind the frozen chs_* C ABI
|
|
5
5
|
Project-URL: Homepage, https://github.com/wave-rf/chtypes
|
|
6
6
|
Project-URL: Repository, https://github.com/wave-rf/chtypes
|
|
@@ -6,16 +6,16 @@ chtypes/_guard.py,sha256=zTtwprCS0XvGWY7GDozo-IP6GwjMAWl-o-AjShdCSVI,1985
|
|
|
6
6
|
chtypes/_input.py,sha256=GonZVBB7gOPXEoDBDjEExiZXMIW7gbTIFAopvcxqnTs,4039
|
|
7
7
|
chtypes/_setup.py,sha256=n84T0hFmXu_fdnXQIFhk3dMVL0_-yhfdRZsqCXTLzzg,6114
|
|
8
8
|
chtypes/errors.py,sha256=9qv94rxbe7hm7lSVFG33Qri82FwDtCY-EnJiwnMfkp8,9501
|
|
9
|
-
chtypes/library.py,sha256=
|
|
9
|
+
chtypes/library.py,sha256=U_XWbvJLxeXJmSDJV5OpwiRAKhlwTk_pFTlHxKFtab8,15600
|
|
10
10
|
chtypes/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
11
|
chtypes/registry.py,sha256=Wra-DzLYrWPHsyPlsTPOmPvuc1as5jPEfA7gxVYHPs4,12444
|
|
12
12
|
chtypes/results.py,sha256=JXHgnd06jXGbNGfHToBO0tRxUPy1Q3urOsH4EXax3-0,8062
|
|
13
13
|
chtypes/_abi2/__init__.py,sha256=d3i7_iUDMFT1jg49vRQz1SMH6oseYZHUR0oPt6aSTiY,1042
|
|
14
|
-
chtypes/_abi2/_decls.py,sha256=
|
|
15
|
-
chtypes/_abi2/_errmap.py,sha256=
|
|
14
|
+
chtypes/_abi2/_decls.py,sha256=c2xuqG0rFgSthOO1FHEGzPhr4ldKQzoOdRxyXaEslq8,38454
|
|
15
|
+
chtypes/_abi2/_errmap.py,sha256=L6WmPSXqqEoNchX1jrfWsbogthm5crwF-8tQBly330E,2886
|
|
16
16
|
chtypes/_abi2/_errors.py,sha256=wRE9M0oYtJz_9izQqpEBh5571M_1QzGWBoJ3pJTykWw,761
|
|
17
|
-
chtypes/_abi2/_loader.py,sha256=
|
|
18
|
-
chtypes/_abi2/_vocab.py,sha256=
|
|
17
|
+
chtypes/_abi2/_loader.py,sha256=VMWrbWMp9Uq3K-7a219lfqAmSmBlD2hcB6WDJgG8XG0,12514
|
|
18
|
+
chtypes/_abi2/_vocab.py,sha256=6UyJwWDnp_R59YMDF7ZWuLchVU7Sq8asmQChH21QEDw,14663
|
|
19
19
|
chtypes/_ocifetch/__init__.py,sha256=enfPOKkqP4kqAKqckBGWXN1OQsiYo9ngDP-wzG0zn2I,1484
|
|
20
20
|
chtypes/_ocifetch/_channel.py,sha256=aumM_S8X7_H2GXhaDZwoSTcg-m9_k4QSu5XTqSWZ6EQ,11836
|
|
21
21
|
chtypes/_ocifetch/_constants.py,sha256=UdOGIShDXaDP13NGbuftKZRE4u7VK8JfZmoeChw4GMU,5467
|
|
@@ -30,8 +30,8 @@ chtypes/_ocifetch/_lock.py,sha256=14_uex9qXdOht-5FSrSvFvd99-gB7DmI3bDuxXs4YU8,55
|
|
|
30
30
|
chtypes/_ocifetch/_oci.py,sha256=lmrlykbyQev55uFDn8UBwXyMLthd3-pQq3xIyfXCUXY,12704
|
|
31
31
|
chtypes/_ocifetch/_referrers.py,sha256=J2b4gN6vryz_IzYHxrd2Tp-tQO9Cz766rZtKgCVcKqA,6008
|
|
32
32
|
chtypes/_ocifetch/_unpack.py,sha256=Cn4-up63KL63L8pnkS5zwJ6VbbHPSigpCnmOdcHJ4RI,5609
|
|
33
|
-
chtypes-2.0.0.
|
|
34
|
-
chtypes-2.0.0.
|
|
35
|
-
chtypes-2.0.0.
|
|
36
|
-
chtypes-2.0.0.
|
|
37
|
-
chtypes-2.0.0.
|
|
33
|
+
chtypes-2.0.0.dev1.dist-info/METADATA,sha256=tGh0moOPb4CzqmGW2bt922V8NSKPje4Idmms1Lp5Nn4,10213
|
|
34
|
+
chtypes-2.0.0.dev1.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
35
|
+
chtypes-2.0.0.dev1.dist-info/entry_points.txt,sha256=TdNcluWBR0VOt5mVFROsp-NiVPAdR3EHo0UsHlMC0r0,50
|
|
36
|
+
chtypes-2.0.0.dev1.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
37
|
+
chtypes-2.0.0.dev1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|