trevi
trevi

Reputation: 711

How to handle a private remote dependency in a new R package?

I am writing an R package (let's called it new.package) that needs to import functions from another private R package (let's called it remote.private.package). remote.private.package is a private package on a github private remote repository (let's assume at github::username/remote_private_package).

I have run the following line which adds a private remote dependency to the new.package DESCRIPTION file:

usethis::use_dev_package("remote.private.package", type = "Imports", remote = c("username/remote_private_package", auth_token = "my_github_auth_token"))

This is the content of the relevant section of the DESCRIPTION file, after running the above line:

    ...
Remotes: 
    username/remote_private_package,
    my_github_auth_token
Imports: 
    remote.private.package (>= 0.1.0),
    ...

However when i run devtools::load_all() i get the following console message:

ℹ Loading new.package
ℹ The package `remote.private.package` (>= 0.1.0) is required.
✖ Would you like to install it?

1: Yes
2: No

Selection: 1

Error: HTTP error 404.
  Not Found

  Did you spell the repo owner (`username`) and repo name (`remote_private_package`) correctly?
  - If spelling is correct, check that you have the required permissions to access the repo.

I am sure that the info is correct because when i run:

remotes::install_github("username/remote_private_package", auth_token = "my_github_auth_token")
library(remote.private.package)

The package is installed and loaded correctly.

What are the best practices to handle packages with private remote repository dependencies?

Upvotes: 1

Views: 234

Answers (0)

Related Questions