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 3 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
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
^LICENSE\.md$
13 changes: 13 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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("Jackson", "Hoffart", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-8600-5042"))
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
19 changes: 11 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
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 \

Check failure on line 4 in Dockerfile

View workflow job for this annotation

GitHub Actions / hadolint

DL3008 warning: Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`

Check failure on line 4 in Dockerfile

View workflow job for this annotation

GitHub Actions / hadolint

DL3015 info: Avoid additional packages by specifying `--no-install-recommends`

Check failure on line 4 in Dockerfile

View workflow job for this annotation

GitHub Actions / hadolint

DL3008 warning: Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`

Check failure on line 4 in Dockerfile

View workflow job for this annotation

GitHub Actions / hadolint

DL3015 info: Avoid additional packages by specifying `--no-install-recommends`
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 \
jdhoffa marked this conversation as resolved.
Show resolved Hide resolved
&& 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 24 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 24 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: Rocky Mountain Institute
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 Rocky Mountain Institute
jdhoffa marked this conversation as resolved.
Show resolved Hide resolved

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)