Skip to content

GEOPY-2731#951

Open
domfournier wants to merge 20 commits into
developfrom
GEOPY-2731
Open

GEOPY-2731#951
domfournier wants to merge 20 commits into
developfrom
GEOPY-2731

Conversation

@domfournier

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings July 16, 2026 20:29
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.33333% with 17 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@a2e2ebd). Learn more about missing BASE report.
⚠️ Report is 11 commits behind head on develop.

Files with missing lines Patch % Lines
geoh5py/ui_json/ui_json.py 75.40% 9 Missing and 6 partials ⚠️
geoh5py/shared/entity_container.py 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             develop     #951   +/-   ##
==========================================
  Coverage           ?   91.04%           
==========================================
  Files              ?      129           
  Lines              ?    10905           
  Branches           ?     1996           
==========================================
  Hits               ?     9929           
  Misses             ?      514           
  Partials           ?      462           
Files with missing lines Coverage Δ
geoh5py/groups/uijson.py 97.05% <100.00%> (ø)
geoh5py/ui_json/__init__.py 100.00% <100.00%> (ø)
geoh5py/ui_json/forms.py 92.66% <100.00%> (ø)
geoh5py/ui_json/validation.py 85.11% <100.00%> (ø)
geoh5py/shared/entity_container.py 93.25% <50.00%> (ø)
geoh5py/ui_json/ui_json.py 84.40% <75.40%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the UI JSON core model by renaming BaseUIJson to UIJson, extending serialization / IO to support in-memory BytesIO, and updating tests and validation typing accordingly. It also adjusts how UI JSON can be converted into a UIJsonGroup and broadens form inference strictness to include string values.

Changes:

  • Rename the core UI JSON model from BaseUIJson to UIJson and update tests/imports accordingly.
  • Add serialize() plus BytesIO support for read() / write(), and enable attaching the generated UI JSON as FilenameData on entities.
  • Update UI group creation (to_ui_json_group) option handling and relax a form-type filtering check to treat str values as “strict”.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/ui_json/uijson_test.py Updates tests to use UIJson and adjusts assertions around to_ui_json_group() output.
tests/ui_json/forms_test.py Updates form setup helper test to use UIJson instead of BaseUIJson.
geoh5py/ui_json/validation.py Updates type hints / TYPE_CHECKING imports to reference UIJson.
geoh5py/ui_json/ui_json.py Renames the core model, adds serialize(), BytesIO IO paths, updates to_ui_json_group(), and changes demotion behavior in set_values().
geoh5py/ui_json/forms.py Expands strict type-checking filter to include strings.
geoh5py/ui_json/init.py Updates package exports to re-export UIJson (previously BaseUIJson).
geoh5py/shared/entity_container.py Extends add_file to accept BytesIO input.
.gitignore Trailing whitespace-only change.
Comments suppressed due to low confidence (1)

geoh5py/shared/entity_container.py:147

  • The TypeError message is now misleading: add_file also accepts raw bytes, but the error message only mentions “path or BytesIO”. Update it to reflect the accepted types.
            raise TypeError(
                f"Input file must be a path or BytesIO object, not {type(file)}"
            )

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread geoh5py/ui_json/ui_json.py
Comment thread geoh5py/ui_json/ui_json.py
Comment thread geoh5py/ui_json/ui_json.py
Comment thread geoh5py/ui_json/__init__.py

@benk-mira benk-mira left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. Couple suggestions/questions. What's the plan to roll this out so that we don't break every package referring to BaseUIJson?

Comment thread geoh5py/ui_json/ui_json.py Outdated
if validate:
return ui_json_class(**kwargs)
else:
return ui_json_class.model_construct(**kwargs) # type: ignore[return-value, arg-type]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surprised to see in issue with 'return-value', is it not recognizing Self?


def serialize(self, mode: Literal["json", "python", "str"] | str = "python"):
"""
Return a demoted uijson dictionary representation the params data.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Return a demoted uijson dictionary representation the params data.
Return a demoted dictionary representation of the uijson data.


return uijson

def serialize(self, mode: Literal["json", "python", "str"] | str = "python"):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def serialize(self, mode: Literal["json", "python", "str"] | str = "python"):
def serialize(self, mode: Literal["json", "python", "str"] | str = "python") -> dict | str:


return self.model_dump(exclude_unset=True, by_alias=True, mode=mode)

def to_file_data(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def to_file_data(
def attach_file_data(

return self.model_dump(exclude_unset=True, by_alias=True, mode=mode)

def to_file_data(
self, entity: EntityContainer, name: str | None = None

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, don't think I knew about EntityContainter. It's generic to Objects and Groups?

)

uijson_copy = self.set_values(
copy=True, **{"geoh5": geoh5, "out_group": out_group}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get it.. If self.out_group is not None, this will serialize out_group as a blank UUID instead of existing out_group Form?

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.

3 participants