Closed stephhazlitt closed 1 year ago
OK, I'll change it up with {lifecycle}. When do we want to make this defunct—3 months?
That sounds about right to me. We can put this plus the removal of rgeos into the next release so they go together...
Turns out we get a lot of mileage from just updating the fxn documentation for bc_bound_hres()
since most everything else #' @inheritParams bc_bound_hres
. I did end up re-creating the shortcuts.R
file, as I removed all of the sp
examples from the docs (e.g. no more #' my_layer_sp <- airzones(class = 'sp')
). This was inspired by the recommendation to use #' @keywords internal
to remove any fully deprecated function from the documentation index in pkgdown sites from the {lifecycles} communicate article.
Sorry for the big PR/review, turns our deprecating sp
touches a lot of files in {bcmaps} π§
Summarizing the desired approach for deprecating support for sp
:
β self_union()
& get_poly_attribute()
: deprecating whole fxns
β transform_bc_albers.Spatial
& fix_geo_problems.Spatial
: deprecating the Spatial method
β bc_bbox()
: deprecating the argument value class = "sp"
β get_layer()
which is used for 35 shortcut functions + combine_nr_rd()
: deprecating the class
argument
β 8 one off fxns that get a layer w/o using get_layer()
π: deprecating the class
argument
For get_layer()
, the best outcome for the user would be to play with the env
and caller_env
arguments in deprecate_warn()
to raise the level of the warning to the calling shortcut function.
That's a great summary @stephhazlitt, thanks! I'm also deprecating the whole fix_geo_problems()
function as for sf
objects it's basically just a wrapper around sf::st_make_valid()
- it only really had value for Spatial
objects.
Ok - all green and I think this is ready for another review. @stephhazlitt I can't request a review from you (probably because you are the main PR author), but if you can have a look that would be awesome.
And of course making a reprex found a bug. Just pushed a fix, but here's some example output:
library(bcmaps)
#> Loading required package: sf
#> Linking to GEOS 3.11.0, GDAL 3.5.3, PROJ 9.1.0; sf_use_s2() is TRUE
#> Support for Spatial objects (`sp`) was deprecated in {bcmaps} v1.2.0, and will be removed altogether in the Summer 2023. Please use `sf` objects with {bcmaps}.
# ensure it always warns, for demo purposes
withr::local_options(lifecycle_verbosity = "warning")
az <- airzones()
#> airzones was updated on NULL
az <- airzones("sp")
#> Warning: The `class` argument of `airzones()` is deprecated as of bcmaps 1.2.0.
#> βΉ Please use `sf` objects with {bcmaps}, support for Spatial objects (sp) will
#> be removed in Summer 2023.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.
x <- get_layer("bc_cities")
x <- get_layer("bc_cities", class = "sp")
#> Warning: The `class` argument of `get_layer()` is deprecated as of bcmaps 1.2.0.
#> βΉ Please use `sf` objects with {bcmaps}, support for Spatial objects (sp) will
#> be removed in Summer 2023.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.
x <- get_layer("bc_cities", class = "sf")
#> Warning: The `class` argument of `get_layer()` is deprecated as of bcmaps 1.2.0.
#> βΉ Please use `sf` objects with {bcmaps}, support for Spatial objects (sp) will
#> be removed in Summer 2023.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.
nr_rc <- combine_nr_rd(class = "sp")
#> Warning: The `class` argument of `combine_nr_rd()` is deprecated as of bcmaps 1.2.0.
#> βΉ Please use `sf` objects with {bcmaps}, support for Spatial objects (sp) will
#> be removed in Summer 2023.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.
Created on 2023-04-06 with reprex v2.0.2
This is SO close @ateucher, thanks for the changes. A couple of comments:
Support for Spatial objects (sp) was deprecated in {bcmaps} v1.2.0, and will be removed altogether in the Summer 2023
and the docs say class = sp is no longer supported and as of bcmaps 1.2.0 (planned for Summer 2023) the class argument will be removed
. I think I assumed we would do a release with the deprecation changes (which would bump from 1.1 -> 1.2), and then a subsequent release in the summer with the full removal? Either way, we should align the messages.#' @keywords internal
IIUC this removes the deprecated function from the help index (and pkgdown site if there is one), removing the user user-facing documentation. Users can only access the deprecation note if they are already users of the fxn and type ?deprecate_fxn
in the console. I wonder if in our use case, this is a fast/abrupt design and it we should leave the deprecated fxns in the index?browseVignettes("bcmaps")
is not working for me on the PR (but it does with the main branch).Thanks @stephhazlitt.
- I think we have a bit of inconsistency re: versioning plans. The start up message gives the deprecation timeline as
Support for Spatial objects (sp) was deprecated in {bcmaps} v1.2.0, and will be removed altogether in the Summer 2023
and the docs sayclass = sp is no longer supported and as of bcmaps 1.2.0 (planned for Summer 2023) the class argument will be removed
. I think I assumed we would do a release with the deprecation changes (which would bump from 1.1 -> 1.2), and then a subsequent release in the summer with the full removal? Either way, we should align the messages.
Great catch re the messaging - You're right, it's deprecated in 1.2.0 and will be removed in the summer. I'll align the messages.
#' @keywords internal
IIUC this removes the deprecated function from the help index (and pkgdown site if there is one), removing the user user-facing documentation. Users can only access the deprecation note if they are already users of the fxn and type?deprecate_fxn
in the console. I wonder if in our use case, this is a fast/abrupt design and it we should leave the deprecated fxns in the index?
I think I'm ok removing the function from the index... I don't think we want anyone discovering it now and starting to use it if it's going to be removed in a few months.
- This could just be a temporary local issue, but
browseVignettes("bcmaps")
is not working for me on the PR (but it does with the main branch).
I'll double-check the vignettes.
Ok @stephhazlitt I think I've addressed your comments
Mmmmmmmerge π
Address part of #109.
.Deprecate
in theconvert_to_sp()
helper fxn inbcmaps::get_layer()
, which is triggered with all the named layer + shortcut functions e.g.bc_bound(class = "sp")
,bc_neighbours(class = "sp")
.Deprecate
in the methods helper fxns (transform_bc_albers.Spatial
andfix_geo_problems.Spatial
).Deprecate
in theSpatial
helper fxnsget_poly_attribute
andself_union
The Approach:
.onAttach
business, it was a shot in the dark π¬combine_nr_rd()
returns the warning 2x becauseconvert_to_sp()
is called on two layersbc_bbox()
with.Deprecate
, we could use {lifecycle}?sp
functions, but does not alert users via the package documentation. We could add {lifecycle} as a dependency and leverage the lifecycle badges and Roxygen documentation (and the argument-level functionality for the above situation)—we would need to edit themake_shortcuts()
fxn and then regenerate theshortcuts.R
script if we want to go that route.