Change in package.skeleton behavior from R 3.6.3 to R 4.0.0 ?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Change in package.skeleton behavior from R 3.6.3 to R 4.0.0 ?

Dirk Eddelbuettel

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@rob:/tmp$ mkdir skeleton
edd@rob:/tmp$ cd skeleton/
edd@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@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@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 | [hidden email]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Change in package.skeleton behavior from R 3.6.3 to R 4.0.0 ?

Duncan Murdoch-2
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@rob:/tmp$ mkdir skeleton
> edd@rob:/tmp$ cd skeleton/
> edd@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@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@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
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Change in package.skeleton behavior from R 3.6.3 to R 4.0.0 ?

Dirk Eddelbuettel

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@rob:/tmp$ mkdir skeleton
| > edd@rob:/tmp$ cd skeleton/
| > edd@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@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@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 | [hidden email]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Change in package.skeleton behavior from R 3.6.3 to R 4.0.0 ?

Duncan Murdoch-2
In reply to this post by Duncan Murdoch-2
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

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Change in package.skeleton behavior from R 3.6.3 to R 4.0.0 ?

Dirk Eddelbuettel

On 6 June 2020 at 15:53, Duncan Murdoch wrote:
| 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

Touche :) And fully agree. Rcpp's unit tests covered Rcpp.package.skeleton()
since about 2013. I have been keeping a local 'RD' build of R-devel in
/usr/local/ for much longer to test both r-release and r-devel.  But test
coverage is never full or complete, and what bit me here during a live demo
(now at [1]) was the equivalent functionality tickled with from RStudio with
similar-but-not-identical code.

And that part is certainly NOT contained in the unit tests. Can't win'em
all. Still my bad for not checking NEWS, and bad luck this change did not get
tickled by the many Rcpp tests runs here since the change was made.

Dirk

[1] https://www.youtube.com/watch?v=1Zap6j1uUyw
--
http://dirk.eddelbuettel.com | @eddelbuettel | [hidden email]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Change in package.skeleton behavior from R 3.6.3 to R 4.0.0 ?

Duncan Murdoch-2
On 06/06/2020 4:14 p.m., Dirk Eddelbuettel wrote:

>
> On 6 June 2020 at 15:53, Duncan Murdoch wrote:
> | 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
>
> Touche :) And fully agree. Rcpp's unit tests covered Rcpp.package.skeleton()
> since about 2013. I have been keeping a local 'RD' build of R-devel in
> /usr/local/ for much longer to test both r-release and r-devel.  But test
> coverage is never full or complete, and what bit me here during a live demo
> (now at [1]) was the equivalent functionality tickled with from RStudio with
> similar-but-not-identical code.
>
> And that part is certainly NOT contained in the unit tests. Can't win'em
> all. Still my bad for not checking NEWS, and bad luck this change did not get
> tickled by the many Rcpp tests runs here since the change was made.

The trouble with tests is that they make you think you've tested the
code, and we all know that's impossible.

Duncan

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel