Skip to content
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

fix: migrate by default #1509

Merged
merged 2 commits into from
Jan 27, 2025
Merged

fix: migrate by default #1509

merged 2 commits into from
Jan 27, 2025

Conversation

gadomski
Copy link
Member

@gadomski gadomski commented Jan 27, 2025

Related Issue(s):

Description:

With increased heterogeneity of extensions in the ecosystem, especially breaking changes like proj v2, there's more and more schema allowed in a valid STAC value. Handling these in pystac is ... tricky.

On read+load, pystac has the concept of "migration", where fields on STAC objects and in STAC extensions are moved around and updated to the latest versions. Migration is currently ON by default when using from_file:

o = cls.from_dict(d, href=href, migrate=True, preserve_dict=False)

However, it is OFF by default when using from_dict:

migrate: bool = False,

This inconsistent behavior is confusing to users (and, tbh, developers). We should align on one. As discussed in #1504, defaulting to migrate=True seems like the best idea for the ecosystem generally.

PR Checklist:

  • Pre-commit hooks and 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.

@gadomski gadomski requested a review from jsignell January 27, 2025 12:47
@gadomski gadomski self-assigned this Jan 27, 2025
Copy link

codecov bot commented Jan 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.47%. Comparing base (21a0bbb) to head (bb686ab).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1509   +/-   ##
=======================================
  Coverage   91.47%   91.47%           
=======================================
  Files          54       54           
  Lines        7520     7520           
  Branches      910      910           
=======================================
  Hits         6879     6879           
  Misses        457      457           
  Partials      184      184           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@jsignell jsignell left a comment

Choose a reason for hiding this comment

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

Nice!

@gadomski gadomski added this pull request to the merge queue Jan 27, 2025
Merged via the queue into main with commit 95aa480 Jan 27, 2025
23 checks passed
@gadomski gadomski deleted the issues/1504-migrate-by-default branch January 27, 2025 15:13
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.

Migrate by default
2 participants