Skip to content

Commit

Permalink
plumber v1.0.0 (#659)
Browse files Browse the repository at this point in the history
  • Loading branch information
schloerke committed Sep 14, 2020
1 parent 0b4b5b1 commit c051c6b
Show file tree
Hide file tree
Showing 33 changed files with 211 additions and 160 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Expand Up @@ -23,3 +23,4 @@
^vignettes$
^man-roxygen
rsconnect
^CRAN-RELEASE$
6 changes: 3 additions & 3 deletions .github/workflows/R-CMD-check.yaml
Expand Up @@ -24,7 +24,7 @@ jobs:
- {os: macOS-latest, r: 'release'}
- {os: macOS-latest, r: 'oldrel'}

- {os: windows-latest, r: 'devel'}
- {os: windows-latest, r: 'devel'}
- {os: windows-latest, r: 'release'}
# - {os: windows-latest, r: 'oldrel'} # do not test due to binaries not being created

Expand Down Expand Up @@ -71,8 +71,8 @@ jobs:
uses: actions/cache@v1
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ matrix.config.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ matrix.config.os }}-${{ hashFiles('.github/R-version') }}-1-
key: ${{ matrix.config.os }}-${{ hashFiles('.github/R-version') }}-2-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ matrix.config.os }}-${{ hashFiles('.github/R-version') }}-2-

