Skip to content

Drive functions.py codegen from meos-idl.json#18

Draft
estebanzimanyi wants to merge 4 commits into
bump/meos-1.3from
refactor/codegen-meos-idl
Draft

Drive functions.py codegen from meos-idl.json#18
estebanzimanyi wants to merge 4 commits into
bump/meos-1.3from
refactor/codegen-meos-idl

Conversation

@estebanzimanyi
Copy link
Copy Markdown
Member

Replaces the regex-over-builder/meos.h parser in build_pymeos_functions.py with a JSON loader that consumes the IDL produced by MEOS-API. build_header.py keeps producing builder/meos.h for CFFI cdef compilation; only the wrapper-generation step now reads the structured catalog. Picks up 13 functions the regex silently dropped (meos_error, tfloat_avg_value, geo_get_srid, geog_from_binary, meos_basetype + family, temptype_subtype/_all, mfjson skiplist_make) and normalises meos_set_spatial_ref_sys_csv's argument from a raw const char* cast to an encoded str. json_object-bearing signatures are filtered out to match build_header.py's undefined-types skip. Stacks on bump/meos-1.3 (#17); IDL accuracy relies on MEOS-API #1 (the stdbool stub) being merged before the next regen.

Replaces the regex-over-builder/meos.h parser in
build_pymeos_functions.py with a JSON loader that consumes the IDL
produced by MEOS-API.  build_header.py keeps producing builder/meos.h
for CFFI cdef compilation; only the wrapper-generation step now reads
the structured catalog.  Picks up 13 functions the regex silently
dropped (meos_error, tfloat_avg_value, geo_get_srid, geog_from_binary,
meos_basetype + family, temptype_subtype/_all, mfjson skiplist_make)
and normalises meos_set_spatial_ref_sys_csv's argument from a raw
const char* cast to an encoded str.  json_object-bearing signatures
are filtered out to match build_header.py's undefined-types skip.
build_pymeos_functions.py used to carry two hardcoded sets enumerating
which params are extra Python returns (22 entries) and which accept
None (52 entries).  Both sets are now populated from the IDL's shape
field, which MEOS-API ships in meta/meos-meta.json so every binding
reads the same catalog.  result_parameters stays local because the
override (out-param replaces the bool return when truthy) is
PyMEOS-CFFI ergonomic, not a fact about the C API.  Re-vendoring the
IDL also picks up the missing outputArrays entries for
tpoint_as_mvtgeom, which previously took gsarr / timesarr as Python
lists rather than as out-parameters; the regenerated wrapper now
returns (result, gsarr, timesarr).
The previous build_pymeos_functions.py output_parameters set was
missing tpoint_as_mvtgeom's gsarr and timesarr entries, which made the
wrapper take both as user-facing list arguments rather than as output
parameters; the shape-driven consolidation corrects that and the
regenerated wrapper now returns (result, gsarr, timesarr).  The smoke
test now reflects on the wrapper's signature with inspect.signature so
the gsarr / timesarr parameters are asserted absent from the
user-facing arglist.  Also adds an explicit meos_initialize(None) call
to exercise the shape.nullable path for tz_str.
The previous attempt called meos_initialize(None) and immediately
meos_finalize() to exercise shape.nullable for tz_str; the
double-init / finalize cycle aborts with SIGABRT (exit 134) on Linux,
which masks the actual codegen signal.  Move the nullable check to
inspect.signature so the annotation is verified statically (the
parameter must accept None) and the live MEOS lifecycle stays a
single happy-path init/finalize.  tpoint_as_mvtgeom's
output-parameter regression guard is unchanged.
@estebanzimanyi estebanzimanyi force-pushed the refactor/codegen-meos-idl branch from ba735f0 to a888355 Compare May 19, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant