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

[Doc] rwasm::add_pkg(dependencies = TRUE) installs more than hard dependencies #27

Closed
JosiahParry opened this issue Apr 4, 2024 · 3 comments · Fixed by #28
Closed

Comments

@JosiahParry
Copy link
Contributor

Installing a package with rwasm::add_pkg() will install only that package and not its dependencies. One can use dependencies = TRUE but then this installs all soft recursive dependencies. I understand that the doc points to pkgdepends::as_pkg_dependencies() but that is almost like reading a novel.

image

I think the argument doc can be enhances to make this easier to pick up e.g.

Dependency specification for packages to additionally add to the repository. Defaults to FALSE, meaning no additional packages. Use NA to install hard dependencies and TRUE to install optional dependencies. See pkgdepends::as_pkg_dependencies for details.

Example of the difference in dependencies when installing {vctrs}.

pak::pkg_deps("vctrs")
#> ℹ Loading metadata database
#> ✔ Loading metadata database ... done
#> 
#> # A data frame: 5 × 32
#>   ref     type  direct directpkg status package version license needscompilation
#>   <chr>   <chr> <lgl>  <lgl>     <chr>  <chr>   <chr>   <chr>   <lgl>           
#> 1 cli     stan… FALSE  FALSE     OK     cli     3.6.2   MIT + … FALSE           
#> 2 glue    stan… FALSE  FALSE     OK     glue    1.7.0   MIT + … FALSE           
#> 3 lifecy… stan… FALSE  FALSE     OK     lifecy… 1.0.4   MIT + … FALSE           
#> 4 rlang   stan… FALSE  FALSE     OK     rlang   1.1.3   MIT + … FALSE           
#> 5 vctrs   stan… TRUE   TRUE      OK     vctrs   0.6.5   MIT + … FALSE           
#> # ℹ 23 more variables: priority <chr>, md5sum <chr>, sha256 <chr>,
#> #   filesize <int>, built <chr>, platform <chr>, rversion <chr>,
#> #   repotype <chr>, repodir <chr>, target <chr>, deps <list>, mirror <chr>,
#> #   sources <list>, remote <list>, error <list>, metadata <list>,
#> #   dep_types <list>, params <list>, sysreqs <chr>, cache_status <chr>,
#> #   lib_status <chr>, old_version <chr>, new_version <chr>
pak::pkg_deps("vctrs", dependencies = TRUE)
#> # A data frame: 70 × 32
#>    ref    type  direct directpkg status package version license needscompilation
#>    <chr>  <chr> <lgl>  <lgl>     <chr>  <chr>   <chr>   <chr>   <lgl>           
#>  1 R6     stan… FALSE  FALSE     OK     R6      2.5.1   MIT + … FALSE           
#>  2 askpa… stan… FALSE  FALSE     OK     askpass 1.2.0   MIT + … FALSE           
#>  3 base6… stan… FALSE  FALSE     OK     base64… 0.1-3   GPL-2 … FALSE           
#>  4 bit64  stan… FALSE  FALSE     OK     bit64   4.0.5   GPL-2 … FALSE           
#>  5 bit    stan… FALSE  FALSE     OK     bit     4.0.5   GPL-2 … FALSE           
#>  6 brio   stan… FALSE  FALSE     OK     brio    1.1.4   MIT + … FALSE           
#>  7 bslib  stan… FALSE  FALSE     OK     bslib   0.7.0   MIT + … FALSE           
#>  8 cachem stan… FALSE  FALSE     OK     cachem  1.0.8   MIT + … FALSE           
#>  9 callr  stan… FALSE  FALSE     OK     callr   3.7.6   MIT + … FALSE           
#> 10 cli    stan… FALSE  FALSE     OK     cli     3.6.2   MIT + … FALSE           
#> # ℹ 60 more rows
#> # ℹ 23 more variables: priority <chr>, md5sum <chr>, sha256 <chr>,
#> #   filesize <int>, built <chr>, platform <chr>, rversion <chr>,
#> #   repotype <chr>, repodir <chr>, target <chr>, deps <list>, mirror <chr>,
#> #   sources <list>, remote <list>, error <list>, metadata <list>,
#> #   dep_types <list>, params <list>, sysreqs <chr>, cache_status <chr>,
#> #   lib_status <chr>, old_version <chr>, new_version <chr>

packages are still installing now while writing this! 😅

@georgestagg
Copy link
Member

georgestagg commented Apr 4, 2024

Indeed, I almost exclusively use dependencies = NA. We can definitely add a note to the rwasm docs along these lines.

@JosiahParry
Copy link
Contributor Author

It may also be worthwhile having the default be dependencies = NA. It was really confusing when I compiled my package and added it to my own little repo. Then when I tried to call it from https://webr.r-wasm.org/latest/ it said I needed vctrs which was surprising! But perhaps that's exactly how the CRAN-like repo structure works

@georgestagg
Copy link
Member

See r-wasm/actions#15 for a longer discussion about why dependencies = FALSE is the default. The short version is that, in principle, we would like to mask the CRAN/r-wasm version of packages as little as possible.

The idea would be that by building only the minimal packages by default, we could lookup packages in both our repository alongside the default webR repo when installing packages, e.g.

install.packages("myfancypackage", c("https://myrepo.github.io/", "https://repo.r-wasm.org"))

You can then chain together packages from custom repos, r-universe, r-wasm.org etc. This reduces the number of packages required to be built and distributed for a given custom Wasm R package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants