Skip to content

Make item pickle smaller#1285

Merged
jsignell merged 3 commits into
stac-utils:mainfrom
jsignell:pickling
Dec 12, 2023
Merged

Make item pickle smaller#1285
jsignell merged 3 commits into
stac-utils:mainfrom
jsignell:pickling

Conversation

@jsignell
Copy link
Copy Markdown
Member

@jsignell jsignell commented Dec 4, 2023

Related Issue(s):

Description:

Not totally sure if this is a good idea, but I figured a PR would be a good place to hash that out. The only limitation I can see is that if you have a resolved target object on your link, it will not be resolved with you roundtrip it to pickle and back.

PR Checklist:

  • pre-commit hooks pass locally
  • 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.

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 4, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c5a79c7) 91.11% compared to head (156ae44) 91.12%.
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1285      +/-   ##
==========================================
+ Coverage   91.11%   91.12%   +0.01%     
==========================================
  Files          51       51              
  Lines        6986     6994       +8     
  Branches      999     1001       +2     
==========================================
+ Hits         6365     6373       +8     
  Misses        444      444              
  Partials      177      177              

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

Copy link
Copy Markdown
Member

@gadomski gadomski left a comment

Choose a reason for hiding this comment

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

The only limitation I can see is that if you have a resolved target object on your link, it will not be resolved with you roundtrip it to pickle and back.

This feels like the right behavior -- you (theoretically) can always re-resolve the object later. I'm ok with this change, but I'm not the target user here -- is there anyone that uses pystac in Dask-land that can verify that things are better w/ this fix. Maybe @TomAugspurger?

Copy link
Copy Markdown
Collaborator

@TomAugspurger TomAugspurger left a comment

Choose a reason for hiding this comment

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

Won't have time to test this out for real, but in general I've found len(pickle.dumps(obj)) to be a good enough test for fixes like this.

Comment thread pystac/item.py Outdated
@jsignell jsignell added this pull request to the merge queue Dec 12, 2023
Merged via the queue into stac-utils:main with commit 8d03733 Dec 12, 2023
@jsignell jsignell deleted the pickling branch December 12, 2023 13:26
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