Dirk Eddelbuettel
2020-Jun-06 19:06 UTC
[Rd] Change in package.skeleton behavior from R 3.6.3 to R 4.0.0 ?
The Rcpp package and some related packages such as RcppArmadillo make use of
(local) wrappers around the utils::package.skeleton() function for creating
(basic yet functional) packages using Rcpp or RcppArmadillo. RStudio also
exposes this under the graphical menu as a nice way to construct a package.
But it seems that something changed quite recently in R. I looked into this a
little yesterday and prepared a workaround for Rcpp; Kevin (CC'ed) was more
diligent and found what changed with R itself. See the discussion under issue
ticket #1087 at the Rcpp repo: https://github.com/RcppCore/Rcpp/issues/1087
The proposed simple PR is at https://github.com/RcppCore/Rcpp/pull/1088
As Kevin mentions in #1087, R itself may have changed, and he even dug up a
possible commit [1]. One can illustrate that quickly with two different R
interpreters, I use Docker here because that's what I often do. I apologise
for the long command-line; that is basically just common Docker arguments.
The keys are r-base:3.6.3 and r-base:4.0.0 for selecting the relevant R
builds, and the command string passed to bash to call Rscript and
package.skeleton() followed by a cat of the NAMESPACE file.
-----------------------------------------------------------------------------
edd at rob:/tmp$ mkdir skeleton
edd at rob:/tmp$ cd skeleton/
edd at rob:/tmp/skeleton$ docker run --rm -ti -u1000:1000 -v ${PWD}:/mnt -w /mnt
r-base:3.6.3 bash -c "Rscript -e 'x <-1L;
package.skeleton(name=\"p363\")'; cat p363/NAMESPACE"
Creating directories ...
Creating DESCRIPTION ...
Creating NAMESPACE ...
Creating Read-and-delete-me ...
Saving functions and data ...
Making help files ...
Done.
Further steps are described in './p363/Read-and-delete-me'.
exportPattern("^[[:alpha:]]+")
edd at rob:/tmp/skeleton$ docker run --rm -ti -u1000:1000 -v ${PWD}:/mnt -w /mnt
r-base:4.0.0 bash -c "Rscript -e 'x <-1L;
package.skeleton(name=\"p400\")'; cat p400/NAMESPACE"
Creating directories ...
Creating DESCRIPTION ...
Creating NAMESPACE ...
Creating Read-and-delete-me ...
Saving functions and data ...
Making help files ...
Done.
Further steps are described in './p400/Read-and-delete-me'.
export("x")
edd at rob:/tmp/skeleton$
-----------------------------------------------------------------------------
In short, 4.0.0 no longer exports via
'exportPattern("^[[:alpha:]]+")'
rendering the new package created non-functional.
Was this intentional, or is this a bug we can look into fixing for R 4.0.2 ?
Dirk
[1] This uses the GitHub mirror rather than svn but the underlying code is of
course the same
https://github.com/wch/r-source/commit/36b27d951fb355f268191a25909ab292a273932d#diff-a1b94fcea8b8818d4371aabf04dc2b3c
--
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
Duncan Murdoch
2020-Jun-06 19:44 UTC
[Rd] Change in package.skeleton behavior from R 3.6.3 to R 4.0.0 ?
On 06/06/2020 3:06 p.m., Dirk Eddelbuettel wrote:> > The Rcpp package and some related packages such as RcppArmadillo make use of > (local) wrappers around the utils::package.skeleton() function for creating > (basic yet functional) packages using Rcpp or RcppArmadillo. RStudio also > exposes this under the graphical menu as a nice way to construct a package. > > But it seems that something changed quite recently in R. I looked into this a > little yesterday and prepared a workaround for Rcpp; Kevin (CC'ed) was more > diligent and found what changed with R itself. See the discussion under issue > ticket #1087 at the Rcpp repo: https://github.com/RcppCore/Rcpp/issues/1087 > The proposed simple PR is at https://github.com/RcppCore/Rcpp/pull/1088 > > As Kevin mentions in #1087, R itself may have changed, and he even dug up a > possible commit [1]. One can illustrate that quickly with two different R > interpreters, I use Docker here because that's what I often do. I apologise > for the long command-line; that is basically just common Docker arguments. > The keys are r-base:3.6.3 and r-base:4.0.0 for selecting the relevant R > builds, and the command string passed to bash to call Rscript and > package.skeleton() followed by a cat of the NAMESPACE file. > > ----------------------------------------------------------------------------- > edd at rob:/tmp$ mkdir skeleton > edd at rob:/tmp$ cd skeleton/ > edd at rob:/tmp/skeleton$ docker run --rm -ti -u1000:1000 -v ${PWD}:/mnt -w /mnt r-base:3.6.3 bash -c "Rscript -e 'x <-1L; package.skeleton(name=\"p363\")'; cat p363/NAMESPACE" > Creating directories ... > Creating DESCRIPTION ... > Creating NAMESPACE ... > Creating Read-and-delete-me ... > Saving functions and data ... > Making help files ... > Done. > Further steps are described in './p363/Read-and-delete-me'. > exportPattern("^[[:alpha:]]+") > edd at rob:/tmp/skeleton$ docker run --rm -ti -u1000:1000 -v ${PWD}:/mnt -w /mnt r-base:4.0.0 bash -c "Rscript -e 'x <-1L; package.skeleton(name=\"p400\")'; cat p400/NAMESPACE" > Creating directories ... > Creating DESCRIPTION ... > Creating NAMESPACE ... > Creating Read-and-delete-me ... > Saving functions and data ... > Making help files ... > Done. > Further steps are described in './p400/Read-and-delete-me'. > export("x") > edd at rob:/tmp/skeleton$ > ----------------------------------------------------------------------------- > > In short, 4.0.0 no longer exports via 'exportPattern("^[[:alpha:]]+")' > rendering the new package created non-functional. > > Was this intentional, or is this a bug we can look into fixing for R 4.0.2 ?It's in the NEWS, so I'd assume it was intentional: - package.skeleton() now explicitly lists all exports in the ?NAMESPACE? file. An earlier version of that message even showed up in the link you posted. Duncan Murdoch> > Dirk > > > [1] This uses the GitHub mirror rather than svn but the underlying code is of > course the same > https://github.com/wch/r-source/commit/36b27d951fb355f268191a25909ab292a273932d#diff-a1b94fcea8b8818d4371aabf04dc2b3c >
Dirk Eddelbuettel
2020-Jun-06 19:51 UTC
[Rd] Change in package.skeleton behavior from R 3.6.3 to R 4.0.0 ?
On 6 June 2020 at 15:44, Duncan Murdoch wrote:
| On 06/06/2020 3:06 p.m., Dirk Eddelbuettel wrote:
| >
| > The Rcpp package and some related packages such as RcppArmadillo make use
of
| > (local) wrappers around the utils::package.skeleton() function for
creating
| > (basic yet functional) packages using Rcpp or RcppArmadillo. RStudio also
| > exposes this under the graphical menu as a nice way to construct a
package.
| >
| > But it seems that something changed quite recently in R. I looked into
this a
| > little yesterday and prepared a workaround for Rcpp; Kevin (CC'ed)
was more
| > diligent and found what changed with R itself. See the discussion under
issue
| > ticket #1087 at the Rcpp repo:
https://github.com/RcppCore/Rcpp/issues/1087
| > The proposed simple PR is at https://github.com/RcppCore/Rcpp/pull/1088
| >
| > As Kevin mentions in #1087, R itself may have changed, and he even dug up
a
| > possible commit [1]. One can illustrate that quickly with two different R
| > interpreters, I use Docker here because that's what I often do. I
apologise
| > for the long command-line; that is basically just common Docker
arguments.
| > The keys are r-base:3.6.3 and r-base:4.0.0 for selecting the relevant R
| > builds, and the command string passed to bash to call Rscript and
| > package.skeleton() followed by a cat of the NAMESPACE file.
| >
| >
-----------------------------------------------------------------------------
| > edd at rob:/tmp$ mkdir skeleton
| > edd at rob:/tmp$ cd skeleton/
| > edd at rob:/tmp/skeleton$ docker run --rm -ti -u1000:1000 -v ${PWD}:/mnt
-w /mnt r-base:3.6.3 bash -c "Rscript -e 'x <-1L;
package.skeleton(name=\"p363\")'; cat p363/NAMESPACE"
| > Creating directories ...
| > Creating DESCRIPTION ...
| > Creating NAMESPACE ...
| > Creating Read-and-delete-me ...
| > Saving functions and data ...
| > Making help files ...
| > Done.
| > Further steps are described in './p363/Read-and-delete-me'.
| > exportPattern("^[[:alpha:]]+")
| > edd at rob:/tmp/skeleton$ docker run --rm -ti -u1000:1000 -v ${PWD}:/mnt
-w /mnt r-base:4.0.0 bash -c "Rscript -e 'x <-1L;
package.skeleton(name=\"p400\")'; cat p400/NAMESPACE"
| > Creating directories ...
| > Creating DESCRIPTION ...
| > Creating NAMESPACE ...
| > Creating Read-and-delete-me ...
| > Saving functions and data ...
| > Making help files ...
| > Done.
| > Further steps are described in './p400/Read-and-delete-me'.
| > export("x")
| > edd at rob:/tmp/skeleton$
| >
-----------------------------------------------------------------------------
| >
| > In short, 4.0.0 no longer exports via
'exportPattern("^[[:alpha:]]+")'
| > rendering the new package created non-functional.
| >
| > Was this intentional, or is this a bug we can look into fixing for R
4.0.2 ?
|
| It's in the NEWS, so I'd assume it was intentional:
|
| - package.skeleton() now explicitly lists all exports in the
| ?NAMESPACE? file.
|
| An earlier version of that message even showed up in the link you posted.
My bad. I usually look there first too.
In which case the change is going to stay, so my quick adjustment to Rcpp
should be fine too.
Thanks for the prompt response.
Dirk
--
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
Duncan Murdoch
2020-Jun-06 19:53 UTC
[Rd] Change in package.skeleton behavior from R 3.6.3 to R 4.0.0 ?
On 06/06/2020 3:44 p.m., Duncan Murdoch wrote:> On 06/06/2020 3:06 p.m., Dirk Eddelbuettel wrote:... [deletions]>> In short, 4.0.0 no longer exports via 'exportPattern("^[[:alpha:]]+")' >> rendering the new package created non-functional. >> >> Was this intentional, or is this a bug we can look into fixing for R 4.0.2 ? > > It's in the NEWS, so I'd assume it was intentional: > > - package.skeleton() now explicitly lists all exports in the > ?NAMESPACE? file. > > An earlier version of that message even showed up in the link you posted.Something else in that link is presented more obviously in the svn log entry: r76945 | hornik | 2019-08-10 04:13:48 -0400 (Sat, 10 Aug 2019) | 1 line Changed paths: M /trunk/doc/NEWS.Rd M /trunk/src/library/utils/R/package.skeleton.R Have package.skeleton() explicitly list all exports. This change happened in August, 2019, about 10 months ago. Perhaps this message asking people to test R-devel is relevant: https://stat.ethz.ch/pipermail/r-devel/2020-May/079484.html Duncan Murdoch