Skip to content

S3 registration clean-up #925

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 2 commits into from
Mar 14, 2023
Merged

S3 registration clean-up #925

merged 2 commits into from
Mar 14, 2023

Conversation

hfrick
Copy link
Member

@hfrick hfrick commented Mar 13, 2023

closes #872

Most of the functions registered in .onLoad() were already registered in the regular way, receipts below. The autoplot() methods for model_fit and glmnet were not but since parsnip imports ggplot2, this PR switches this to "regular registration" as well.

Already registered in the regular way

@hfrick hfrick requested a review from simonpcouch March 13, 2023 14:37
Copy link
Contributor

@simonpcouch simonpcouch 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 linking to those existing tags, saved me a good amount of time in review.

For posterity:

vctrs::s3_register() docs seem to indicate this is a good move for us. I also poked around blames here for a bit, and

  • For the tidier methods, it seems like this pattern first existed only because we previously registered the s3 methods against broom's generic, which was neither Imported nor Suggested at the time.
  • As for autoplot, this commit justified the usage of s3_register() with "glmnet is not a formal dependency"—while the autoplot method is for the class that glmnet defines, we don't actually use any glmnet machinery in its internals.

Goodbye, unneeded complexity!💭

@hfrick hfrick merged commit ba1adf7 into main Mar 14, 2023
@hfrick hfrick deleted the s3-registration branch March 14, 2023 09:42
@github-actions
Copy link

This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Register S3 methods for generics in imported packages _not_ via vctrs
2 participants