Split-Apply-Combine Post

All that legal stuff…
Author

Harun Celik

Published

March 9, 2023

Frontmatter check Render rmarkdown

Prompt:

The DESCRIPTION file of a package contains the package’s meta information. Most of the fields in this file are quite straight forward: author, version number, and a short package description. When you call library(help="<package name>") for package <package name> you can see the contents of the DESCRIPTION file for that package (and some parts of the NAMESPACE file).

Read through Colin Fay’s (short) book on Licensing R

Write a blog post addressing the following questions:

Under what license does R operate? What is the license for ggplot2?

Running license() shows us that R operates under the GNU General Public License for both Version 2 and Version 3. Running ?ggplot2 shows that the copyright holder is with RStudio and the CRAN repository for the package indicates that gpplot2 operates under the MIT + file LICENSE.

What are the dependencies of the package you made?

The following are the dependencies of our package based on our manual addition of the usethis package:

  • dplyr - MIT + file LICENSE (formerly GPL license)

  • lubridate - GNU GPL (>=2) (it would be interesting to see what happens to this now that it will roll with tidyverse)

  • readr - MIT + file LICENSE

  • purrr - MIT + file LICENSE

  • stringr - MIT + file LICENSE

  • tabulizer - MIT + file LICENSE

We can check all of the dependencies with a custom function that filters through CRAN database since most of the these are on CRAN.

library(dplyr)

Attaching package: 'dplyr'
The following objects are masked from 'package:stats':

    filter, lag
The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union
pkgdb <- tools::CRAN_package_db()

The author of the book suggested using {pkgnet} but I had trouble understanding exactly what the custom function was doing there so I just filtered through the pkgdb data and output the items as a list for legibility. This will show the dependencies, imports and suggests for each package listed above.

get_deps <- function(pkg) {
  pkgdb %>%
    select(Package, Depends, Imports, Suggests) %>%
    filter(Package == pkg) %>%
    as.list()
}

get_deps("dplyr")
$Package
[1] "dplyr"

$Depends
[1] "R (>= 3.4.0)"

$Imports
[1] "cli (>= 3.4.0), generics, glue (>= 1.3.2), lifecycle (>=\n1.0.3), magrittr (>= 1.5), methods, pillar (>= 1.5.1), R6,\nrlang (>= 1.0.6), tibble (>= 2.1.3), tidyselect (>= 1.2.0),\nutils, vctrs (>= 0.5.2)"

$Suggests
[1] "bench, broom, callr, covr, DBI, dbplyr (>= 2.2.1), ggplot2,\nknitr, Lahman, lobstr, microbenchmark, nycflights13, purrr,\nrmarkdown, RMySQL, RPostgreSQL, RSQLite, stringi (>= 1.7.6),\ntestthat (>= 3.1.5), tidyr (>= 1.3.0), withr"
get_deps("lubridate")
$Package
[1] "lubridate"

$Depends
[1] "methods, R (>= 3.2)"

$Imports
[1] "generics, timechange (>= 0.1.1)"

$Suggests
[1] "covr, knitr, rmarkdown, testthat (>= 2.1.0), vctrs (>= 0.5.0)"
get_deps("purrr")
$Package
[1] "purrr"

$Depends
[1] "R (>= 3.4.0)"

$Imports
[1] "cli (>= 3.4.0), lifecycle (>= 1.0.3), magrittr (>= 1.5.0),\nrlang (>= 0.4.10), vctrs (>= 0.5.0)"

$Suggests
[1] "covr, dplyr (>= 0.7.8), httr, knitr, lubridate, rmarkdown,\ntestthat (>= 3.0.0), tibble, tidyselect"
get_deps("readr")
$Package
[1] "readr"

$Depends
[1] "R (>= 3.5)"

$Imports
[1] "cli (>= 3.2.0), clipr, crayon, hms (>= 0.4.1), lifecycle (>=\n0.2.0), methods, R6, rlang, tibble, utils, vroom (>= 1.6.0)"

$Suggests
[1] "covr, curl, datasets, knitr, rmarkdown, spelling, stringi,\ntestthat (>= 3.1.2), tzdb (>= 0.1.1), waldo, withr, xml2"
get_deps("stringr")
$Package
[1] "stringr"

$Depends
[1] "R (>= 3.3)"

$Imports
[1] "cli, glue (>= 1.6.1), lifecycle (>= 1.0.3), magrittr, rlang\n(>= 1.0.0), stringi (>= 1.5.3), vctrs"

$Suggests
[1] "covr, htmltools, htmlwidgets, knitr, rmarkdown, testthat (>=\n3.0.0)"
# Not surprisingly tabulizer doesn't return any values since it is not on CRAN
get_deps("tabulizer")
$Package
character(0)

$Depends
character(0)

$Imports
character(0)

$Suggests
character(0)

