Skip to content

Commit 6cf47df

Browse files
committed
fix: unconditionally set attributes in guidata.dataset for compatibility with in-development versions
1 parent 1df29c2 commit 6cf47df

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

‎src/runtime/_guidata_jsonschema_shim.py‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,14 @@ def _get_item(instance: gdt.DataSet, name: str) -> gdt.DataItem:
724724
# the helpers defined above on the ``guidata.dataset`` namespace so that
725725
# ``from guidata.dataset import dataset_to_schema_with_values`` works
726726
# unchanged inside ``bootstrap.py``.
727+
#
728+
# We install unconditionally (overriding any same-named attribute already
729+
# present on ``guidata.dataset``): an in-development ``guidata`` may expose
730+
# a leaner version of these helpers (e.g. a ``FloatArrayItem`` export
731+
# without the ``x-guidata-variable-size`` / ``x-guidata-minmax`` hints the
732+
# browser array editor needs). This backport is the source of truth until
733+
# a released ``guidata`` reaches parity (see ``removableFrom`` in the shim
734+
# registry); only then should this whole module be dropped.
727735
import guidata.dataset as _gds_pkg # noqa: E402 # late import on purpose
728736

729737
for _name in (
@@ -734,7 +742,6 @@ def _get_item(instance: gdt.DataSet, name: str) -> gdt.DataItem:
734742
"JSON_SCHEMA_DIALECT",
735743
"SCHEMA_VERSION",
736744
):
737-
if not hasattr(_gds_pkg, _name):
738-
setattr(_gds_pkg, _name, globals()[_name])
745+
setattr(_gds_pkg, _name, globals()[_name])
739746

740747
del _gds_pkg, _name

0 commit comments

Comments
 (0)