Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer DESCRIPTION over renv #8

Merged
merged 7 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
^LICENSE\.md$
^.*\.Rproj$
^\.Rproj\.user$
19 changes: 19 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Package: workflow.scenario.preparation
Title: Run the Scenario Preparation Workflow
Version: 0.0.0.9000
Authors@R:
jdhoffa marked this conversation as resolved.
Show resolved Hide resolved
person(c(person(given = "Jackson",
family = "Hoffart",
role = c("aut", "cre", "ctr"),
email = "[email protected]",
comment = c(ORCID = "0000-0002-8600-5042")),
person(given = "RMI",
role = c("cph", "fnd"),
email = "[email protected]"))
Description: A workflow to prepare climate change scenarios for the PACTA tool.
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
Imports:
dplyr
20 changes: 11 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
FROM --platform=linux/amd64 rocker/tidyverse

Check failure on line 1 in Dockerfile

View workflow job for this annotation

GitHub Actions / hadolint

DL3006 warning: Always tag the version of an image explicitly

Check failure on line 1 in Dockerfile

View workflow job for this annotation

GitHub Actions / hadolint

DL3029 warning: Do not use --platform flag with FROM

Check failure on line 1 in Dockerfile

View workflow job for this annotation

GitHub Actions / hadolint

DL3006 warning: Always tag the version of an image explicitly

Check failure on line 1 in Dockerfile

View workflow job for this annotation

GitHub Actions / hadolint

DL3029 warning: Do not use --platform flag with FROM

# install system dependencies for R packages
RUN apt-get update \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this seems unnecessary now that you're not installing git, but I suppose you left it in to make it easy to add system installs in the future?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, all of this is just the skeleton/ infrastructure for a "very soon-to-come" main.R script, that will likely have at least SOME system dependencies.

&& apt-get install -y git \
&& rm -rf /var/lib/apt/lists/*

RUN Rscript -e 'install.packages(c("pak", "renv"))'
# copy in DESCRIPTION from this repo
COPY DESCRIPTION /DESCRIPTION

# install pak, find dependencies from DESCRIPTION, and install them
RUN Rscript -e "\
install.packages('pak'); \
deps <- pak::local_deps(root = '.'); \
pkg_deps <- deps[!deps[['direct']], 'ref']; \
jdhoffa marked this conversation as resolved.
Show resolved Hide resolved
print(pkg_deps); \
pak::pak(pkg_deps); \
"

COPY . /workflow.scenario.preparation

WORKDIR /workflow.scenario.preparation

RUN Rscript -e '\
readRenviron(".env"); \
non_cran_pkg_deps <- c("RMI-PACTA/pacta.scenario.data.preparation"); \
cran_pkg_deps <- setdiff(renv::dependencies()$Package, basename(non_cran_pkg_deps)); \
pak::pkg_install(pkg = c(non_cran_pkg_deps, cran_pkg_deps)); \
'

CMD Rscript run_pacta_scenario_preparation.R

Check failure on line 23 in Dockerfile

View workflow job for this annotation

GitHub Actions / hadolint

DL3025 warning: Use arguments JSON notation for CMD and ENTRYPOINT arguments

Check failure on line 23 in Dockerfile

View workflow job for this annotation

GitHub Actions / hadolint

DL3025 warning: Use arguments JSON notation for CMD and ENTRYPOINT arguments
23 changes: 2 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,2 @@
MIT License

Copyright (c) 2023 RMI-PACTA

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
YEAR: 2024
COPYRIGHT HOLDER: RMI
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# MIT License

Copyright (c) 2024 RMI

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 1 addition & 1 deletion run_pacta_scenario_preparation.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
library(tidyverse)
library(dplyr)

jdhoffa marked this conversation as resolved.
Show resolved Hide resolved
mtcars %>%
distinct(cyl, mpg)
4 changes: 4 additions & 0 deletions workflow.scenario.preparation.Rproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ LaTeX: XeLaTeX

AutoAppendNewline: Yes
StripTrailingWhitespace: Yes

BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source