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.yaml
pull/557/head
yuvipanda 2019-01-17 17:23:54 -08:00
rodzic 5385b71275
commit a3b7e95594
5 zmienionych plików z 45 dodań i 7 usunięć

Wyświetl plik

@ -1,16 +1,11 @@
"""Generates a Dockerfile based on an input matrix for Julia"""
import os
from ..conda import CondaBuildPack
from ..python import PythonBuildPack
class JuliaBuildPack(CondaBuildPack):
class JuliaBuildPack(PythonBuildPack):
"""
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 = {

Wyświetl plik

@ -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.

Wyświetl plik

@ -0,0 +1 @@
PyPlot

Wyświetl plik

@ -0,0 +1 @@
matplotlib

Wyświetl plik

@ -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