kopia lustrzana https://github.com/jupyterhub/repo2docker
Install devtools, shiny & irkernel from a pin
We were doing this from an old MRAN snapshot. I moved the pin a little ahead, so IRKernel can also be installed from CRAN instead of from GitHub. R <= 4.0 gets the old version, and anything newer gets a more recent version of devtools. This gives us fast installs for IRkernel with binary packages. Also add a R 4.0 and R 4.1 testpull/1104/head
rodzic
290b008ac5
commit
1ed05b59c6
|
@ -13,13 +13,6 @@ RSTUDIO_CHECKSUM = "d33881b9ab786c09556c410e7dc477de"
|
||||||
SHINY_URL = "https://download3.rstudio.org/ubuntu-14.04/x86_64/shiny-server-1.5.12.933-amd64.deb"
|
SHINY_URL = "https://download3.rstudio.org/ubuntu-14.04/x86_64/shiny-server-1.5.12.933-amd64.deb"
|
||||||
SHINY_CHECKSUM = "9aeef6613e7f58f21c97a4600921340e"
|
SHINY_CHECKSUM = "9aeef6613e7f58f21c97a4600921340e"
|
||||||
|
|
||||||
# Version of MRAN to pull devtools from.
|
|
||||||
DEVTOOLS_VERSION = "2018-02-01"
|
|
||||||
|
|
||||||
# IRKernel version - specified as a tag in the IRKernel repository
|
|
||||||
IRKERNEL_VERSION = "1.1"
|
|
||||||
|
|
||||||
|
|
||||||
def rstudio_base_scripts():
|
def rstudio_base_scripts():
|
||||||
"""Base steps to install RStudio and shiny-server."""
|
"""Base steps to install RStudio and shiny-server."""
|
||||||
return [
|
return [
|
||||||
|
|
|
@ -6,7 +6,7 @@ from collections.abc import Mapping
|
||||||
from ruamel.yaml import YAML
|
from ruamel.yaml import YAML
|
||||||
|
|
||||||
from ..base import BaseImage
|
from ..base import BaseImage
|
||||||
from .._r_base import rstudio_base_scripts, IRKERNEL_VERSION
|
from .._r_base import rstudio_base_scripts
|
||||||
from ...utils import is_local_pip_requirement
|
from ...utils import is_local_pip_requirement
|
||||||
|
|
||||||
# pattern for parsing conda dependency line
|
# pattern for parsing conda dependency line
|
||||||
|
@ -356,11 +356,11 @@ class CondaBuildPack(BaseImage):
|
||||||
(
|
(
|
||||||
"${NB_USER}",
|
"${NB_USER}",
|
||||||
r"""
|
r"""
|
||||||
mamba install -p {0} r-base{1} r-irkernel={2} r-devtools -y && \
|
mamba install -p {0} r-base{1} r-irkernel=1.2 r-devtools -y && \
|
||||||
mamba clean --all -f -y && \
|
mamba clean --all -f -y && \
|
||||||
mamba list -p {0}
|
mamba list -p {0}
|
||||||
""".format(
|
""".format(
|
||||||
env_prefix, r_pin, IRKERNEL_VERSION
|
env_prefix, r_pin
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -6,7 +6,7 @@ import requests
|
||||||
from distutils.version import LooseVersion as V
|
from distutils.version import LooseVersion as V
|
||||||
|
|
||||||
from .python import PythonBuildPack
|
from .python import PythonBuildPack
|
||||||
from ._r_base import rstudio_base_scripts, DEVTOOLS_VERSION, IRKERNEL_VERSION
|
from ._r_base import rstudio_base_scripts
|
||||||
|
|
||||||
|
|
||||||
class RBuildPack(PythonBuildPack):
|
class RBuildPack(PythonBuildPack):
|
||||||
|
@ -186,7 +186,6 @@ class RBuildPack(PythonBuildPack):
|
||||||
return super().get_packages().union(packages)
|
return super().get_packages().union(packages)
|
||||||
|
|
||||||
def get_cran_mirror_url(self, snapshot_date):
|
def get_cran_mirror_url(self, snapshot_date):
|
||||||
|
|
||||||
# Call the API to find out if we have a snapshot available for the given date.
|
# Call the API to find out if we have a snapshot available for the given date.
|
||||||
# If so, use the URL for that snapshot. If not, fall back to MRAN.
|
# If so, use the URL for that snapshot. If not, fall back to MRAN.
|
||||||
snapshots = requests.post(
|
snapshots = requests.post(
|
||||||
|
@ -209,6 +208,19 @@ class RBuildPack(PythonBuildPack):
|
||||||
snapshot_date.isoformat()
|
snapshot_date.isoformat()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def get_devtools_snapshot_date(self):
|
||||||
|
"""
|
||||||
|
Return date of snapshot to use for getting devtools install
|
||||||
|
|
||||||
|
devtools is part of our 'core' base install, so we should have some
|
||||||
|
control over what version we install here.
|
||||||
|
"""
|
||||||
|
if V(self.r_version) <= V('4.0'):
|
||||||
|
# IRKernel gets into CRAN on Nov 16 2018 (https://packagemanager.rstudio.com/client/#/repos/1/packages/IRkernel),
|
||||||
|
# so we try snapshot to just after that.
|
||||||
|
return datetime.date(2018, 12, 1)
|
||||||
|
return datetime.date(2021, 12, 16)
|
||||||
|
|
||||||
def get_build_scripts(self):
|
def get_build_scripts(self):
|
||||||
"""
|
"""
|
||||||
Return series of build-steps common to all R repositories
|
Return series of build-steps common to all R repositories
|
||||||
|
@ -312,26 +324,17 @@ class RBuildPack(PythonBuildPack):
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"${NB_USER}",
|
"${NB_USER}",
|
||||||
# Install a pinned version of IRKernel and set it up for use!
|
# Install a pinner version of devtools, IRKernel and shiny
|
||||||
r"""
|
r"""
|
||||||
R --quiet -e "install.packages('devtools')" && \
|
R --quiet -e "install.packages(c('devtools', 'IRkernel', 'shiny'), repos='{devtools_cran_mirror_url}')" && \
|
||||||
R --quiet -e "devtools::install_github('IRkernel/IRkernel', ref='{irkernel_version}')" && \
|
|
||||||
R --quiet -e "IRkernel::installspec(prefix='$NB_PYTHON_PREFIX')"
|
R --quiet -e "IRkernel::installspec(prefix='$NB_PYTHON_PREFIX')"
|
||||||
""".format(
|
""".format(
|
||||||
cran_mirror_url=cran_mirror_url,
|
devtools_cran_mirror_url=self.get_cran_mirror_url(self.get_devtools_snapshot_date()),
|
||||||
devtools_version=DEVTOOLS_VERSION,
|
|
||||||
irkernel_version=IRKERNEL_VERSION,
|
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
(
|
|
||||||
"${NB_USER}",
|
|
||||||
# Install shiny library
|
|
||||||
r"""
|
|
||||||
R --quiet -e "install.packages('shiny')"
|
|
||||||
""",
|
|
||||||
),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
return super().get_build_scripts() + scripts
|
return super().get_build_scripts() + scripts
|
||||||
|
|
||||||
def get_preassemble_script_files(self):
|
def get_preassemble_script_files(self):
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
r-4.0-2021-07-07
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env Rscript
|
||||||
|
library('ggplot2')
|
||||||
|
|
||||||
|
print(version)
|
||||||
|
# Fail if version is not 4.0
|
||||||
|
if (!(version$major == "4" && as.double(version$minor) >= 0 && as.double(version$minor) < 1)) {
|
||||||
|
quit("yes", 1)
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
install.packages("ggplot2")
|
Ładowanie…
Reference in New Issue