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

Autoload epidatasets as a dependency rather than reexporting epidatasets data #577

Merged
merged 5 commits into from
Dec 13, 2024

Conversation

nmdefries
Copy link
Contributor

@nmdefries nmdefries commented Dec 6, 2024

Checklist

Please:

  • Make sure this PR is against "dev", not "main" (unless this is a release
    PR).
  • Request a review from one of the current main reviewers:
    brookslogan, nmdefries.
  • Makes sure to bump the version number in DESCRIPTION. Always increment
    the patch version number (the third number), unless you are making a
    release PR from dev to main, in which case increment the minor version
    number (the second number).
  • Describe changes made in NEWS.md, making sure breaking changes
    (backwards-incompatible changes to the documented interface) are noted.
    Collect the changes under the next release number (e.g. if you are on
    1.7.2, then write your changes under the 1.8 heading).
  • See DEVELOPMENT.md for more information on the development
    process.

Change explanations for reviewer

Magic GitHub syntax to mark associated Issue(s) as resolved when this is merged into the default branch

  • Resolves #{issue number}

@nmdefries nmdefries requested a review from brookslogan December 6, 2024 23:44
@brookslogan
Copy link
Contributor

Could you give an overview of the pros/cons of this change? I think I ended up adjusting things trying to make checks run over in #564, but I remember feeling forced into some approach to satisfy both R CMD CHECK and pkgdown checks simultaneously, and don't remember how that approach ended up "feeling". Does CRAN suggest against Depends:?

@nmdefries
Copy link
Contributor Author

Pros for this change:

  • matches the approach used in epipredict
  • from experience with epipredict, speeds up documenting
  • don't need to redocument this package whenever epidatasets changes

Cons:

  • Adds a Depends:
  • "if your package relies on a package A which itself "Depends" on another package B, your package will likely need to attach A with a "Depends" directive. This is because the functions in package A were written with the expectation that package B and its functions would be attached to the search() path" source ("likely"?). This is old and not mentioned in the R Packages book, so unclear if this is a theoretical or perhaps resolved issue. I haven't found additional information yet.

Neutrals:

  • Depends are considered less safe than Imports because of possible name collisions in the search path. This is very unlikely to impact us; the data objects we are making available have fairly long and specific names.

No specific guidelines about Depends vs Imports in the CRAN policies.

@brookslogan
Copy link
Contributor

brookslogan commented Dec 13, 2024

Thanks for recording this!

Notes:

"if your package relies on a package A which itself "Depends" on another package B, your package will likely need to attach A with a "Depends" directive. This is because the functions in package A were written with the expectation that package B and its functions would be attached to the search() path" source ("likely"?). This is old and not mentioned in the R Packages book, so unclear if this is a theoretical or perhaps resolved issue. I haven't found additional information yet.

  • I'd be very surprised if this is the case. They say that '''An "Imports" directive will load but not attach package A and will neither load nor attach package B.''', but the whole thing with Depends: is that simply loading (not attaching) a package with attach its Depends: packages; I don't know why the behavior would be changed simply because it was transitively loaded via Imports: of another package.

Depends are considered less safe than Imports because of possible name collisions in the search path. This is very unlikely to impact us; the data objects we are making available have fairly long and specific names.

Right, I doubt we are going to have name collisions. Just maybe some annoying junk in completion options.

Copy link
Contributor

@brookslogan brookslogan left a comment

Choose a reason for hiding this comment

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

  • todo: resolve merge conflicts. Probably at least version number and where the NEWS entry goes because we did a 0.10.0 release for the workshop.

@nmdefries nmdefries merged commit 0613150 into dev Dec 13, 2024
@nmdefries nmdefries deleted the ndefries/use-but-not-reexport-epidatasets branch December 13, 2024 18:12
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.

2 participants