You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TableModel rejects int8/uint8 instance-key columns although the error message promises 'uint equivalents' (breaks aggregate/to_circles on uint8 labels) #1229
This whole message is AI-generated. The issue was automatically discovered and reported by an AI agent (Claude) during an autonomous bug hunt on the spatialdata code base. It has not been verified or triaged by a human yet; the needs: triage label is set so that a maintainer can confirm it. The reproduction script below was executed by the agent in an isolated environment (see Environment) and its output is pasted verbatim.
Summary
uint8/int8 instance ids raise TypeError: Only integer (int, np.int16, np.int32, np.int64, and uint equivalents), string ... allowed as dtype for instance_key column in obs. Dtype found to be uint8, while uint16/int64 pass.
Severity (agent's assessment): medium — Labels2DModel.parse(np.zeros(..., dtype=np.uint8)) is common, and aggregate(image, by=uint8_labels) / to_circles(uint8_labels) fail when the result table is built
Save as repro.py and run uv run repro.py (the PEP 723 header pins spatialdata to the commit the bug was found on; replace the URL fragment with @main to test the current main branch).
instance_id dtype uint8 : TypeError: Only integer (int, np.int16, np.int32, np.int64, and uint equivalents)...
instance_id dtype int8 : TypeError: Only integer (int, np.int16, np.int32, np.int64, and uint equivalents)...
instance_id dtype uint16: OK
instance_id dtype int64 : OK
aggregate(image, by=uint8 labels): TypeError Only integer (int, np.int16, np.int32, np.int64, and uint equivalents) ...
VERDICT: BUG REPRODUCED
Possible fix direction (unverified)
Replace the whitelist with np.issubdtype(d, np.integer) (plus pandas nullable integer dtypes if desired).
Environment
uv run repro.py with the PEP 723 metadata in the script (fresh, isolated environment; spatialdata built from main @ ccf1ea0 (2026-08-28); Python 3.13, latest releases of the dependencies at run time: pandas 3.0, anndata 0.13, zarr 3.3, dask 2026.8, numpy 2.5, geopandas 1.1, shapely 2.1). macOS (arm64). Also reproduced in a second environment with pandas 2.3.3 / anndata 0.12.11 / numpy 2.4.4 / zarr 3.2.1.
Automatically generated; discovered by an AI agent (Claude) and not yet reviewed by a human.
Note
This whole message is AI-generated. The issue was automatically discovered and reported by an AI agent (Claude) during an autonomous bug hunt on the
spatialdatacode base. It has not been verified or triaged by a human yet; theneeds: triagelabel is set so that a maintainer can confirm it. The reproduction script below was executed by the agent in an isolated environment (see Environment) and its output is pasted verbatim.Summary
uint8/int8instance ids raiseTypeError: Only integer (int, np.int16, np.int32, np.int64, and uint equivalents), string ... allowed as dtype for instance_key column in obs. Dtype found to be uint8, whileuint16/int64pass.Severity (agent's assessment): medium —
Labels2DModel.parse(np.zeros(..., dtype=np.uint8))is common, andaggregate(image, by=uint8_labels)/to_circles(uint8_labels)fail when the result table is builtWhere:
src/spatialdata/models/models.py::TableModel._validate_table_annotation_metadata(_INT_TYPES = [int, np.int16, np.uint16, np.int32, np.uint32, np.int64, np.uint64])Expected behaviour
All integer dtypes accepted.
Reproduction
Save as
repro.pyand runuv run repro.py(the PEP 723 header pinsspatialdatato the commit the bug was found on; replace the URL fragment with@mainto test the current main branch).Observed output
Possible fix direction (unverified)
Replace the whitelist with
np.issubdtype(d, np.integer)(plus pandas nullable integer dtypes if desired).Environment
uv run repro.pywith the PEP 723 metadata in the script (fresh, isolated environment;spatialdatabuilt frommain@ ccf1ea0 (2026-08-28); Python 3.13, latest releases of the dependencies at run time: pandas 3.0, anndata 0.13, zarr 3.3, dask 2026.8, numpy 2.5, geopandas 1.1, shapely 2.1). macOS (arm64). Also reproduced in a second environment with pandas 2.3.3 / anndata 0.12.11 / numpy 2.4.4 / zarr 3.2.1.Automatically generated; discovered by an AI agent (Claude) and not yet reviewed by a human.