-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactors architecture to better enable STAC 1.0 extension changes #309
Conversation
cde0c68
to
d531cc2
Compare
Codecov Report
@@ Coverage Diff @@
## main #309 +/- ##
=======================================
Coverage ? 88.60%
=======================================
Files ? 36
Lines ? 4625
Branches ? 0
=======================================
Hits ? 4098
Misses ? 527
Partials ? 0 Continue to review full report at Codecov.
|
75a8c21
to
f2f7242
Compare
f2f7242
to
c78f832
Compare
Introdues "ExtensionHooks" which are not necessary for an extension but are registered if the extension needs to modify the behavor of PySTAC in it's processes. The two places extensions can currently hook into are during object resolution, where they can add link reltypes that indicate STACObject links based on the extension; also migration - the logic for migrating extensions will be moved from the migrate subpackage to each extension itself.
Still a work in progress.
This way we can avoid migrating them
This extension is in transition - there's upcoming work to either remove this extension or transfer it to be based on ItemCollections. Removing it for now to remove maintenance burden.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new stac_io
stuff makes sense and looks good to me. I did my best to go through each file's functional changes but it was hard to differentiate formatting/typing changes from the real deal; no obvious WTFs so 👍🏽 .
I will make one comment that's more of a STAC issue than a PySTAC issue, but I still don't love when I see, e.g., get_children
returning Catalog
s. I understand (I think) why Collection
does not inherit from Catalog
in the spec but it does here in pystac, and I don't think it matters for the vast majority of users, but it still scans funny during a review. Don't know what the answer is though (without adding like a Container
supertype that encompasses both Catalog
s and Collections
s and then we're just spamming types).
@gadomski I believe we can solve that issue via types by using def get_children(self): Iterable[Union[Catalog, Collection]]:
... which doesn't mean a lot for the type checker since Collection inherits from Catalog, but would be more clear to a user. Would that resolve the issue you brought up around the get_children confusion? If so I'll make that change to all of the child methods on Catalog. |
In that case, yes -- I think there were some other cases where you did a |
This makes it more explicit that children are either a Catalog or a Collection, even though in PySTAC a Collection inherits from a Catalog.
…tors While resolving merge conflicts, reorder imports and make slight edits to docstring text for consistency
This all looks good to me, although I primarily looked through the STAC_IO changes. I'm not sure I understand the value in deprecating the STAC_IO class though. None of those functions will ever be called by the new code, and if someone overrides a function like before they won't get an deprecation warning or anything. Is there value in keeping the code around? Also, I'm not found of the file being I might have some more feedback when updating pystac-client, but see no reason to not merge this, and I'll get pystac-client working with the main branch in the next few days. |
I've definitely used
I think this does follow the convention? e.g. MediaType and Let me know what you think on the above two points; if it makes sense to merge as-is I'll do that once you give a final +1 |
@lossyrob Also, you are right on the convention, in fact it didn't follow the standard Python convention for Class naming using CapWords before, so carry on. +1! |
SoundsGoodToMe :-) |
Related Issue(s): #306
Description:
This PR will contain work to refactor some core architectural pieces in preparation for the STAC 1.0 release. One of the most disruptive changes is that Extensions were moved off of a distinction between "core" and custom extensions, and the usage of a short ID in the
stac_extensions
field has been removed in favor of identifying extensions only by their JSON schema URL. PySTAC use these IDs as a core component of how it handled extensions, and so this will need to change significantly moving forward. After discussions with some other PySTAC developers and users, it also became clear that the current extension implementation is complex and clunky. I believe now's a good time to rethink how we're doing extensions, and performing a few core refactors of PySTAC prior to the 1.0 release that should make things more simple and better suited to the most recent version of the spec.I'm putting up a WIP PR early to let folks know what's happening and elicit any feedback as this work occurs. My plan is to approach the work like this:
Left TODO -
Docstring/Documentation updates, as well as bringing test coverage back up to 93% and some additional implementations/fixes for Collection/Catalog summaries and extensions are encapsulated in issues and left to follow up work.
Extensions have a new API, e.g.
is now
PR Checklist:
scripts/format
)scripts/test
)Fixes #293
Fixes #308
Fixes #311
Fixes #313
Fixes #316
Fixes #266
Fixes #260
Fixes #242
Fixes #205
Fixes #132
Fixes #30