For tabulizer, we will need to get this information from the github repository for the package in the DESCRIPTION file. The only way I’ve thought of being able to access this is through the URL but I don’t think this is modular enough for all packages installed on github with differing remote urls. The {desc} package seems only helpful for manipulating already documented DESCRIPTION files, while the {remotes} package seems to provide options for installation, I could not figure out how to retrieve the DESCRIPTION data for a particular package :(

Read through chapter 5.2 of Licensing R. Combine and adjust the code pieces to create the dependencies for a package that is on github rather than CRAN. (Don’t forget about the package desc.) What dependencies does the package have that you created for Lab-3? Which licenses are involved? Are all of these dependencies required? Elaborate.

Under which license should this blog post be published? Make sure that you are using an appropriate license. (You can change the current licenses with the help of commands from the use_license_XXX family in the usethis package)

This blog currently is operating under the Creative Commons Legal Code CC0 1.0 Universal license. It does use RMarkdown which operates under the GNU General Public License and the GNU recommends that the license be distributed in the form of a GPL. To change this, we can use the {usethis} package.

library("usethis")
usethis::use_gpl_license(version = 3)
✔ Setting active project to '/Users/hofmann/Documents/Teaching/Stat 585/Spring 2023/Stat585-at-ISU.github.io'
✔ Writing 'LICENSE.md'
✔ Adding '^LICENSE\\.md$' to 'blog-2023/Blog-7-submissions/HarunCelikOtto/.Rbuildignore'

This package is now licensed by GPL Version 4. This can be checked in the License.md file.

Can I publish an R package on CRAN under an MIT license when I have a dependency on a package that is licensed under GPL-3?

When confronted with the above question, ChatGPT gave two – quite different – responses, as shown below. The main point in both responses is ‘your package may be considered derivative work’. At the specific problem of the package developed for Lab 3, what is your opinion about potential copyright infringements when releasing the package with an MIT license? Make sure to take the relevant passage in Colin Fay’s book under consideration.

The legal implications of publishing an R package on CRAN under an MIT license while having a dependency on a package that is licensed under GPL-3 are complex and can vary depending on the specific circumstances. It is always advisable to seek legal advice from a licensed attorney if you have any doubts or concerns about licensing issues.

However, in general, it is possible to publish an R package on CRAN under an MIT license when you have a dependency on a package that is licensed under GPL-3. This is because the MIT license is a permissive open-source license that allows for more flexibility in how the software can be used and distributed, and it is generally considered compatible with the GPL-3 license.

That being said, if your package depends on a GPL-3-licensed package, your package may be considered a derivative work and therefore subject to the terms of the GPL-3 license. This means that if you distribute your package, you may need to also distribute the source code for your package under the GPL-3 license or a compatible license, and you may need to ensure that the requirements of the GPL-3 license are met for the entire distribution, including any dependencies.

It is also worth noting that the R community has its own guidelines and recommendations for package licensing, and it is important to comply with these guidelines if you want to publish your package on CRAN. The CRAN Repository Policy states that packages should have a "permissive" or "GPL-compatible" license, but does not explicitly require that packages use the GPL license or any other specific license.

In summary, while it is possible to publish an R package on CRAN under an MIT license while having a dependency on a package that is licensed under GPL-3, it is important to understand the implications of the different licenses and to ensure that you comply with any applicable guidelines and recommendations from the R community.

After harping a bit on copyright infringement in general, ChatGPT changed its response to

Technically, you can publish an R package on CRAN under an MIT license when you have a dependency on a package that is licensed under GPL-3, but doing so would not be compliant with the terms of the GPL-3 license.

The GPL-3 license is a strong copyleft license that requires derivative works to be released under the same license. If your package depends on a GPL-3-licensed package, your package may be considered a derivative work and therefore must be licensed under the GPL-3 license or a compatible license.

The MIT license, on the other hand, is a permissive license that allows for more flexibility in how the software is used and distributed. However, it is not compatible with the GPL-3 license, and therefore cannot be used for derivative works of GPL-3-licensed software.

Publishing an R package on CRAN under an MIT license when you have a dependency on a package that is licensed under GPL-3 would be a licensing violation, and could potentially result in legal action or other consequences. It is important to comply with the licensing requirements of all dependencies in your package to avoid any legal issues.

The ‘harping’ questions:

  • Is it legal to publish an R package on CRAN under an MIT license when I have a dependency on a package that is licensed under GPL-3?

  • Is it illegal to publish an R package on CRAN under an MIT license when I have a dependency on a package that is licensed under GPL-3?

  • Is it a copyright infringement to publish an R package on CRAN under an MIT license when I have a dependency on a package that is licensed under GPL-3?

  • Can I publish an R package on CRAN under an MIT license when I have a dependency on a package that is licensed under GPL-3 without infringing copyright?

Submission

Write answers to the questions directly into the file README.Rmd. Push the blog post to your blog-7 repo. Make sure that all of the checks are passing.