r-lib / pkgdown

Generate static html documentation for an R package
https://pkgdown.r-lib.org/
Other
718 stars 334 forks source link

Add a dependencies page one click away from the homepage? #1333

Open maelle opened 4 years ago

maelle commented 4 years ago

When checking out a package via its pkgdown homepage, I often click on the GitHub icon to go open DESCRIPTION and look at the package and external dependencies.

It'd be cool for pkgdown websites to feature a page listing dependencies (linking them like external functions, related to #1234).

The homepage could link to it somehow. Maybe a badge under "Dev status", before other badges, that'd have the text "dependencies".

jayhesselberth commented 4 years ago

For packages that are already on CRAN / BIOC, this information already exists one click away (i.e., the link under "Download from CRAN at").

maelle commented 4 years ago

Right! Which makes the feature less useful. However even for those, the dependencies page could look better than the CRAN page: ordering dependencies alphabetically, one line per dependency (to make it easier to count them?), and linking to their pkgdown website when existing instead of their CRAN page. :slightly_smiling_face:

jayhesselberth commented 4 years ago

We could dump desc::desc() output to a flat file and annotated with appropriate links.

I'm not sure where to link to this. A badge doesn't seem appropriate.

maelle commented 4 years ago

Right, I was thinking it was slightly related to "dev" hence the idea to put it under "Dev status". :grin: (the navbar seems too prominent for such a link?)

The dependencies list could make it clear what's on CRAN/what's not and it'd be nice if it merged Remotes with other fields (e.g. if the package imports pkgdown and has r-lib/remotes@vtag in Remotes). The page source could be a direct link to DESCRIPTION on GitHub (like what happens for vignettes/manual pages).

hadley commented 3 years ago

Maybe this could be based on sessioninfo::session_info("pkgdown") — that way it also serves as a record of exactly which versions were used to build the site.

JosiahParry commented 11 months ago

Wanted to bump this idea. It would be quite nice to have something like the below under Developers or Dev status. Alternatively, if it can't be built out into pkgdown, could the sidebar be customizable such that one could add it if they so desired?

Dependencies

Imports

Suggests

jayhesselberth commented 11 months ago

I was thinking to dump sessioninfo::session_info("pkgdown") output to a new page (build-session.html) that is linked in the pkgdown site footer, changing "built" to a link in "Site built by pkgdown 2.0.8".

hadley commented 6 months ago

I think that the right place to add this is under links, since it seems most related to "browse source code" and "report a bug", now that dev status is only display on the development site.

But I'm not sure about the visual treatment on the page itself. We could copy CRAN and do a comma separated list, but that seems like not a lot of content for the whole page. We could do a table but I think there are only two obvious columns: the package name (linked to the website) and the dependency type. I think @JosiahParry's suggesting of bulleted lists is the most compelling, but that's going to create a pretty long page that's fairly low information density. Is there something else that we could display on this page?

I've generally gone off the idea of also including the versions actually used to build the page since I don't think that's going to be that useful to that many people, but I could probably be convinced otherwise.

I did figure out one thing that we can do that CRAN does not, and that's list all the recursive dependencies.

JosiahParry commented 6 months ago

I quite like your suggestions, @hadley, particularly the recursive dependencies. I often find myself using tools::package_dependencies("pkg", recursive = TRUE) to get a fuller picture of what i'm importing.

Could the lengthy lists be hidden in a collapsable section somewhat like this?

Screen Recording 2024-05-08 at 10 34 22

repro:

```r library(bslib) library(shiny) accordion( accordion_panel("Dependencies", accordion( list( accordion_panel( "Imports", tags$ul(tags$li("rlang"), tags$li("vctrs")) ), accordion_panel( "Suggests", tags$ul(tags$li("data.table")) ), accordion_panel( "Strong Recursive Dependencies", tags$ul( tags$li("httr2"), tags$li("Rcpp"), tags$li("cpp11"), tags$li("stringr") ) ) ) )) ) ```
hadley commented 6 months ago

@JosiahParry are you think that would go in the sidebar?

JosiahParry commented 6 months ago

@hadley, yes, I think so. I could envision something like below but ~ prettier ~.

Gif hidden in details

![Screen Recording 2024-05-08 at 13 17 50](https://github.com/r-lib/pkgdown/assets/13534508/d2494db7-18da-4b3e-b352-151224547da6)

Or, alternatively, I could envision a pkgdown page similar to CRAN's package (i.e. rlang) landing page that that has all the package metadata in one location. This would be go nicely well with a package level rd file (I'm thinking of usethis::use_package_doc()). In this case there is more real estate to work with.