Skip to content

feat: Support pickling #641

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

Merged
merged 3 commits into from
Mar 24, 2025
Merged

feat: Support pickling #641

merged 3 commits into from
Mar 24, 2025

Conversation

jrycw
Copy link
Collaborator

@jrycw jrycw commented Mar 18, 2025

Fixes: #640

This PR adds support for pickling GT. The __getnewargs__ method is relatively new to me, but the implementation appears to be straightforward.

Edit: Based on the error message, it seems that providing only the data= parameter is sufficient, but I'm unsure if the other three parameters—auto_align=, rowname_col=, and groupname_col=—are also required.

Copy link

codecov bot commented Mar 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.19%. Comparing base (e01e682) to head (450facc).
Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #641   +/-   ##
=======================================
  Coverage   91.18%   91.19%           
=======================================
  Files          47       47           
  Lines        5458     5460    +2     
=======================================
+ Hits         4977     4979    +2     
  Misses        481      481           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@machow
Copy link
Collaborator

machow commented Mar 21, 2025

@malcolmbarrett any chance you might be able to install and check if this does what you need?

@malcolmbarrett
Copy link

Works great for me! Thanks to you both

@@ -283,7 +283,10 @@ def __init__(
rowname_col: str | None = None,
groupname_col: str | None = None,
):
pass
self._data = data
Copy link
Collaborator

Choose a reason for hiding this comment

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

I feel like this __init__ quirk is related to how I put __new__ in, but I'm not totally sure how to fix it 😅

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@machow, thanks for the feedback! I think returning self._d for __getnewargs__ might be a more correct approach.

Copy link
Collaborator

@machow machow left a comment

Choose a reason for hiding this comment

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

LGTM Thanks for this! It might be worth taking a look at how __new__ is used here down the road, which was definitely probably my screw up..!

@machow machow merged commit 6779205 into posit-dev:main Mar 24, 2025
14 checks passed
@jrycw jrycw deleted the feat-pickle branch March 24, 2025 17:24
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.

Support pickling
3 participants