[Bioc-devel] ExperimentHub packages offline

Laurent Gatto |@urent@g@tto @end|ng |rom uc|ouv@|n@be
Sat Mar 16 11:01:03 CET 2024


Packages that use ExperimentHub to distribute date can use createHubAccessors() - here's the relevant section from `?createHubAccessors`:

     ‘createHubAccessors(pkgname, titles): ’ This helper is intended to
     be used by ExperimentHub package developers in their .onLoad()
     function in zzz.R. It generates and exports functions by resource
     name which allows the resource to be loaded with resource123() in
     addition to the standard method via the ExperimentHub interface,
     e.g., ehub[["EH123"]]. When 'metadata=TRUE' just the metadata are
     displayed, when 'metadata=FALSE' the full resource is loaded, e.g,
     resource123(metadata=TRUE). See vignette for more information.

This function however fails when trying to load a package without internet connectivity:

> library(depmap)
[...]
Cannot connect to ExperimentHub server, using 'localHub=TRUE' instead
Using 'localHub=TRUE'
  If offline, please also see BiocManager vignette section on offline use
snapshotDate(): 2024-03-11
Error: package or namespace load failed for ‘depmap’:
 .onLoad failed in loadNamespace() for 'depmap', details:
  call: FUN(X[[i]], ...)
  error: ‘rnai_19Q2’ not found in ExperimentHub

I would like to use something like `curl::has_internet()` in .onLoad() to first check if there's is connectivity before calling createHubAccessors(). 

Am I missing something here? Does anyone have any experience with similar issues?

Laurent




More information about the Bioc-devel mailing list