kopia lustrzana https://github.com/jupyterhub/repo2docker
Create Julia projects based on binder/Project.toml when found
rodzic
b4fee8e3a7
commit
61b76f622d
|
@ -93,8 +93,15 @@ class JuliaProjectTomlBuildPack(PythonBuildPack):
|
||||||
("JUPYTER_DATA_DIR", "${NB_PYTHON_PREFIX}/share/jupyter"),
|
("JUPYTER_DATA_DIR", "${NB_PYTHON_PREFIX}/share/jupyter"),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def project_dir(self):
|
||||||
|
if self.binder_dir:
|
||||||
|
return "${REPO_DIR}/" + self.binder_dir
|
||||||
|
else:
|
||||||
|
return "${REPO_DIR}"
|
||||||
|
|
||||||
def get_env(self):
|
def get_env(self):
|
||||||
return super().get_env() + [("JULIA_PROJECT", "${REPO_DIR}")]
|
return super().get_env() + [("JULIA_PROJECT", self.project_dir)]
|
||||||
|
|
||||||
def get_path(self):
|
def get_path(self):
|
||||||
"""Adds path to Julia binaries to user's PATH.
|
"""Adds path to Julia binaries to user's PATH.
|
||||||
|
@ -148,15 +155,19 @@ class JuliaProjectTomlBuildPack(PythonBuildPack):
|
||||||
The parent, CondaBuildPack, will add the build steps for
|
The parent, CondaBuildPack, will add the build steps for
|
||||||
any needed Python packages found in environment.yml.
|
any needed Python packages found in environment.yml.
|
||||||
"""
|
"""
|
||||||
return super().get_assemble_scripts() + [
|
scripts = super().get_assemble_scripts()
|
||||||
|
scripts.append(
|
||||||
(
|
(
|
||||||
"${NB_USER}",
|
"${NB_USER}",
|
||||||
r"""
|
r"""
|
||||||
JULIA_PROJECT="" julia -e "using Pkg; Pkg.add(\"IJulia\"); using IJulia; installkernel(\"Julia\", \"--project=${REPO_DIR}\");" && \
|
JULIA_PROJECT="" julia -e "using Pkg; Pkg.add(\"IJulia\"); using IJulia; installkernel(\"Julia\", \"--project={project}\");" && \
|
||||||
julia --project=${REPO_DIR} -e 'using Pkg; Pkg.instantiate(); Pkg.resolve(); pkg"precompile"'
|
julia --project={project} -e 'using Pkg; Pkg.instantiate(); Pkg.resolve(); pkg"precompile"'
|
||||||
""",
|
""".format(
|
||||||
|
project=self.project_dir
|
||||||
|
),
|
||||||
)
|
)
|
||||||
]
|
)
|
||||||
|
return scripts
|
||||||
|
|
||||||
def detect(self):
|
def detect(self):
|
||||||
"""
|
"""
|
||||||
|
|
Ładowanie…
Reference in New Issue