Skip to content

Commit fef3250

Browse files
authored
Merge pull request #1350 from minrk/rm-julia-06
Remove support for deprecated Julia REQUIRE, Julia < 1.3
2 parents a4049fd + c130e87 commit fef3250

File tree

14 files changed

+22
-300
lines changed

14 files changed

+22
-300
lines changed

docs/source/architecture.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ the `build` method of the `BuildPack` base class.
8787

8888
The **assemble** stage builds the specific environment that is requested by the repository.
8989
This usually means installing required libraries specified in a format native to the language
90-
(`requirements.txt`, `environment.yml`, `REQUIRE`, `install.R`, etc).
90+
(`requirements.txt`, `environment.yml`, `Project.toml`, `install.R`, etc).
9191

9292
Most of this work is done in `get_assemble_scripts` method. It can return arbitrary bash script
9393
lines that can be run as different users, and has access to the repository contents (unlike

docs/source/config_files.rst

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,8 @@ of the Julia packages that are installed.
102102
``REQUIRE`` - Install a Julia environment (legacy)
103103
==================================================
104104

105-
A ``REQUIRE`` file can specify both the version of Julia to be used and
106-
which Julia packages should be used. The use of ``REQUIRE`` is only
107-
recommended for pre 1.0 Julia versions. The recommended way of installing
108-
a Julia environment that uses Julia 1.0 or newer is to use a ``Project.toml``
109-
file. If both a ``REQUIRE`` and a ``Project.toml`` file are detected,
110-
the ``REQUIRE`` file is ignored. To see an example of a Julia repository
111-
with ``REQUIRE`` and ``environment.yml``, visit
112-
`binder-examples/julia-python <https://github.com/binder-examples/julia-python>`_.
105+
``REQUIRE`` files no longer work, and are no longer supported.
106+
The recommended way of installing a Julia environment is to use a ``Project.toml`` file.
113107

114108

115109
.. _install.R:

docs/source/faq.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ We **strongly** recommend specifying a Python version (in environment.yml, runti
5555
Julia
5656
~~~~~
5757

58-
All Julia versions since Julia 0.7.0 are supported via a :ref:`Project.toml <Project.toml>`
58+
All Julia versions since Julia 1.3 are supported via a :ref:`Project.toml <Project.toml>`
5959
file, and this is the recommended way to install Julia environments.
60-
Julia versions 0.6.x and earlier are supported via a :ref:`REQUIRE <REQUIRE>` file.
60+
61+
Julia < 1.3 and the older Julia REQUIRE file is no longer supported because required infrastructure has been removed.
6162

6263
R
6364
~

docs/source/specification.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ The Reproducible Execution Environment Specification
55
====================================================
66

77
repo2docker scans a repository for particular :ref:`config-files`, such
8-
as ``requirements.txt`` or ``REQUIRE``. The collection of files, their contents,
8+
as ``requirements.txt`` or ``Project.toml``. The collection of files, their contents,
99
and the resulting actions that repo2docker takes is known
1010
as the **Reproducible Execution Environment Specification** (or REES).
1111

1212
The goal of the REES is to automate and encourage existing community best practices
1313
for reproducible computational environments. This includes installing pacakges using
1414
community-standard specification files and their corresponding tools,
15-
such as ``requirements.txt`` (with ``pip``), ``REQUIRE`` (with Julia), or
15+
such as ``requirements.txt`` (with ``pip``), ``Project.toml`` (with Julia), or
1616
``apt.txt`` (with ``apt``). While repo2docker automates the
1717
creation of the environment, a human should be able to look at a REES-compliant
1818
repository and reproduce the environment using common, clear steps without

repo2docker/buildpacks/julia/install-repo-dependencies.jl

Lines changed: 0 additions & 36 deletions
This file was deleted.

repo2docker/buildpacks/julia/julia_require.py

Lines changed: 11 additions & 187 deletions
Original file line numberDiff line numberDiff line change
@@ -1,205 +1,29 @@
1-
"""Generates a Dockerfile based on an input matrix with REQUIRE for legacy Julia"""
1+
"""
2+
DEPRECATED - Dependencies of REQUIRE have been removed
3+
"""
24

35
import os
4-
from functools import lru_cache
56

6-
from ...semver import parse_version as V
77
from ..python import PythonBuildPack
88

99

1010
class JuliaRequireBuildPack(PythonBuildPack):
1111
"""
1212
Julia build pack which uses conda and REQUIRE.
13-
"""
14-
15-
minor_julias = {"0.6": "0.6.4", "0.7": "0.7.0", "1.0": "1.0.4", "1.1": "1.1.1"}
16-
major_julias = {"1": "1.1.1"}
17-
18-
@property
19-
def python_version(self):
20-
# IJulia doesn't build on julia 0.6
21-
# due to old incompatibilities with Jupyter-core >= 4.5,
22-
# so use the similarly-old Python 3.5 base environment
23-
if V(self.julia_version) < V("0.7"):
24-
return "3.5"
25-
else:
26-
return super().python_version
27-
28-
@property
29-
def julia_version(self):
30-
require = self.binder_path("REQUIRE")
31-
try:
32-
with open(require) as f:
33-
julia_version_line = (
34-
f.readline().strip()
35-
) # First line is optionally a julia version
36-
except FileNotFoundError:
37-
julia_version_line = ""
38-
39-
if not julia_version_line.startswith("julia "):
40-
# not a Julia version line.
41-
# use the default Julia.
42-
self._julia_version = self.minor_julias["0.6"]
43-
return self._julia_version
44-
45-
julia_version_info = julia_version_line.split(" ", 1)[1].split(".")
46-
julia_version = ""
47-
if len(julia_version_info) == 1:
48-
julia_version = self.major_julias[julia_version_info[0]]
49-
elif len(julia_version_info) == 2:
50-
# get major.minor
51-
julia_version = self.minor_julias[".".join(julia_version_info)]
52-
else:
53-
# use supplied julia version
54-
julia_version = ".".join(julia_version_info)
55-
self._julia_version = julia_version
56-
return self._julia_version
57-
58-
@lru_cache()
59-
def get_build_env(self):
60-
"""Get additional environment settings for Julia and Jupyter
61-
62-
Returns:
63-
an ordered list of environment setting tuples
6413
65-
The tuples contain a string of the environment variable name and
66-
a string of the environment setting:
67-
- `JULIA_PATH`: base path where all Julia Binaries and libraries
68-
will be installed
69-
- `JULIA_HOME`: path where all Julia Binaries will be installed
70-
- `JULIA_PKGDIR`: path where all Julia libraries will be installed
71-
- `JULIA_DEPOT_PATH`: path where Julia libraries are installed.
72-
Similar to JULIA_PKGDIR, used in 1.x.
73-
- `JULIA_VERSION`: default version of julia to be installed
74-
- `JULIA_ARCH`: machine architecture used in Julia download URLs
75-
- `JULIA_ARCH_SHORT`: machine architecture used in Julia download URLs
76-
- `JUPYTER`: environment variable required by IJulia to point to
77-
the `jupyter` executable
78-
79-
For example, a tuple may be `('JULIA_VERSION', '0.6.0')`.
80-
81-
"""
82-
if self.platform == "linux/arm64":
83-
julia_arch = julia_arch_short = "aarch64"
84-
else:
85-
julia_arch = "x86_64"
86-
julia_arch_short = "x64"
87-
88-
if V(self.julia_version) < V("0.7"):
89-
# IJulia with Julia 0.6 isn't compatible with more recent jupyter-core
90-
# point it to the one in the kernel env
91-
# I _think_ this is only relevant during installation
92-
jupyter = "${KERNEL_PYTHON_PREFIX}/bin/jupyter"
93-
else:
94-
jupyter = "${NB_PYTHON_PREFIX}/bin/jupyter"
95-
return super().get_build_env() + [
96-
("JULIA_PATH", "${APP_BASE}/julia"),
97-
("JULIA_HOME", "${JULIA_PATH}/bin"), # julia <= 0.6
98-
("JULIA_BINDIR", "${JULIA_HOME}"), # julia >= 0.7
99-
("JULIA_PKGDIR", "${JULIA_PATH}/pkg"),
100-
("JULIA_DEPOT_PATH", "${JULIA_PKGDIR}"), # julia >= 0.7
101-
("JULIA_VERSION", self.julia_version),
102-
("JULIA_ARCH", julia_arch),
103-
("JULIA_ARCH_SHORT", julia_arch_short),
104-
("JUPYTER", jupyter),
105-
]
106-
107-
@lru_cache()
108-
def get_path(self):
109-
"""Adds path to Julia binaries to user's PATH.
110-
111-
Returns:
112-
an ordered list of path strings. The path to the Julia
113-
executable is added to the list.
114-
115-
"""
116-
return super().get_path() + ["${JULIA_HOME}"]
117-
118-
@lru_cache()
119-
def get_build_scripts(self):
120-
"""
121-
Return series of build-steps common to "ALL" Julia repositories
122-
123-
All scripts found here should be independent of contents of a
124-
particular repository.
125-
126-
This creates a directory with permissions for installing julia packages
127-
(from get_assemble_scripts).
128-
129-
"""
130-
return super().get_build_scripts() + [
131-
(
132-
"root",
133-
r"""
134-
mkdir -p ${JULIA_PATH} && \
135-
curl -sSL "https://julialang-s3.julialang.org/bin/linux/${JULIA_ARCH_SHORT}/${JULIA_VERSION%[.-]*}/julia-${JULIA_VERSION}-linux-${JULIA_ARCH}.tar.gz" | tar -xz -C ${JULIA_PATH} --strip-components 1
136-
""",
137-
),
138-
(
139-
"root",
140-
r"""
141-
mkdir -p ${JULIA_PKGDIR} && \
142-
chown ${NB_USER}:${NB_USER} ${JULIA_PKGDIR}
143-
""",
144-
),
145-
(
146-
"${NB_USER}",
147-
# HACK: Can't seem to tell IJulia to install in sys-prefix
148-
# FIXME: Find way to get it to install under /srv and not $HOME?
149-
r"""
150-
julia -e 'if (VERSION > v"0.7-") using Pkg; else Pkg.init(); end; Pkg.add("IJulia"); using IJulia;' && \
151-
mv ${HOME}/.local/share/jupyter/kernels/julia-${JULIA_VERSION%[.-]*} ${NB_PYTHON_PREFIX}/share/jupyter/kernels/julia-${JULIA_VERSION%[.-]*}
152-
""",
153-
),
154-
]
155-
156-
@lru_cache()
157-
def get_assemble_scripts(self):
158-
"""
159-
Return series of build-steps specific to "this" Julia repository
160-
161-
Precompile all Julia libraries found in the repository's REQUIRE
162-
file. The parent, CondaBuildPack, will add the build steps for
163-
any needed Python packages found in environment.yml.
164-
165-
"""
166-
require = self.binder_path("REQUIRE")
167-
return super().get_assemble_scripts() + [
168-
(
169-
"${NB_USER}",
170-
# Install and pre-compile all libraries if they've opted into it.
171-
# In v0.6, Pkg.resolve() installs all the packages, but in v0.7+, we
172-
# have to manually Pkg.add() each of them (since the REQUIRES file
173-
# format is deprecated).
174-
# The precompliation is done via `using {libraryname}`.
175-
r"""
176-
julia /tmp/install-repo-dependencies.jl "%(require)s"
177-
"""
178-
% {"require": require},
179-
# TODO: For some reason, `rm`ing the file fails with permission denied.
180-
# && rm /tmp/install-repo-dependencies.jl
181-
)
182-
]
14+
Now just an informative error message.
15+
"""
18316

184-
@lru_cache()
185-
def get_build_script_files(self):
186-
files = {
187-
"julia/install-repo-dependencies.jl": "/tmp/install-repo-dependencies.jl"
188-
}
189-
files.update(super().get_build_script_files())
190-
return files
17+
def build(self, *args, **kwargs):
18+
raise ValueError(
19+
"Julia REQUIRE no longer supported due to removed infrastructure. Use Project.toml."
20+
)
19121

19222
def detect(self):
19323
"""
194-
Check if current repo should be built with the Julia Legacy Build pack
195-
196-
super().detect() is not called in this function - it would return
197-
false unless an `environment.yml` is present and we do not want to
198-
require the presence of a `environment.yml` to use Julia.
199-
200-
Instead we just check if the path to `REQUIRE` exists and that there is
201-
no julia 1.0 style environment
24+
Check if current repo exects tp be built with the Julia Legacy Build pack
20225
26+
This no longer works, but try to raise an informative error.
20327
"""
20428
return os.path.exists(self.binder_path("REQUIRE")) and not (
20529
os.path.exists(self.binder_path("Project.toml"))

tests/julia/project-1.0.2-binder-dir/.binder/Project.toml renamed to tests/julia/project-binder-dir/.binder/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
IteratorInterfaceExtensions = "82899510-4779-5014-852e-03e436cf321d"
33

44
[compat]
5-
julia = "=1.0.2"
5+
julia = "=1.3"

tests/julia/project-1.0.2-binder-dir/verify renamed to tests/julia/project-binder-dir/verify

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env julia
22

3-
if VERSION != v"1.0.2"
4-
println("Julia version should be 1.0.2")
3+
if VERSION != v"1.3"
4+
println("Julia version should be 1.3, got $VERSION")
55
exit(1)
66
end
77

tests/julia/require-1-requirements-file/REQUIRE

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)