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

Do not require internet connection for example_package #114

Closed
peterdesmet opened this issue Nov 7, 2022 · 1 comment · Fixed by #248
Closed

Do not require internet connection for example_package #114

peterdesmet opened this issue Nov 7, 2022 · 1 comment · Fixed by #248
Labels
enhancement New feature or request function:example_package Function example_package() refactor
Milestone

Comments

@peterdesmet
Copy link
Member

example_package currently has a remote $directory:

> library(frictionless)
> example_package$directory
[1] "https://raw.githubusercontent.com/frictionlessdata/frictionless-r/main/inst/extdata"

That means an internet connection is need to read resources. This was by design for some tests, but should probably be altered so more tests can run without an internet connection.

frictionless-r/R/data.R

Lines 16 to 21 in b6d3308

#' # Note that it must be created using a URL, otherwise all Data Resource paths
#' # will point to local paths that won't work for other users.
#' # One can load locally using:
#' # read_package(
#' # system.file("extdata", "datapackage.json", package = "frictionless")
#' # )

Need to investigate first what tests would fail (on GitHub CI) if the directory is local.

@peterdesmet
Copy link
Member Author

peterdesmet commented Jul 10, 2024

  • I think the better solution is to create a function example_package().

This allows to clearly differentiate between remote and local (default).

#' @export
example_package <- function(remote = FALSE) {
  if (remote) {
    path <- file.path(
      "https://raw.githubusercontent.com/frictionlessdata/frictionless-r",
      "main/inst/extdata/datapackage.json"
    )
  } else {
    path <- system.file("extdata", "datapackage.json", package = "frictionless")
  }
  read_package(path)
}
  • The rda file can be removed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request function:example_package Function example_package() refactor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant