Skip to content

Add collection to ExtensionManagementMixin type params where appropriate #547

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

Conversation

jisantuc
Copy link
Contributor

@jisantuc jisantuc commented Jul 9, 2021

Related Issue(s): #525

Description: This PR adds pystac.Collection to the ExtensionManagementMixin type params (via a Union) for all extensions that provide concrete implementations of SummariesExtension.

PR Checklist:

  • Code is formatted (run pre-commit run --all-files)
  • Tests pass (run scripts/test)
  • Documentation has been updated to reflect changes, if applicable
  • This PR maintains or improves overall codebase code coverage.
  • Changes are added to the CHANGELOG. See the docs for information about adding to the changelog.

jisantuc added 5 commits July 8, 2021 14:53
It isn't necessarily the case that the extensions in question can be
applied to collections (in the sense that their fields mean anything
on collection properties) but they _can_ show up in summaries (inferred
from th presence of `SummariesFooExtension`).
@codecov-commenter
Copy link

codecov-commenter commented Jul 9, 2021

Codecov Report

Merging #547 (bb42277) into main (073aad2) will increase coverage by 0.05%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #547      +/-   ##
==========================================
+ Coverage   94.27%   94.33%   +0.05%     
==========================================
  Files          71       71              
  Lines       10290    10378      +88     
  Branches     1077     1085       +8     
==========================================
+ Hits         9701     9790      +89     
+ Misses        420      419       -1     
  Partials      169      169              
Impacted Files Coverage Δ
pystac/extensions/eo.py 94.41% <100.00%> (+0.07%) ⬆️
pystac/extensions/label.py 93.73% <100.00%> (+0.05%) ⬆️
pystac/extensions/projection.py 98.52% <100.00%> (+0.03%) ⬆️
pystac/extensions/raster.py 89.85% <100.00%> (+0.47%) ⬆️
pystac/extensions/sat.py 100.00% <100.00%> (ø)
pystac/extensions/scientific.py 95.09% <100.00%> (+0.09%) ⬆️
pystac/extensions/timestamps.py 100.00% <100.00%> (ø)
pystac/extensions/view.py 98.42% <100.00%> (+0.03%) ⬆️
tests/extensions/test_eo.py 100.00% <100.00%> (ø)
tests/extensions/test_label.py 97.15% <100.00%> (+0.07%) ⬆️
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 073aad2...bb42277. Read the comment docs.

@jisantuc jisantuc changed the title Add collectin to ExtensionManagementMixin type params where appropriate Add collection to ExtensionManagementMixin type params where appropriate Jul 9, 2021
Copy link
Contributor

@duckontheweb duckontheweb left a comment

Choose a reason for hiding this comment

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

This looks great, thanks for getting it in!

Originally I was thinking we should add test cases for using add_to and remove_from on Collection instances to make sure it actually works at runtime, but I'm pretty confident that we are covering our bases with the typing. What do you think @jisantuc?

@jisantuc
Copy link
Contributor Author

jisantuc commented Jul 9, 2021

How to test was going to be my next question -- conditions are:

  1. runs without crashing
  2. adds the URI appropriately

?

@duckontheweb
Copy link
Contributor

How to test was going to be my next question -- conditions are:

  1. runs without crashing
  2. adds the URI appropriately

?

Yeah, and:
3. remove_from removes the URI

@jisantuc
Copy link
Contributor Author

jisantuc commented Jul 9, 2021

Done in 6fb98fd and b6b2bf8 -- now with a .05% coverage improvement! 🌶

@duckontheweb
Copy link
Contributor

Done in 6fb98fd and b6b2bf8 -- now with a .05% coverage improvement! 🌶

Yeehaw!

@jisantuc jisantuc requested a review from duckontheweb July 9, 2021 17:41
Copy link
Contributor

@duckontheweb duckontheweb left a comment

Choose a reason for hiding this comment

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

Looks good overall.

I'm curious to get other input on how we handle automatically adding schema URIs to objects when summarizing (see review comment for more detail) before merging.

@jisantuc jisantuc requested a review from duckontheweb July 12, 2021 16:24
@jisantuc jisantuc requested a review from lossyrob July 12, 2021 16:24
Copy link
Contributor

@duckontheweb duckontheweb left a comment

Choose a reason for hiding this comment

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

Awesome, thanks for getting this in!

@duckontheweb duckontheweb linked an issue Jul 12, 2021 that may be closed by this pull request
@duckontheweb duckontheweb added this to the 1.0.0 milestone Jul 12, 2021
@duckontheweb duckontheweb merged commit f443f6a into stac-utils:main Jul 12, 2021
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.

EO extension can't be added to Collections
5 participants