Skip to content

Regenerate against MEOS 1.3 stable + add PR build validation#17

Open
estebanzimanyi wants to merge 11 commits into
masterfrom
bump/meos-1.3
Open

Regenerate against MEOS 1.3 stable + add PR build validation#17
estebanzimanyi wants to merge 11 commits into
masterfrom
bump/meos-1.3

Conversation

@estebanzimanyi
Copy link
Copy Markdown
Member

Refresh the vendored builder/meos.h against the actual MEOS 1.3 stable release (the existing 1.3.0a1 snapshot predated the 1.3.0 tag). Picks up rtree builders, type-specific tfloatbox/tintbox helpers replacing tbox_expand/shift_scale, intspan_expand and floatspan_expand replacing numspan_expand, tbox_hash and tbox_hash_extended, temporal_segm_duration, tnumber_avg_value, tnumber_trend, temporal_before/after_timestamptz, text_in, float8_out, int32_cmp, int64_cmp, plus geo helpers (box3d_make/out, gbox_make, geo_points, geo_pointarr, geom_intersection2d_coll, geom_min_bounding_radius), and drops geog_from_binary. textset_make_modifier extended to handle MEOS 1.3 dropping the const qualifier on textset_make's values pointer. Also adds a pr_build.yml workflow that derives the target MEOS branch from version in pymeos_cffi/init.py and builds the sdist + smoke-tests CFFI on ubuntu-latest, macos-13, macos-14 so future header bumps get end-to-end validation before tagging.

Refresh the vendored builder/meos.h against MEOS 1.3 stable
(/tmp/meos-1.3 built from upstream/stable-1.3) and re-run the
codegen pipeline.  Picks up the public API additions and renames
that landed between the previous 1.3.0a1 snapshot and the actual
1.3.0 release: rtree builders (intspan/bigintspan/floatspan/
datespan/tstzspan/tbox/stbox + rtree_free/insert/search), the
type-specific box helpers (tfloatbox_expand/shift_scale,
tintbox_expand/shift_scale replacing tbox_expand/shift_scale
suffixed by float/int), span expand split (intspan_expand and
floatspan_expand replacing numspan_expand), tbox_hash and
tbox_hash_extended, temporal_segm_duration, tnumber_avg_value,
tnumber_trend, temporal_before/after_timestamptz, text_in,
float8_out, int32_cmp, int64_cmp, plus geo helpers (box3d_make/
out, gbox_make, geo_points, geo_pointarr, geom_intersection2d_coll,
geom_min_bounding_radius).  Drops geog_from_binary.  Signature
changes: minus_date_date now returns int (was Interval *), several
helpers take const qualifiers (geo_transform, geom_buffer,
geom_unary_union), and the geo_geoN -> geo_geo_n rename.

textset_make_modifier extended to handle both `const text **`
and `text **` parameter shapes since MEOS 1.3 dropped the const
qualifier on textset_make's values pointer.

Version bumped to 1.3.0a2.
The existing build_pymeos_cffi.yml only triggers on tag pushes
(releases).  Bumping the vendored meos.h and regenerating the
codegen output needs end-to-end build validation before tagging,
or regressions like signature mismatches reach a release.

PR build workflow derives the target MEOS branch from
__version__ in pymeos_cffi/__init__.py (e.g. 1.3.0a2 -> stable-1.3,
falling back to master if the stable-X.Y branch does not exist),
clones+installs MEOS from that branch on Ubuntu, macOS-13 (x86)
and macOS-14 (arm64), builds the sdist, installs it, and smoke-
tests by initialising MEOS and asserting a representative
function resolves.  Cancellation concurrency keyed on the branch
so a force-push abandons stale runs.
MEOS 1.3's reentrant GEOS API surfaces geos_get_context returning
GEOSContextHandle_t, which is a forward-declared opaque type from
geos_c.h that the cdef does not (and should not) try to materialise.
Adding GEOSContextHandle_t alongside json_object in undefined_types
makes build_header.py comment the signature out, the same treatment
already applied to mfjson constructors.  Without it, pip install fails
with cffi.CDefError: cannot parse "extern GEOSContextHandle_t
geos_get_context(void);".
Commit 841c9e8 regenerated builder/meos.h against a local MEOS install
that was ahead of stable-1.3 (the branch CI actually checks out), which
introduced references to MeosArray, MeosType and RTreeSearchOp that
the installed library does not declare and made the Linux and
macOS-14 builds fail with undefined-type errors during the cffi
wheel compile.  The build_header.py change in 841c9e8 stays in place
so the GEOS handle stub still applies when MEOS later acquires
geos_get_context, but the cdef header is brought back to the
stable-1.3 view that build_header.py produced two commits earlier.
These two gaps were keeping PyMEOS PR #72 (the 1.3 bump) at ~195
failures. With them in place the test count is 4472 passed / 10
failed; the remaining 10 are pre-existing test fixture issues
unrelated to the bump.

The is_output_parameter heuristic for trailing int *count was
comparing parameter.ptype against a literal *' suffix, which never
matched once cffi formatting moved the closing quote inside the
Annotated[...] string. Switched the check to compare the raw ctype
so tbool_values / tfloat_values / tint_values / tgeo_values etc. now
return (array, count) tuples instead of forcing count as an input.

Added float_to_datum / int_to_datum Python-side helpers using the
cffi reinterpret-cast pattern (no need for libmeos to export
Float8GetDatum), and four typed wrappers (tbox_expand_float /
tbox_expand_int / tbox_shift_scale_float / tbox_shift_scale_int)
that delegate to tbox_expand_value / tbox_shift_scale_value. MEOS
1.3 already exposed the Datum-shaped functions; these helpers
restore the typed call shape that pre-1.3 PyMEOS callers depend on.
The 1.3 codegen wraps long lines via formatter post-processing, not
during emission. ruff format restores the canonical line lengths so
the Lint workflow passes.
The templates use double-quoted strings; __init__.py was previously
in mixed-quote form. ruff format normalises both, which the
Check format CI step enforces.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant