kopia lustrzana https://github.com/jupyterhub/repo2docker
Support requirements.txt & runtime.txt with Julia
The comment about Julia only working with CondaBuildPack hasn't been true since we switched to using conda for getting our pythons. This change allows people to use requirements.txt with Julia, rather than forcing them to use environment.yamlpull/557/head
rodzic
5385b71275
commit
a3b7e95594
|
@ -1,16 +1,11 @@
|
||||||
"""Generates a Dockerfile based on an input matrix for Julia"""
|
"""Generates a Dockerfile based on an input matrix for Julia"""
|
||||||
import os
|
import os
|
||||||
from ..conda import CondaBuildPack
|
from ..python import PythonBuildPack
|
||||||
|
|
||||||
|
|
||||||
class JuliaBuildPack(CondaBuildPack):
|
class JuliaBuildPack(PythonBuildPack):
|
||||||
"""
|
"""
|
||||||
Julia build pack which uses conda.
|
Julia build pack which uses conda.
|
||||||
|
|
||||||
The Julia build pack always uses the parent, `CondaBuildPack`,
|
|
||||||
since Julia does not work with Python virtual environments.
|
|
||||||
See https://github.com/JuliaPy/PyCall.jl/issues/410
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
minor_julias = {
|
minor_julias = {
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
Julia - REQUIRE
|
||||||
|
---------------
|
||||||
|
|
||||||
|
To specify dependencies in Julia, include a REQUIRE file that lists the names
|
||||||
|
of packages you'd like to be installed. For example:
|
||||||
|
|
||||||
|
```
|
||||||
|
PyPlot
|
||||||
|
IJulia
|
||||||
|
DataFrames
|
||||||
|
```
|
||||||
|
|
||||||
|
Each one will be installed but **not** pre-compiled. If you'd like to
|
||||||
|
pre-compile your Julia packages, consider using a ``postBuild`` file.
|
||||||
|
|
||||||
|
Note that this example also specifies Python dependencies with an
|
||||||
|
``requirements.txt`` file.
|
|
@ -0,0 +1 @@
|
||||||
|
PyPlot
|
|
@ -0,0 +1 @@
|
||||||
|
matplotlib
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/usr/bin/env julia
|
||||||
|
using PyPlot
|
||||||
|
|
||||||
|
# Make sure we are re-using the same conda python
|
||||||
|
if ! startswith(PyCall.libpython, ENV["NB_PYTHON_PREFIX"] * "/lib")
|
||||||
|
println("Not re-using conda python! Using " * PyCall.libpython * " instead")
|
||||||
|
exit(1)
|
||||||
|
end
|
||||||
|
|
||||||
|
# We try to plot something, and see if the file saved exists
|
||||||
|
x = linspace(0,2*pi,1000); y = sin(3*x + 4*cos(2*x))
|
||||||
|
plot(x, y, color="red", linewidth=2.0, linestyle="--")
|
||||||
|
savefig("graph.png")
|
||||||
|
if isfile("graph.png")
|
||||||
|
exit(0)
|
||||||
|
else
|
||||||
|
exit(1)
|
||||||
|
end
|
||||||
|
|
||||||
|
# We check that PyPlot is installed inside ${JULIA_DEPOT_PATH}
|
||||||
|
if ! isdir(ENV["JULIA_DEPOT_PATH"] * "/packages/PyPlot")
|
||||||
|
println("PyPlot not installed under JULIA_DEPOT_PATH")
|
||||||
|
exit(1)
|
||||||
|
end
|
Ładowanie…
Reference in New Issue