From 805430ee4a417ea718231537fa50e227b5cc3ab9 Mon Sep 17 00:00:00 2001 From: alexvmt Date: Thu, 28 Nov 2024 01:47:15 +0000 Subject: [PATCH] chore(template): merge template changes :up: --- CHANGELOG_SDK.md | 3 + Dockerfile | 2 +- developer_README.md | 122 +++++++++++------------------------- renv.lock | 146 ++++++++++++++++++++------------------------ 4 files changed, 106 insertions(+), 167 deletions(-) diff --git a/CHANGELOG_SDK.md b/CHANGELOG_SDK.md index 0bc4e0f..4f557fc 100644 --- a/CHANGELOG_SDK.md +++ b/CHANGELOG_SDK.md @@ -1,4 +1,7 @@ # Changelog SDK +## XXX XXX +- update of `README.md` including new sections +- update of `developer_README.md` ## 2024-03 `v3.2.0` diff --git a/Dockerfile b/Dockerfile index e54f0bc..e802889 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ # MoveApps R-SHINY SDK ######################################################################################################################## -FROM rocker/geospatial:4.3.2 +FROM rocker/geospatial:4.4.2 LABEL maintainer = "couchbits GmbH " diff --git a/developer_README.md b/developer_README.md index e71faa6..ab75490 100644 --- a/developer_README.md +++ b/developer_README.md @@ -1,73 +1,42 @@ # MoveApps R-SHINY Software Development Kit (SDK) -#### ***NOTE*: this SDK only supports code written for input data of class `move2` and not `moveStack`, as all input data of class `moveStack` will be converted to class `move2`. For all other input/output types, this SDK works as usual. Please contact us under support@moveapps.org if you have any questions.** +***NOTE*: this SDK supports code written for input data of class `move2` and not `moveStack`, as all input data of class `moveStack` will be converted to class `move2`. For all other input/output types, this SDK works as usual. Please contact us under support@moveapps.org if you have any questions.** This documentation provides a short introduction to the [MoveApps](https://www.moveapps.org) **R-SHINY SDK**. -As a first step, and before your read this, you should have forked this GitHub template to your personal space and named the repository as your App will be named in MoveApps. - -A general overview provides the [MoveApps user manual](https://docs.moveapps.org/#/create_app) - -# Overview - -This template is designed according to a file structure that is necessary for your App to run in your local development environment similar to the way it will run in the MoveApps environment later. Please contain the structure and only change/add files as necessary for your App's functionality. See below which files can be changed and which should remain as is for simulation of the behaviour on MoveApps on your local system. A stepwise explanation below indicates the function and some background of each file and folder. - -## File structure - -(truncated) - -``` -. -├── Dockerfile -├── README.md -├── Template_R_Shiny_App.Rproj -├── ShinyModule.R -├── appspec.json -├── data -│   ├── auxiliary -│   ├── output -│   └── raw -│   ├── input1.rds -│   ├── input2.rds -│   ├── input3.rds -│   └── input4.rds -├── renv.lock -├── sdk.R -├── src -│   ├── common -│   │   ├── logger.R -│   ├── io -│   │   ├── app_files.R -│   │   ├── io_handler.R -│   │   ├── rds.R -│   │   └── shiny_bookmark_handler.R -│   └── moveapps.R -└── start-process.sh - - -``` - -1. `./ShinyModule.R`: This is the entrypoint for your App logic. MoveApps will call this module during a workflow execution which includes your App. **The file must be named `ShinyModule.R`, do not alter it!** -1. `./appspec.json`: This file defines the settings and metadata of your App, for details refer to the [MoveApps User Manual](https://docs.moveapps.org/#/appspec) -1. `./renv.lock`: Definition of the dependencies of your App. We use `renv` as library manager. Optional. +As a first step, and before your read this, you should have used this GitHub template to create a copy of it in your personal space and named the repository as your App will be named in MoveApps. + +**The [MoveApps User Manual](https://docs.moveapps.org/#/create_app) provides a step-by-step explanation of how to create an App.** Please carefully follow these steps when creating a MoveApps App. + + +## Files in the SDK/template + +This template is designed according to a file structure that is necessary for your App to run in your local development environment similar to the way it will run in the MoveApps environment later. Please contain the structure and only change/add files as necessary for your App's functionality. Take a look at the [overview in the User Manual](https://docs.moveapps.org/#/create_app) to see which files can be changed and which should remain as is for simulation of the behaviour on MoveApps on your local system. + +Here you find an overview of the files and their function in the SDK: + +1. `./ShinyModule.R`: must be modified by the developer. This is the entrypoint for your App logic. MoveApps will call this function during a Workflow execution which includes your App. The file must be named `ShinyModule.R`, do not alter it. See [Step 3](https://docs.moveapps.org/#/create_app#step-3-develop-the-app-code-locally-within-the-template) in the User Manual. +1. `./appspec.json`: must be modified by the developer. This file defines the settings and metadata of your App. See [Step 5](https://docs.moveapps.org/#/create_app#step-5-write-app-specifications) in the User Manual. +1. `1. `./README.md`: must be modified by the developer. Provided template for the documentation of the App (see [Step 6](https://docs.moveapps.org/#/create_app#step-6-write-a-documentation-file) in the User Manual). +1. `./renv.lock`: Definition of the dependencies of your App. We use `renv` as library manager. Optional, see below. 1. `./data/**`: Resources of the SDK - 1. `auxiliary/**`: Simulates the usage of [*auxiliary App files*](https://docs.moveapps.org/#/auxiliary). You can put files into this folder to simulate an App run with provided/user-uploaded files. - 1. `output/**`: If your App produces [*artefacts*](https://docs.moveapps.org/#/copilot-r-sdk?id=artefacts) they will be stored here. +1. `./sdk.R`: use for App testing. The main entrypoint of the SDK. Use it to execute your App in your compiler (e.g. RStudio). +1. `/.env`: adjust for App testing. Defining the SDK Runtime environment, see below. Make sure to check _Show Hidden Files_ in the settings menu of the _Files_ tab in RStudio. +1. `./data/**`: use for App testing. Resources of the SDK + 1. `auxiliary/**`: Simulates the usage of [*auxiliary files*](https://docs.moveapps.org/#/auxiliary). You can put files into this folder to simulate an App run with provided/user-uploaded files. + 1. `output/**`: The output data (`output.rds`) that will be passed on to the next App in a Workflow and other output files (artifacts) that your App may produce will be stored here. See [*producing artifacts*](https://docs.moveapps.org/#/copilot-shiny-sdk?id=producing-artefacts) for more information. 1. `raw/**`: Collection of sample App input data. You can use these samples to simulate an App run with real input. -1. `./sdk/**`: The (internal) MoveApps R SDK logic. -1. `./sdk.R`: The main entry point of the SDK. Use it to execute your App in your IDE. +1. all remaining files are used to emulate MoveApps when testing the App locally, to setup the automatic sync of your repository with the template, or to provide information related to the template. **These files are not to be modified**. Modifying them will prevent you from testing your App appropriately. -## SDK Runtime environment +## SDK runtime environment -Critical parts of the SDK can be adjusted by `environment variables`. -Keep in mind that these variables are only changeable during App development and not during an App run on MoveApps. -They are predefined with sensible defaults - they should work for you as they are. +Critical parts of the SDK can be adjusted by `environment variables`. Keep in mind that these variables are only changeable during App development and not during an App run on MoveApps. They are predefined with sensible defaults - they should work for you as they are. While testing your App you will want to modify the `SOURCE_FILE` variable to either call the different example data sets provided in the template or other data sets that you want to use to test your App. - `SOURCE_FILE`: path to an input file for your App during development - `OUTPUT_FILE`: path to the output file of your App +- `ERROR_FILE`: path to a file collecting error messages - `APP_ARTIFACTS_DIR`: base directory for writing App artifacts -- `USER_APP_FILE_HOME_DIR`: home aka base directory of your local user App files (*auxiliary*) -- ~~`LOCAL_APP_FILES_DIR`~~: Deprecated! base directory of your local App files (*auxiliary*) +- `USER_APP_FILE_HOME_DIR`: home aka base directory of your local user/auxiliary App files - `CLEAR_OUTPUT`: clears all output of the previously app run at each start of the SDK aka the next app start You can adjust these environment variables by adjusting the file `./.env`. @@ -78,51 +47,29 @@ The file `./.env` is **hidden** by default in `RStudio`! You can show it by 1. `More` Button in the Files-Toolbar 1. Activate _Show Hidden Files_ + ## MoveApps App Bundle Which files will be bundled into the final App running on MoveApps? - the file `./ShinyModule.R -- all directories defined in your `appspec.json` at `providedAppFiles` - -Nothing else. - -Note that many App features will be set and updated with information from the `appspec.json` in each new App version. Thus, even if not bundled into the App, this file is required and must be up to date. - +- all directories defined in your `appspec.json` at `providedAppFiles` -## App development +- the file `./appspec.json` will be used to build and create the metadata of your App +- the file `./README.md` will be reference to for the documentation of your App -1. Execute `Rscript sdk.R` (on a terminal) or run/source `sdk.R` in _RStudio_ (_Run App_) -1. Ensure the sdk executes the vanilla template App code. Everything is set up correctly if no error occurs and you can open the Shiny App in your local Web-Browser. -1. Begin with your App development in `./ShinyModule.R` - -## Examples - -### Request App configuration from your users - -tbd (Shiny Bookmark instructions) - -### Produce an App artefact - -tbd (should be supported by SDK - must be tested by sample app implementation. Provide code snippets) - -## Include files to your App - -[Details and examples about _auxiliary files_](https://docs.moveapps.org/#/auxiliary). - -This template also implements in `./ShinyModule.R` a showcase about this topics. +Nothing else. ---- ## R packages management / renv (optional) The template is prepared to use [`renv` as a dependency manager](https://rstudio.github.io/renv/articles/renv.html) - but is disabled by default (_opt-in_). You can [activate `renv` with `renv::activate()`](https://rstudio.github.io/renv/articles/renv.html#uninstalling-renv) and then use it in the [usual `renv` workflow](https://rstudio.github.io/renv/articles/renv.html#workflow). + ### Docker support (optional) -- at the end your app will be executed on MoveApps in a Docker container. -- if you like you can test your app in the almost final environment by running your app locally in a docker container: +Your app will be executed on MoveApps in a Docker container. Specially for debugging errors that are not straight forward, it can be very useful to execute your App in a docker container. These more complex errors are often due to system libraries that need to be installed in MoveApps to run the App. The easiest way to find out which ones they are is to run the App locally in a docker container: 1. enable `renv` (see above) 1. set a working title for your app by `export MY_MOVEAPPS_APP=hello-world` (in your terminal) @@ -131,6 +78,7 @@ You can [activate `renv` with `renv::activate()`](https://rstudio.github.io/renv 1. you will get a `bash` terminal of the running container. There you can get a R console by `R` or simply start your app by invoking `/home/moveapps/co-pilot-r/start-process.sh` (in the `bash` of the running container) 1. after starting the process open your app UI by navigating to `http://127.0.0.1:3838/` (in your local web browser) + ## Synchronisation of your fork with this template -This template includes a _GitHub action_ to keep your fork synchronized with the original template (aka the MoveApps R SDK). The synchronization action creates a _GitHub pull request_ in your fork from time to time in case the original template has changed. +This template includes a _GitHub action_ to keep your copy synchronized with the original template. Take a look at the [documentation](https://docs.moveapps.org/#/manage_Rapp_github?id=keep-your-repositories-up-to-date-sync-with-templates) and make sure to keep your repository up-to-date. diff --git a/renv.lock b/renv.lock index a5df0b2..047abc2 100644 --- a/renv.lock +++ b/renv.lock @@ -1,6 +1,6 @@ { "R": { - "Version": "4.3.2", + "Version": "4.4.2", "Repositories": [ { "Name": "CRAN", @@ -11,29 +11,29 @@ "Packages": { "DBI": { "Package": "DBI", - "Version": "1.2.1", + "Version": "1.2.3", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "methods" ], - "Hash": "9b4993e98e0e19da84c168460c032fef" + "Hash": "065ae649b05f1ff66bb0c793107508f5" }, "KernSmooth": { "Package": "KernSmooth", - "Version": "2.23-22", + "Version": "2.23-24", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "stats" ], - "Hash": "2fecebc3047322fa5930f74fae5de70f" + "Hash": "9f33a1ee37bbe8919eb2ec4b9f2473a5" }, "MASS": { "Package": "MASS", - "Version": "7.3-60.0.1", + "Version": "7.3-61", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -44,7 +44,7 @@ "stats", "utils" ], - "Hash": "b765b28387acc8ec9e9c1530713cb19c" + "Hash": "0cafd6f0500e5deba33be22c46bf6055" }, "R6": { "Package": "R6", @@ -58,14 +58,14 @@ }, "Rcpp": { "Package": "Rcpp", - "Version": "1.0.12", + "Version": "1.0.13-1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "methods", "utils" ], - "Hash": "5ea2700d21e038ace58269ecdbeb9ec0" + "Hash": "6b868847b365672d6c1677b1608da9ed" }, "assertthat": { "Package": "assertthat", @@ -89,19 +89,19 @@ }, "bit": { "Package": "bit", - "Version": "4.0.5", + "Version": "4.5.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R" ], - "Hash": "d242abec29412ce988848d0294b208fd" + "Hash": "5dc7b2677d65d0e874fc4aaf0e879987" }, "bit64": { "Package": "bit64", - "Version": "4.0.5", + "Version": "4.5.2", "Source": "Repository", - "Repository": "RSPM", + "Repository": "CRAN", "Requirements": [ "R", "bit", @@ -109,17 +109,18 @@ "stats", "utils" ], - "Hash": "9fe98599ca456d6552421db0d6772d8f" + "Hash": "e84984bf5f12a18628d9a02322128dfd" }, "bslib": { "Package": "bslib", - "Version": "0.6.1", + "Version": "0.8.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "base64enc", "cachem", + "fastmap", "grDevices", "htmltools", "jquerylib", @@ -130,18 +131,18 @@ "rlang", "sass" ], - "Hash": "c0d8599494bc7fb408cd206bbdd9cab0" + "Hash": "b299c6741ca9746fb227debcb0f9fb6c" }, "cachem": { "Package": "cachem", - "Version": "1.0.8", + "Version": "1.1.0", "Source": "Repository", - "Repository": "RSPM", + "Repository": "CRAN", "Requirements": [ "fastmap", "rlang" ], - "Hash": "c35768291560ce302c0a6589f92e837d" + "Hash": "cd9a672193789068eb5a2aad65a0dedf" }, "class": { "Package": "class", @@ -174,35 +175,35 @@ }, "cli": { "Package": "cli", - "Version": "3.6.2", + "Version": "3.6.3", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "utils" ], - "Hash": "1216ac65ac55ec0058a6f75d7ca0fd52" + "Hash": "b21916dd77a27642b447374a5d30ecf3" }, "commonmark": { "Package": "commonmark", - "Version": "1.9.1", + "Version": "1.9.2", "Source": "Repository", "Repository": "CRAN", - "Hash": "5d8225445acb167abf7797de48b2ee3c" + "Hash": "14eb0596f987c71535d07c3aff814742" }, "cpp11": { "Package": "cpp11", - "Version": "0.4.7", + "Version": "0.5.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R" ], - "Hash": "5a295d7d963cc5035284dcdbaf334f4e" + "Hash": "91570bba75d0c9d3f1040c835cee8fba" }, "crayon": { "Package": "crayon", - "Version": "1.5.2", + "Version": "1.5.3", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -210,18 +211,18 @@ "methods", "utils" ], - "Hash": "e8a1e41acf02548751f45c718d55aa6a" + "Hash": "859d96e65ef198fd43e82b9628d593ef" }, "digest": { "Package": "digest", - "Version": "0.6.34", + "Version": "0.6.37", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "utils" ], - "Hash": "7ede2ee9ea8d3edbf1ca84c1e333ad1a" + "Hash": "33698c4b3127fc9f506654607fb73676" }, "dotenv": { "Package": "dotenv", @@ -255,7 +256,7 @@ }, "e1071": { "Package": "e1071", - "Version": "1.7-14", + "Version": "1.7-16", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -267,18 +268,7 @@ "stats", "utils" ], - "Hash": "4ef372b716824753719a8a38b258442d" - }, - "ellipsis": { - "Package": "ellipsis", - "Version": "0.3.2", - "Source": "Repository", - "Repository": "RSPM", - "Requirements": [ - "R", - "rlang" - ], - "Hash": "bb0eec2fe32e88d9e2836c2f73ea2077" + "Hash": "27a09ca40266a1066d62ef5402dd51d6" }, "fansi": { "Package": "fansi", @@ -294,10 +284,10 @@ }, "fastmap": { "Package": "fastmap", - "Version": "1.1.1", + "Version": "1.2.0", "Source": "Repository", - "Repository": "RSPM", - "Hash": "f7736a18de97dea803bde0a2daaafb27" + "Repository": "CRAN", + "Hash": "aa5e1cd11c2d15497494c5292d7ffcc8" }, "fontawesome": { "Package": "fontawesome", @@ -313,14 +303,14 @@ }, "fs": { "Package": "fs", - "Version": "1.6.3", + "Version": "1.6.5", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "methods" ], - "Hash": "47b5f30c720c23999b913a1a635cf0bb" + "Hash": "7f48af39fa27711ea5fbd183b399920d" }, "generics": { "Package": "generics", @@ -335,14 +325,14 @@ }, "glue": { "Package": "glue", - "Version": "1.7.0", + "Version": "1.8.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "methods" ], - "Hash": "e0b3a53876554bd45879e596cdb10a52" + "Hash": "5899f1eaa825580172bb56c08266f37c" }, "hms": { "Package": "hms", @@ -360,24 +350,23 @@ }, "htmltools": { "Package": "htmltools", - "Version": "0.5.7", + "Version": "0.5.8.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "base64enc", "digest", - "ellipsis", "fastmap", "grDevices", "rlang", "utils" ], - "Hash": "2d7b3857980e0e0d0a1fd6f11928ab0f" + "Hash": "81d371a9cc60640e74e4ab6ac46dcedc" }, "httpuv": { "Package": "httpuv", - "Version": "1.6.14", + "Version": "1.6.15", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -388,7 +377,7 @@ "promises", "utils" ], - "Hash": "16abeb167dbf511f8cc0552efaf05bab" + "Hash": "d55aa087c47a63ead0f6fc10f8fa1ee0" }, "jquerylib": { "Package": "jquerylib", @@ -402,13 +391,13 @@ }, "jsonlite": { "Package": "jsonlite", - "Version": "1.8.8", + "Version": "1.8.9", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "methods" ], - "Hash": "e1b9c55281c5adc4dd113652d9e26768" + "Hash": "4e993b65c2c3ffbffce7bb3e2c6f832b" }, "later": { "Package": "later", @@ -467,7 +456,7 @@ }, "move2": { "Package": "move2", - "Version": "0.2.7", + "Version": "0.3.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -485,7 +474,7 @@ "vctrs", "vroom" ], - "Hash": "856ea2f33245f8385206aaf5fbfbf692" + "Hash": "3d30188ce75e46bd69cb764aa26b797e" }, "pillar": { "Package": "pillar", @@ -540,7 +529,7 @@ }, "promises": { "Package": "promises", - "Version": "1.2.1", + "Version": "1.3.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -552,7 +541,7 @@ "rlang", "stats" ], - "Hash": "0d8a15c9d000970ada1ab21405387dee" + "Hash": "434cd5388a3979e74be5c219bcd6e77d" }, "proxy": { "Package": "proxy", @@ -578,28 +567,28 @@ }, "renv": { "Package": "renv", - "Version": "1.0.3", + "Version": "1.0.11", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "utils" ], - "Hash": "41b847654f567341725473431dd0d5ab" + "Hash": "47623f66b4e80b3b0587bc5d7b309888" }, "rlang": { "Package": "rlang", - "Version": "1.1.3", + "Version": "1.1.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "utils" ], - "Hash": "42548638fae05fd9a9b5f3f437fbbbe2" + "Hash": "3eec01f8b1dee337674b2e34ab1f9bc1" }, "s2": { "Package": "s2", - "Version": "1.1.6", + "Version": "1.1.7", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -607,11 +596,11 @@ "Rcpp", "wk" ], - "Hash": "32f7b1a15bb01ae809022960abad5363" + "Hash": "3c8013cdd7f1d20de5762e3f97e5e274" }, "sass": { "Package": "sass", - "Version": "0.4.8", + "Version": "0.4.9", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -621,11 +610,11 @@ "rappdirs", "rlang" ], - "Hash": "168f9353c76d4c4b0a0bbf72e2c2d035" + "Hash": "d53dbfddf695303ea4ad66f86e99b95d" }, "sf": { "Package": "sf", - "Version": "1.0-15", + "Version": "1.0-19", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -644,11 +633,11 @@ "units", "utils" ], - "Hash": "f432b3379fb1a47046e253468b6b6b6d" + "Hash": "fe02eec2f6b3ba0e24afe83d5ccfb528" }, "shiny": { "Package": "shiny", - "Version": "1.8.0", + "Version": "1.9.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -658,7 +647,6 @@ "cachem", "commonmark", "crayon", - "ellipsis", "fastmap", "fontawesome", "glue", @@ -678,7 +666,7 @@ "withr", "xtable" ], - "Hash": "3a1f41807d648a908e3c7f0334bf85e6" + "Hash": "6a293995a66e12c48d13aa1f957d09c7" }, "sourcetools": { "Package": "sourcetools", @@ -711,7 +699,7 @@ }, "tidyselect": { "Package": "tidyselect", - "Version": "1.2.0", + "Version": "1.2.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -723,7 +711,7 @@ "vctrs", "withr" ], - "Hash": "79540e5fcd9e0435af547d885f184fd5" + "Hash": "829f27b9c4919c16b593794a6344d6c0" }, "tzdb": { "Package": "tzdb", @@ -799,7 +787,7 @@ }, "withr": { "Package": "withr", - "Version": "3.0.0", + "Version": "3.0.2", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -807,17 +795,17 @@ "grDevices", "graphics" ], - "Hash": "d31b6c62c10dcf11ec530ca6b0dd5d35" + "Hash": "cc2d62c76458d425210d1eb1478b30b4" }, "wk": { "Package": "wk", - "Version": "0.9.1", + "Version": "0.9.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R" ], - "Hash": "5d4545e140e36476f35f20d0ca87963e" + "Hash": "37be35d733130f1de1ef51672cf7cdc0" }, "xtable": { "Package": "xtable",