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

extendr project template #321

Merged
merged 21 commits into from
Feb 4, 2024
Merged

Conversation

kbvernon
Copy link
Contributor

Trying to add required content to support RStudio project templates. Currently getting the following error:

Error: No root directory found in G:/My Drive or its parent directories. Root criterion: contains a file "DESCRIPTION" with contents matching "^Package: "

@Ilia-Kosenkov
Copy link
Member

Found an issue, and I will fix it in a separate PR.

@kbvernon
Copy link
Contributor Author

I believe I have this working, but I'm not sure what the M.O. is for doing tests.

@kbvernon
Copy link
Contributor Author

@Ilia-Kosenkov, do you have a recommendation for how to handle missing usethis before use_extendr() gets called? should it just error?

@kbvernon
Copy link
Contributor Author

use_extendr() uses rlang::check_installed("usethis"). However, that opens an interactive context I don't think is available for project directory creation through the RStudio GUI. Maybe I should use a combination of rlang::is_installed("usethis") and cli::abort() instead?

@Ilia-Kosenkov
Copy link
Member

You can also use this in your function, call it before you access anything {usethis} - related.

rlang::check_installed("usethis")

@kbvernon
Copy link
Contributor Author

kbvernon commented Dec 8, 2023

Per our Discord discussion, I added commits so that create_extendr_package() no longer adds a temporary INDEX file to the project folder. This made the single {testthat} test irrelevant, so I also reverted that commit.

@kbvernon
Copy link
Contributor Author

kbvernon commented Dec 8, 2023

Because we remove the INDEX file, it was suggested that we add its content to the package documentation, probably "Using Rust code in packages". Would be happy to do this, but should it be done in another PR?

@Ilia-Kosenkov
Copy link
Member

You should do it in this PR, and also update NEWS.md

R/create_extendr_package.R Outdated Show resolved Hide resolved
R/create_extendr_package.R Outdated Show resolved Hide resolved
R/create_extendr_package.R Show resolved Hide resolved
R/create_extendr_package.R Outdated Show resolved Hide resolved
@JosiahParry
Copy link
Contributor

Package is created and opened interactively with RStudio. The infrastructure works as well. This should not be exported until the arguments are changed and handled differently.

This is because you're capturing all arguments via ... and expecting there to be a valid value passed in. This is true when using the wizard. But it is not true when doing interactively. The highlighted lines are where the problem comes from.

usethis::create_package(
path,
fields = list(),
rstudio = TRUE,
roxygen = args[["roxygen"]] %||% TRUE,
check_name = args[["check_name"]] %||% TRUE,
open = FALSE
)
# add rust scaffolding to project dir
use_extendr(
path,
crate_name = args[["crate_name"]],
lib_name = args[["lib_name"]],
quiet = TRUE,
overwrite = TRUE,
edition = args[["edition"]] %||% TRUE
)

image

@JosiahParry
Copy link
Contributor

Since this is not an exported function I am comfortable merging.

@Ilia-Kosenkov
Copy link
Member

If you approved it and the author has no permissions to merge to this repo, it is your duty to merge once all the changes are in place (in case there are any not yet pushed) @JosiahParry

@JosiahParry JosiahParry merged commit a5b7802 into extendr:main Feb 4, 2024
19 checks passed
@kbvernon kbvernon deleted the project-template branch November 17, 2024 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants