Repository navigation
Declare S7 imports and update package hooks - #107
Conversation
|
Thanks for maintaining marquee! I'm planning to submit the next version of S7 to CRAN on November 16 (see RConsortium/S7#786). Would you be able to merge these compatibility changes and submit an updated version of marquee to CRAN before then? Please let me know if you need more time or if there’s anything I can help with. |
|
Thanks for putting this together! Sorry it took some time to get to... However, I've run into one issue when testing locally with S7 0.2.0 (current CRAN): the PR introduces an unsuppressible startup message. Reprex, with this branch installed: suppressPackageStartupMessages(library(marquee))
#> Overwriting method merge_element(<ggplot2::element_text>, S3<element_marquee>)On main, the message does not appear. Because the message is emitted with Do you have any advice for how to approach this? |
I think your issue might be similar as I had in ggarrow, where we both dynamically register S7 methods in Lines 239 to 252 in 3a12ffc The solution I had was removing the |
marquee registers its merge_element() method at load time inside rlang::on_load(). The fallback registered it again with released S7, causing an overwrite message and an R CMD check NOTE. Removing the fallback restores the previous behavior while retaining S7_on_load() when available.
|
Thanks @thomasp85 for testing and @teunbrand for the diagnosis. marquee does something a little different from most packages: it doesn't call The change I pushed looks like this: .onLoad <- function(...) {
run_on_load()
if ("S7_on_load" %in% getNamespaceExports("S7")) {
getExportedValue("S7", "S7_on_load")()
- } else {
- S7::methods_register()
}
}I tested this locally with S7 0.2.2 and development S7: |
Marquee declares S7 in Imports and uses its APIs when registering ggplot2 methods, but NAMESPACE does not import from S7. Add an explicit
S7_inheritsimport in the roxygen package declarations and regenerate NAMESPACE to remove the dependency check note.Use the S7 load, build, and unload hooks when exported by the installed S7. Unloading removes this package's dependency hooks and owned methods on external S7 generics. The existing S7 version requirement is preserved. Method registration follows the existing deferred load work.