Re: [R-pkg-devel] [External] Re: Package submission to CRAN not passing incoming checks

2024-04-24 Thread Ivan Krylov via R-package-devel
В Wed, 24 Apr 2024 00:17:28 +
"Petersen, Isaac T"  пишет:

> I included the packages (including the raw package folders and their
> .tar.gz files) in the /inst/extdata folder.

Would you prefer your test to install them from the source directories
(as you currently do, in which case the *.tar.gz files can be omitted)
or the *.tar.gz files (in which case you can set the `repos` argument
to a file:/// URI and omit the package directories and the setwd()
calls)?

I think (but haven't tested) that the two problems that are currently
breaking your test are with .libPaths() and setwd().

.libPaths(temp_lib) overwrites the library paths with `temp_lib` and
the system libraries, the ones in %PROGRAMFILES%\R\R-*\library. In
particular, this removes %LOCALAPPDATA%\R\win-library\* from the list
of library paths, so the packages installed by the user (including
'waldo', which is needed by 'testthat') stop being available.

In order to add temp_lib to the list of the paths, use
.libPaths(c(temp_lib, .libPaths())).

Since setwd() returns the previous directory, one that was current
before setwd() was called, the code newpath <- setwd(filepath);
setwd(newpath) will keep the current directory, not set it to
`filepath`. Use oldpath <- setwd(filepath) instead.

Since you're already using 'testthat' and it already depends on
'withr', you may find it easier to use withr::local_dir(...) and
withr::local_temp_libpaths(...).

In order to test for a package being attached by load_or_install() (and
not just installed and loadable), check for 'package:testpackage1'
being present in the return value of search(). (This check is good
enough and much easier to write than comparing environments on the
search path with the package exports or comparing searchpaths() with
the paths under the temporary library.)

Finally, I think that there is no need for the test_load_or_install()
call because I don't see the function being defined anywhere. Doesn't
test_that(...) run the tests by itself?

-- 
Best regards,
Ivan

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] [External] Re: Package submission to CRAN not passing incoming checks

2024-04-23 Thread Petersen, Isaac T
 after, x_arg 
= "before", y_arg = "after")

 28. └─base::loadNamespace(x)

 29.   └─base::withRestarts(stop(cond), retry_loadNamespace = function() NULL)

 30. └─base (local) withOneRestart(expr, restarts[[1L]])

 31.   └─base (local) doWithOneRestart(return(expr), restart)



[ FAIL 2 | WARN 1 | SKIP 0 | PASS 0 ]

Error: Test failures

Execution halted



1 error ✖ | 0 warnings ✔ | 1 note ✖

Error: R CMD check found ERRORs

Execution halted



Exited with status 1.


From: Ivan Krylov 
Sent: Tuesday, April 23, 2024 1:46 AM
To: Petersen, Isaac T 
Cc: r-package-devel@r-project.org 
Subject: [External] Re: [R-pkg-devel] Package submission to CRAN not passing 
incoming checks

[You don't often get email from ikry...@disroot.org. Learn why this is 
important at https://aka.ms/LearnAboutSenderIdentification ]

Dear Isaac,

В Mon, 22 Apr 2024 17:00:27 +
"Petersen, Isaac T"  пишет:

> This my first post--I read the posting guidelines, but my apologies
> in advance if I make a mistake.

Welcome to R-package-devel! You're doing just fine.

> 1) The first note <...> includes the contents of the LICENSE file

It's multiple NOTEs in a trench coat. Kasper has addressed the "large
version components" and the DOIs interpreted as file URIs, but there's
one more.

The ' + file LICENSE' syntax has two uses: (1)
for when the terms of the license is a template, requiring the author
of the software to substitute some information (e.g. the year and the
copyright holder for MIT) and (2) for when a package puts additional
restrictions on the base license.

(Hmm. Only case (2) is currently described at
<https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcran.r-project.org%2Fdoc%2Fmanuals%2FR-exts.html%23Licensing=05%7C02%7Cisaac-t-petersen%40uiowa.edu%7C3a0f2254132f4cd6205608dc63610e82%7C1bc445959aba4fc3b8ec7b94a5586fdc%7C1%7C1%7C638494515735410190%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C4%7C%7C%7C=rm%2Fp2SXR6CN%2FysfsiP1i2acQcrYlxPfUgxMF6NQdvlA%3D=0<https://cran.r-project.org/doc/manuals/R-exts.html#Licensing>>;
 case
(1) is only described inside the license files.)

The CRAN team has expressed a preference for the package authors not to
put 2 twisty little copies of standard licenses, all slightly
different, inside their packages. Since you're not restricting CC BY
4.0, it's enough to say 'License: CC BY 4.0'. If you'd like a full copy
of the license text in your source code repository, that's fine, but
you'll need to list the file in .Rbuildignore:
https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcran.r-project.org%2Fdoc%2Fmanuals%2FR-exts.html%23Building-package-tarballs=05%7C02%7Cisaac-t-petersen%40uiowa.edu%7C3a0f2254132f4cd6205608dc63610e82%7C1bc445959aba4fc3b8ec7b94a5586fdc%7C1%7C1%7C638494515735420011%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C4%7C%7C%7C=kslE9klwZD%2BvBHX3I%2FkBewpNLnr14cgnxOc%2FQIZBLR0%3D=0<https://cran.r-project.org/doc/manuals/R-exts.html#Building-package-tarballs>

Speaking of the Creative Commons license: the choice of a license for
your code is obviously yours, but Creative Commons themselves recommend
against using their licenses for software:
<https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcreativecommons.org%2Ffaq%2F%23can-i-apply-a-creative-commons-license-to-software=05%7C02%7Cisaac-t-petersen%40uiowa.edu%7C3a0f2254132f4cd6205608dc63610e82%7C1bc445959aba4fc3b8ec7b94a5586fdc%7C1%7C1%7C638494515735426275%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C4%7C%7C%7C=lwWu6xa1gXzXUU%2BqwxU5CLM1cMkO9jqefYr1T5L%2FyGo%3D=0<https://creativecommons.org/faq/#can-i-apply-a-creative-commons-license-to-software>>.
I can't recommend you a license - that would be politically motivated
meddling in foreign affairs - but the lists linked by the CC FAQ and
Writing R Extensions section 1.1.2 should provide a good starting point.

> Here are the results from win-builder:
> https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwin-builder.r-project.org%2Fincoming_pretest%2Fpetersenlab_0.1.2-9033_20240415_212322%2F=05%7C02%7Cisaac-t-petersen%40uiowa.edu%7C3a0f2254132f4cd6205608dc63610e82%7C1bc445959aba4fc3b8ec7b94a5586fdc%7C1%7C1%7C638494515735430793%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C4%7C%7C%7C=S%2F18W%2Bh15GDI5dQRlBlvqhPVoEeP67MAwSIAsnIw4yw%3D=0<https://win-builder.r-project.org/incoming_pretest/petersenlab_0.1.2-9033_20240415_212322/>

There is one more NOTE:

>> * checking examples ... [437s/438s] NOTE
>> Examples with CPU (user + system) or elapsed time > 5s
>>user system elapsed
>> load_or_install 349.410 37.410 387.233
>> vwReg35.199  0.379