GEOPY-2739: Accept BaseUIJson in the start of driver#860
GEOPY-2739: Accept BaseUIJson in the start of driver#860domfournier wants to merge 26 commits intodevelopfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the UI JSON model naming by renaming the core BaseUIJson class to UIJson, and adjusts tests/imports accordingly to match the new API surface.
Changes:
- Rename
BaseUIJsontoUIJsoningeoh5py.ui_json.ui_json. - Update UI JSON tests to subclass/use
UIJsoninstead ofBaseUIJson. - Update the
geoh5py.ui_jsonpackage export to re-exportUIJson.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| geoh5py/ui_json/ui_json.py | Renames the core model class and updates read() logic/type hints to reference UIJson. |
| geoh5py/ui_json/init.py | Switches the package-level export from BaseUIJson to UIJson. |
| tests/ui_json/uijson_test.py | Updates tests to use UIJson for subclassing/reading. |
| tests/ui_json/forms_test.py | Updates helper test model to subclass UIJson. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
geoh5py/ui_json/ui_json.py
Outdated
| @classmethod | ||
| def read(cls, path: str | Path) -> BaseUIJson: | ||
| def read(cls, path: str | Path) -> UIJson: |
There was a problem hiding this comment.
read can return an instance of a subclass when called as MyUIJson.read(...), but the return type is annotated as UIJson. This makes the public API typing inaccurate and can cause mypy/IDE issues. Consider typing it as Self (e.g., cls: type[Self] -> Self) or using overloads to express the UIJson vs subclass behavior.
geoh5py/ui_json/ui_json.py
Outdated
| """ | ||
| Create a UIJson object from ui.json file. | ||
|
|
There was a problem hiding this comment.
The read method docstring still mentions BaseUIJson (a name that no longer exists after this rename). Please update the wording to UIJson (or remove the class-name reference) so the documentation matches the current API.
|
|
||
| class BaseUIJson(BaseModel): | ||
| class UIJson(BaseModel): | ||
| """ | ||
| Base class for storing ui.json data on disk. | ||
|
|
There was a problem hiding this comment.
Renaming BaseUIJson to UIJson and removing the old symbol is a breaking public API change (it was previously importable from geoh5py.ui_json). If backward compatibility is expected, consider keeping BaseUIJson as a deprecated alias of UIJson (and optionally emitting a DeprecationWarning) to avoid breaking downstream imports.
| from .validation import InputValidation | ||
| from .forms import BaseForm | ||
| from .ui_json import BaseUIJson | ||
| from .ui_json import UIJson |
There was a problem hiding this comment.
This change drops the BaseUIJson re-export from geoh5py.ui_json, which is a breaking import for external callers (from geoh5py.ui_json import BaseUIJson). If the rename is intended, consider re-exporting a deprecated BaseUIJson alias alongside UIJson, or ensure the project versioning/release notes explicitly cover the breaking change.
| from .ui_json import UIJson | |
| from .ui_json import UIJson | |
| # Backwards-compatible alias: BaseUIJson was renamed to UIJson. | |
| # External callers may still import BaseUIJson from geoh5py.ui_json. | |
| BaseUIJson = UIJson |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #860 +/- ##
===========================================
+ Coverage 91.18% 91.28% +0.10%
===========================================
Files 115 112 -3
Lines 10298 10317 +19
Branches 1901 1900 -1
===========================================
+ Hits 9390 9418 +28
+ Misses 485 474 -11
- Partials 423 425 +2
🚀 New features to boost your workflow:
|
for more information, see https://pre-commit.ci
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
for more information, see https://pre-commit.ci
# Conflicts: # geoh5py/ui_json/annotations.py # geoh5py/ui_json/forms.py # geoh5py/ui_json/validations/form.py
…tion # Conflicts: # geoh5py/shared/utils.py # geoh5py/ui_json/annotations.py # geoh5py/ui_json/forms.py # geoh5py/ui_json/ui_json.py
# Conflicts: # geoh5py/ui_json/ui_json.py # geoh5py/ui_json/validations/form.py
…into GEOPY-2739 # Conflicts: # geoh5py/ui_json/ui_json.py # geoh5py/ui_json/validations/__init__.py # geoh5py/ui_json/validations/uijson.py
# Conflicts: # geoh5py/ui_json/ui_json.py # geoh5py/ui_json/validations/__init__.py # geoh5py/ui_json/validations/uijson.py # tests/ui_json/uijson_test.py
GEOPY-2739 - Accept BaseUIJson in the start of driver