r-spatialecology / landscapemetrics

Landscape Metrics for Categorical Map Patterns 🗺️ in R
https://r-spatialecology.github.io/landscapemetrics
GNU General Public License v3.0
230 stars 43 forks source link

Dependencies #286

Closed Nowosad closed 1 year ago

Nowosad commented 1 year ago

Hi @mhesselbarth -- I got an email about a problem: a user has R v 4.2.1, but cannot install landscapemetrics, due to the Rcpp (≥ 1.0.10) requirement (I assume this Rcpp version is only available for R>4.2.1). Is this requirement is actually needed?

mhesselbarth commented 1 year ago

Mmh...Good question. When I fixed the C+11 requirement which we had previously, but didn't need and threw an warning on CRAN they asked me to fix, I looked at and copied everything from Rcpp::Rcpp.package.skeleton() to make sure everything is setup correctly. I think it basically comes down to if we need a Makevars file or not, which is optional starting from a certain version of Rcpp

mhesselbarth commented 1 year ago

Maybe this is also a good issue to discuss Suggest and Enhances in general.

So we need packages as suggest to use them in tests I think. This means, listing raster and sp only in Enhances doesn't allow us to really test them.

Should we just get rid of Enhance completely and list them all as Suggest? Given that those won't be necessarily installed for all users, I think that might be alright?

Nowosad commented 1 year ago

The difference between Enhance and Suggests is that Enhance should only have packages for which we added new methods (e.g, landscape_as_list.stars), but we are not testing them nor using them in examples. So -- in general, yes -- we could just move everything to Suggests

mhesselbarth commented 1 year ago

So the advantages would be we could actually test them and use them in examples. What would be the disadvantage? A bit heaver installation if vignettes = TRUE (or similar arguments during installation)?

Nowosad commented 1 year ago

Yep -- that how I understand it.

Nowosad commented 1 year ago

@mhesselbarth I would suggest removing the Rcpp version check from Description.

For people having problems with installing landscapemetrics, this following code should work:

install.packages('landscapemetrics', repos = c('https://r-spatialecology.r-universe.dev/', 'https://cloud.r-project.org/'))
Nowosad commented 1 year ago

Maybe related: https://www.tidyverse.org/blog/2023/03/cran-checks-compiled-code/

mhesselbarth commented 1 year ago

Everything should be fixed now.

  1. We depend on Rcpp (>= 0.11.0) and R (>= 3.6) due to the CRAN C++11 policy. And I think both version requirements are fair at this point in terms of compatibility with older versions.
  2. I moved all Enhances to Suggests.
  3. pgkdown should run again, however, I added a note that the comparison vignettes is currently out-of-date because we need to re-calc the metrics
Nowosad commented 1 year ago

Great work! Thanks @mhesselbarth