# Install Cairo system dependencies
# used for svg testing
Expand Down
6 changes: 2 additions & 4 deletions DESCRIPTION
Expand Up @@ -2,7 +2,7 @@ Encoding: UTF-8
Package: plumber
Type: Package
Title: An API Generator for R
Version: 0.4.7.9000
Version: 1.0.0
Roxygen: list(markdown = TRUE)
Authors@R: c(
person("Barret", "Schloerke", role = c("cre", "aut"), email = "barret@rstudio.com"),
Expand All @@ -28,7 +28,7 @@ Imports:
crayon,
promises (>= 1.1.0),
sodium,
swagger (>= 3.20.3.99991),
swagger (>= 3.33.0),
magrittr,
mime,
lifecycle
Expand All @@ -45,8 +45,6 @@ Suggests:
yaml,
feather,
future
Remotes:
rstudio/swagger
RoxygenNote: 7.1.1
Collate:
'async.R'
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Expand Up @@ -134,7 +134,7 @@ plumber 1.0.0
* `randomCookieKey()` has been deprecated in favor of `random_cookie_key()` (#651)
* `sessionCookie()` has been deprecated in favor of `session_cookie()` (#651)

* DigitalOcean helper functions are now defunct (`do_*()`). The funtionality and documentation on how to deploy to DigitalOcean has been moved to [`plumberDeploy`](https://github.com/meztez/plumberDeploy) (by @meztez) (#649)
* DigitalOcean helper functions are now defunct (`do_*()`). The functionality and documentation on how to deploy to DigitalOcean has been moved to [`plumberDeploy`](https://github.com/meztez/plumberDeploy) (by @meztez) (#649)


### Minor new features and improvements
Expand Down
2 changes: 1 addition & 1 deletion R/plumb.R
Expand Up @@ -4,7 +4,7 @@
#' taking an incoming request, submitting it through the appropriate filters and
#' eventually to a corresponding endpoint, if one is found.
#'
#' See \url{http://www.rplumber.io/articles/programmatic-usage.html} for additional
#' See \url{https://www.rplumber.io/articles/programmatic-usage.html} for additional
#' details on the methods available on this object.
#' @param file The file to parse as the plumber router definition.
#' @param dir The directory containing the `plumber.R` file to parse as the
Expand Down
2 changes: 1 addition & 1 deletion R/plumber-static.R
Expand Up @@ -84,7 +84,7 @@ PlumberStatic <- R6Class(
#' @param topLevel a logical value. When method executed on top level
#' router, set to `TRUE`.
#' @param ... additional arguments for recursive calls
#' @return A terminal friendly represention of a `PlumberStatic()` router.
#' @return A terminal friendly representation of a `PlumberStatic()` router.
print = function(prefix="", topLevel=TRUE, ...){
cat(prefix)
if (!topLevel){
Expand Down
6 changes: 3 additions & 3 deletions R/plumber.R
Expand Up @@ -34,7 +34,7 @@ defaultPlumberFilters <- list(
#' taking an incoming request, submitting it through the appropriate filters and
#' eventually to a corresponding endpoint, if one is found.
#'
#' See \url{http://www.rplumber.io/articles/programmatic-usage.html} for additional
#' See \url{https://www.rplumber.io/articles/programmatic-usage.html} for additional
#' details on the methods available on this object.
#' @seealso
#' [pr()],
Expand Down Expand Up @@ -141,7 +141,7 @@ Plumber <- R6Class(
#' be listened on. Note that on most Unix-like systems including Linux and
#' Mac OS X, port numbers smaller than 1025 require root privileges.
#'
#' This value does not need to be explicitly assigned. To explicity set it, see [options_plumber()].
#' This value does not need to be explicitly assigned. To explicitly set it, see [options_plumber()].
#' @param debug Deprecated. See `$setDebug()`
#' @param swagger Deprecated. See `$setDocs(docs)` or `$setApiSpec()`
#' @param swaggerCallback Deprecated. See `$setDocsCallback()`
Expand Down Expand Up @@ -370,7 +370,7 @@ Plumber <- R6Class(
#' @param topLevel a logical value. When method executed on top level
#' router, set to `TRUE`.
#' @param ... additional arguments for recursive calls
#' @return A terminal friendly represention of a plumber router.
#' @return A terminal friendly representation of a plumber router.
print = function(prefix="", topLevel=TRUE, ...){
endCount <- as.character(sum(unlist(lapply(self$endpoints, length))))

Expand Down
2 changes: 1 addition & 1 deletion R/pr.R
Expand Up @@ -361,7 +361,7 @@ pr_hooks <- function(pr,
#' If not specified or a non-character is given, no SameSite policy is attached to the cookie.
#' @seealso \itemize{
#' \item \href{https://github.com/jeroen/sodium}{'sodium'}: R bindings to 'libsodium'
#' \item \href{https://download.libsodium.org/doc/}{'libsodium'}: A Modern and Easy-to-Use Crypto Library
#' \item \href{https://doc.libsodium.org/}{'libsodium'}: A Modern and Easy-to-Use Crypto Library
#' \item \href{https://github.com/r-lib/keyring}{'keyring'}: Access the system credential store from R
#' \item \href{https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#Directives}{Set-Cookie flags}: Descriptions of different flags for \code{Set-Cookie}
#' \item \href{https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting}{Cross-site scripting}: A security exploit which allows an attacker to inject into a website malicious client-side code
Expand Down
10 changes: 5 additions & 5 deletions R/serializer.R
Expand Up @@ -68,7 +68,7 @@ serializer_identity <- function(){
#' Return an attachment response
#'
#' This will set the appropriate fields in the `Content-Disposition` header value.
#' To make sure the attachement is used, be sure your serializer eventually calls `serializer_headers`
#' To make sure the attachment is used, be sure your serializer eventually calls `serializer_headers`
#'
#' @param value Response value to be saved
#' @param filename File name to use when saving the attachment.
Expand Down Expand Up @@ -324,8 +324,8 @@ serializer_cat <- function(..., type = "text/plain; charset=UTF-8") {
}

#' @describeIn serializers Write output to a temp file whose contents are read back as a serialized response. `serializer_write_file()` creates (and cleans up) a temp file, calls the serializer (which should write to the temp file), and then reads the contents back as the serialized value. If the content `type` starts with `"text"`, the return result will be read into a character string, otherwise the result will be returned as a raw vector.
#' @param write_fn Function that should write serialized contnet to the temp file provided. `write_fn` should have the function signature of `function(value, tmp_file){}`.
#' @param fileext A non-empty character vector giving the file extension. This value will try to be infered from the content type provided.
#' @param write_fn Function that should write serialized content to the temp file provided. `write_fn` should have the function signature of `function(value, tmp_file){}`.
#' @param fileext A non-empty character vector giving the file extension. This value will try to be inferred from the content type provided.
#' @export
serializer_write_file <- function(
type,
Expand Down Expand Up @@ -397,7 +397,7 @@ serializer_xml <- function() {
#' This method allows serializers to return `preexec`, `postexec`, and `aroundexec` (\lifecycle{experimental}) hooks in addition to a serializer.
#' This is useful for graphics device serializers which need a `preexec` and `postexec` hook to capture the graphics output.
#'
#' `preexec` and `postexec` hooks happend directly before and after a route is executed.
#' `preexec` and `postexec` hooks happened directly before and after a route is executed.
#' These hooks are specific to a single [PlumberEndpoint]'s route calculation.
#'
#' @param serializer Serializer method to be used. This method should already have its initialization arguments applied.
Expand Down Expand Up @@ -453,7 +453,7 @@ self_set_serializer <- function(self, serializer) {
#' @param dev_on Function to turn on a graphics device.
#' The graphics device `dev_on` function will receive any arguments supplied to the serializer in addition to `filename`.
#' `filename` points to the temporary file name that should be used when saving content.
#' @param dev_off Function to turn off the grahpics device. Defaults to [grDevices::dev.off()]
#' @param dev_off Function to turn off the graphics device. Defaults to [grDevices::dev.off()]
#' @export
serializer_device <- function(type, dev_on, dev_off = grDevices::dev.off) {

Expand Down
6 changes: 3 additions & 3 deletions R/session-cookie.R
Expand Up @@ -9,7 +9,7 @@
#' @section Storing secure keys:
#' While it is very quick to get started with user session cookies using
#' \code{plumber}, please exercise precaution when storing secure key information.
#' If a malicious person were to gain access to the secret \code{key}, they woud
#' If a malicious person were to gain access to the secret \code{key}, they would
#' be able to eavesdrop on all \code{req$session} information and/or tamper with
#' \code{req$session} information being processed.
#'
Expand Down Expand Up @@ -48,7 +48,7 @@
#' @export
#' @seealso \itemize{
#' \item \href{https://github.com/jeroen/sodium}{'sodium'}: R bindings to 'libsodium'
#' \item \href{https://download.libsodium.org/doc/}{'libsodium'}: A Modern and Easy-to-Use Crypto Library
#' \item \href{https://doc.libsodium.org/}{'libsodium'}: A Modern and Easy-to-Use Crypto Library
#' \item \href{https://github.com/r-lib/keyring}{'keyring'}: Access the system credential store from R
#' \item \href{https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#Directives}{Set-Cookie flags}: Descriptions of different flags for \code{Set-Cookie}
#' \item \href{https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting}{Cross-site scripting}: A security exploit which allows an attacker to inject into a website malicious client-side code
Expand Down Expand Up @@ -156,7 +156,7 @@ session_cookie <- function(

#' Random cookie key generator
#'
#' Uses a cryptographically secure pseudorandom number generator from [sodium::helpers()] to generate a 64 digit hexadecimal string. \href{https://github.com/jeroen/sodium}{'sodium'} wraps around \href{https://download.libsodium.org/doc/}{'libsodium'}.
#' Uses a cryptographically secure pseudorandom number generator from [sodium::helpers()] to generate a 64 digit hexadecimal string. \href{https://github.com/jeroen/sodium}{'sodium'} wraps around \href{https://doc.libsodium.org/}{'libsodium'}.
#'
#' Please see \code{\link{session_cookie}} for more information on how to save the generated key.
#'
Expand Down
8 changes: 4 additions & 4 deletions README.md
@@ -1,4 +1,4 @@
# `plumber` <a href='https://rstudio.github.io/plumber'><img src='man/figures/logo.svg' align="right" height="138.5" style="margin:10px;" /></a>
# `plumber` <a href='https://www.rplumber.io/'><img src='man/figures/logo.svg' align="right" height="138.5" style="margin:10px;" /></a>

<!-- badges: start -->
[![R build status](https://github.com/rstudio/plumber/workflows/R-CMD-check/badge.svg)](https://github.com/rstudio/plumber/actions)
Expand Down Expand Up @@ -51,9 +51,9 @@ pr("plumber.R") %>%

You can visit this URL using a browser or a terminal to run your R function and
get the results. For instance
[http://localhost:8000/plot](http://localhost:8000/plot) will show you a
`http://localhost:8000/plot` will show you a
histogram, and
[http://localhost:8000/echo?msg=hello](http://localhost:8000/echo?msg=hello)
`http://localhost:8000/echo?msg=hello`
will echo back the 'hello' message you provided.

Here we're using `curl` via a Mac/Linux terminal.
Expand Down Expand Up @@ -103,7 +103,7 @@ will be the best way to get started. You'll be able to get a server hosting your
custom API in just two R commands. To deploy to DigitalOcean, check out the
`plumber` companion package [`plumberDeploy`](https://github.com/meztez/plumberDeploy).

[RStudio Connect](https://www.rstudio.com/products/connect/) is a commercial
[RStudio Connect](https://rstudio.com/products/connect/) is a commercial
publishing platform that enables R developers to easily publish a variety of R
content types, including Plumber APIs. Additional documentation is available at
https://www.rplumber.io/articles/hosting.html#rstudio-connect-1.
Expand Down
157 changes: 78 additions & 79 deletions cran-comments.md
@@ -1,88 +1,87 @@
# Comments
## Comments

## 2018-6-4
This submission is done by Barret Schloerke <barret@rstudio.com> on behalf of Jeff Allen <cran@trestletech.com>. Please submit any changes to be made to <barret@rstudio.com>.
#### 2020-9-14

- Barret
I've fixed the urls and resubmitting.

Best,
Barret

## Test environments
#### 2020-9-14

All NOTEs related to invalid URLs http:localhost:8000 are **false positives**. The URL makes sense when looking at the example within the README.md file.
Flavor: r-devel-linux-x86_64-debian-gcc
Check: CRAN incoming feasibility, Result: NOTE
Maintainer: 'Barret Schloerke <barret@rstudio.com>'

New maintainer:
Barret Schloerke <barret@rstudio.com>
Old maintainer(s):
Jeff Allen <cran@trestletech.com>

* local OS X install, R 3.5.0, --run-dontcheck
* checking CRAN incoming feasibility ... NOTE
Found the following (possibly) invalid URLs:
URL: http://localhost:8000/echo?msg=hello
From: README.md
Status: Error
Message: libcurl error code 7:
Failed to connect to localhost port 8000: Connection refused
URL: http://localhost:8000/plot
From: README.md
Status: Error
Message: libcurl error code 7:
Failed to connect to localhost port 8000: Connection refused
* 0 errors | 0 warnings | 1 notes

* ubuntu 14.04.5 (on travis-ci), R version 3.5.0 (2017-01-27)
* 0 errors | 0 warnings | 0 notes
URL: https://rstudio.github.io/plumber (moved to https://www.rplumber.io/)
From: README.md
Status: 200
Message: OK
URL: https://www.rstudio.com/products/connect/ (moved to https://rstudio.com/products/connect/)
From: README.md
Status: 200
Message: OK

#### 2020-9-14

This is a major version update.

Please let me know if there is anything else I can provide.

Thank you,
Barret

#### 2020-9-14

Confirmed! You may change the maintainer.

- Jeff

#### 2020-9-14

Hi Jeff,

I'm emailing to have a formal request to change the maintainer in `plumber` to Barret Schloerke...
My I change `plumber`'s maintainer to Barret Schloerke?

Thank you,
Barret


## Test environments

* local macOS, R 4.0.0
* GitHub Actions
* macOS
* oldrel, release, devel
* windows
* oldrel, release, devel
* ubuntu18
* 3.4, 3.5, oldrel, release, devel
* ubuntu16
* 3.4, 3.5, oldrel, release, devel

0 errors ✔ | 0 warnings ✔ | 0 notes ✔

* devtools::build_win()
* x86_64-w64-mingw32, R version 3.5.0 (2018-04-23)
* x86_64-w64-mingw32, R Under development (unstable) (2018-06-03 r74839)
* checking CRAN incoming feasibility ... NOTE
Found the following (possibly) invalid URLs:
URL: http://localhost:8000/echo?msg=hello
From: README.md
Status: Error
Message: libcurl error code 7:
Failed to connect to localhost port 8000: Connection refused
URL: http://localhost:8000/plot
From: README.md
Status: Error
Message: libcurl error code 7:
Failed to connect to localhost port 8000: Connection refused
* 0 errors | 0 warnings | 1 note


* r-hub

* Platform: Ubuntu Linux 16.04 LTS, R-release, GCC
* checked with `_R_CHECK_FORCE_SUGGESTS_=0`
http://builder.r-hub.io/status/plumber_0.4.6.tar.gz-7eb7117f2cf74e1b8880c46e7819ab61
❯ checking CRAN incoming feasibility ... NOTE
Maintainer: ‘Jeff Allen <cran@trestletech.com>

Found the following (possibly) invalid URLs:
URL: http://localhost:8000/echo?msg=hello
From: README.md
Status: Error
Message: libcurl error code 7:
Failed to connect to localhost port 8000: Connection refused
URL: http://localhost:8000/plot
From: README.md
Status: Error
Message: libcurl error code 7:
Failed to connect to localhost port 8000: Connection refused
0 errors ✔ | 0 warnings ✔ | 1 note ✖


* rhub platform issues not related to code. These operating systems failed to complete properly and I do not have the ability to fix the error.
* Windows Server 2008 R2 SP1, R-release, 32/64 bit
* 'stringi' is not available
* Windows Server 2008 R2 SP1, R-devel, 32/64 bit
* 'stringi' is not available
* Fedora Linux, R-devel, clang, gfortran
* Has trouble opening a png device


## Reverse dependencies

* Revdep maintainers were not contacted as this release is for bug fixes and enhancements from particular maintainers.

* I have run R CMD check on the 3 downstream dependencies.
* https://github.com/trestletech/plumber/blob/master/revdep/problems.md
* No errors, warnings, or notes were introduced due to changes in leaflet

* All revdeps were able to be tested
* checking CRAN incoming feasibility ... NOTE
Maintainer: 'Barret Schloerke <barret@rstudio.com>'

New maintainer:
Barret Schloerke <barret@rstudio.com>
Old maintainer(s):
Jeff Allen <cran@trestletech.com>
Status: 1 NOTE

## revdepcheck results

We checked 8 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package.

* We saw 0 new problems
* We failed to check 0 packages

0 comments on commit c051c6b

Please sign in to comment.