Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to satisfy both CRAN and Github license file naming requirements

Tags:

github

r

cran

(NOTE: This question includes the word "license". But let's be clear: this question is not asking for licensing advice. It is asking how to simultaneously satisfy the file naming requirements of "software tools commonly used by programmers": Github and CRAN. This question could just as easily be about README files. The mere use of the word "license" seems to make folks trigger happy with their close votes.)

I have an R package who's code I'd like to keep on Github.

In accordance with R's requirements (see here for a note about template licenses), I have in my DESCRIPTION file the line:

License: MIT + file LICENCE

And my LICENCE file contains the MIT template, as required:

YEAR: 2017
COPYRIGHT HOLDER: Don Quixote

Github used to figure out licensing only by looking at the LICENSE file, which allowed me to keep the MIT text in LICENSE so that Github would detect it and the CRAN template in LICENCE so that CRAN would detect it. This approach used .Rbuildignore to hide the Github LICENSE from CRAN.

But now, a darkness has fallen on the land: Github looks at both LICENSE and LICENCE. Finding them different, it abandons its attempt to determine the project's license.

As a result, it does not seem possible to use the MIT license, or other templated licenses, in a way which satisfies both CRAN and Github.

Renaming my CRAN license template file from LICENCE to LICENCE.template would fix the issue, but then CRAN complains about a non-standard file.

I could omit a the CRAN license template file from the git repo, but then I'm not sacrificing version control for expediency.

Is there a workaround?

like image 360
Richard Avatar asked Apr 21 '17 19:04

Richard


People also ask

What license should I put on my GitHub repository?

One of the most restrictive licenses is GPL. One of the most permissive licenses is MIT. Other popular licenses are Apache License 2.0 and BSD. To apply a license on your GitHub project, you need to create a LICENSE file using GitHub's license templates.

How do I assign a license to GitHub?

In the file name field, type LICENSE or LICENSE.md (with all caps). To the right of the file name field, click Choose a license template. On the left side of the page, under "Add a license to your project," review the available licenses, then select a license from the list. Click Review and submit.

How does GitHub detect license?

Detecting a licenseThe open source Ruby gem Licensee compares the repository's LICENSE file to a short list of known licenses. Licensee also provides the Licenses API and gives us insight into how repositories on GitHub are licensed.

Does GitHub have a default license?

When you make a creative work (which includes code), the work is under exclusive copyright by default. Unless you include a license that specifies otherwise, nobody else can copy, distribute, or modify your work without being at risk of take-downs, shake-downs, or litigation.


2 Answers

There was an extended discussion on this topic in the tidyr issues (Hadley Wickham participated, which adds a little extra credibility). The solution was to use the two-line CRAN template as LICENSE (for CRAN) and then the full MIT license in LICENSE.md and add that to .Rbuildignore (for GitHub). See the relevant pull for tidyr.

This is a similar solution to the current top answer, but it feels cleaner to me as it does not use a spelling-based "hack".

Update (January 2021): As Konrad Rudolph pointed out in the comments, GitHub will now ignore LICENSE.md if LICENSE is present.

Update (August 2022): GitHub will now detect both LICENSE.md and LICENSE and will display something like "Unknown, MIT licenses found".

like image 63
burger Avatar answered Oct 12 '22 08:10

burger


My current approach, based on Thomas's comment is as follows:

  • The file LICENCE contains the MIT template license, per CRAN's requirements. It is now listed in .gitignore, so that it doesn't mess with Github.

  • The file LICENSE contains the actual MIT license, per Github's requirements. It is not listed in .Rbuildignore, so that it doesn't mess with CRAN.

Of course, this is not an ideal solution because now neither CRAN nor Github is accurately archiving the whole code base. In particular, if the code is acquired from Github it is not in a state where it would be permissible to upload it to CRAN. If the code's acquired from CRAN, it would merely be non-cooperative to post it on Github (since Github would not deduce the license).

like image 5
Richard Avatar answered Oct 12 '22 09:10

Richard