Skip to content

[R-pkg-devel] LICENSE file in an R package for CRAN submission

7 messages · Emanuele Cordano, Ivan Krylov, Ben Bolker +3 more

#
Dear list,

is there a way to put the LICENSE file within an R package like in Github,
I have an R package on Github with a a LICENSE file compliant to Github and
containing the text of the licence citing in the DESCRIPION file. But when
I check the package , I obatained the following output:

* checking top-level files ... NOTE
File
  LICENSE

is not mentioned in the DESCRIPTION file.

How can I solve this?
Thank you
best
Emanuele Cordano
#
You have two choices:

* put LICENSE in your .Rbuildignore file so that it shows up on Github 
but is excluded from the package

* follow the instructions in 
https://cran.r-project.org/doc/manuals/R-exts.html#Licensing to refer to 
LICENSE in your DESCRIPTION file. However, CRAN generally prefers that 
you use a standard license ("GPL-2", "GPL-3"), to make it easier for 
them to know that you've really complied with their openness 
requirements, and that you *not* include a license file that is 
redundant with that spec:

 > Whereas you should feel free to include a license file in your source 
distribution, please do not arrange to install yet another copy of the 
GNU COPYING or COPYING.LIB files but refer to the copies on 
https://www.R-project.org/Licenses/ and included in the R distribution 
(in directory share/licenses). Since files named LICENSE or LICENCE will 
be installed, do not use these names for standard license files. To 
include comments about the licensing rather than the body of a license, 
use a file named something like LICENSE.note.
On 2023-08-09 11:06 a.m., Emanuele Cordano wrote:

  
    
#
On Wed, 9 Aug 2023 17:06:01 +0200
Emanuele Cordano <emanuele.cordano at gmail.com> wrote:

            
What is the license? If it's something like GPL, just add LICENSE to
.Rbuildignore so that it stays in the repo, satisfying GitHub, but
doesn't get included inside the package file, satisfying R CMD check.

If it's something like MIT where you have to name the copyright holder
and the copyright year, things become more complicated.

See <https://cran.r-project.org/doc/manuals/R-exts.html#Licensing> for
the precise requirements.
#
In case you're thinking of putting the package on CRAN, note also from 
the CRAN policy https://cran.r-project.org/web/packages/policies.html:

 > Packages with licenses not listed at 
https://svn.r-project.org/R/trunk/share/licenses/license.db will 
generally not be accepted.
On 2023-08-09 11:15 a.m., Ben Bolker wrote:

  
    
#
If you're using one of the licenses supported by usethis
(https://usethis.r-lib.org/reference/licenses.html), you can just call
the appropriate function and it will do all the setup required to be
both CRAN and GitHub compatible.

Hadley

On Wed, Aug 9, 2023 at 10:10?AM Emanuele Cordano
<emanuele.cordano at gmail.com> wrote:

  
    
7 days later
#
Although late to the party, I thought I might chime in with a different take on the question. 

Most answers seem to pertain to the actual license used for the package. For my part, I read the question as: "GitHub wants me to have a LICENSE file at the root of the repository, but R CMD check complains about it. What should I do?"

If you need to use the LICENSE file in your package, Ben Bolker already pointed you at the correct way to do it.

If the file is just there to please GitHub (and in any case), here's what I tend to do: put the source code of your package in a subdirectory (say 'src') of the repository. You may then put the GitHub files (README.md, LICENSE, whatever else) at the top level without interfering with R CMD build/check. The added benefit is that you will then build the package in the directory of the project (say 'mypkg') with 'R CMD build src' and end up with a file .../mypkg/mypkg_x.y-z.tar.gz, rather than in the parent directory of 'mypkg'.

(Mind you, I build my packages manually. The tidyverse tools may very well take care of this sort of things automatically and I wouldn't know.)

Hope this helps,

v.

Vincent Goulet
Professeur titulaire
?cole d'actuariat, Universit? Laval
#
On Wed, Aug 16, 2023 at 11:41?AM Vincent Goulet <vincent.goulet at me.com> wrote:
Another alternative is put everything you don't want to be included in
your package in the .Rbuildignore file. For example:
https://github.com/joshuaulrich/xts/blob/main/.Rbuildignore
I also build my packages manually (with a makefile) and have my own
personal preferences, so the patterns in my file may need to be
changed for others' packages.
--
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com