Skip to content

Commit

Permalink
FIX: install latest Julia version (#275)
Browse files Browse the repository at this point in the history
* DOC: update instructions to Julia 1.10.3
* DX: do not run Julia notebook on RTD
* DX: install IJulia kernel through `conf.py`
* DX: pin IJulia dependencies
* DX: pin Julia version on RTD from `Manifest.toml`
* DX: rename Julia kernel to `compwa.github.io`
* DX: run TR-019 on RTD
* FIX: correctly install Julia in RTD
* FIX: remove conda default channel
  The latest version of `julia` was not installed because
  Conda's `defaults` channel installs an older version
* FIX: run TR-019 (Julia example) through Sphinx
* MAINT: build `nb_exclusion_patterns` with `set`
* MAINT: revert to `import Pkg`
* MAINT: update `Manifest.toml` in TR-019
  • Loading branch information
redeboer authored May 10, 2024
1 parent 510c6f6 commit fd266e4
Show file tree
Hide file tree
Showing 8 changed files with 411 additions and 346 deletions.
8 changes: 2 additions & 6 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,9 @@ build:
tools:
python: "3.10"
jobs:
pre_install:
- ./docs/install-julia-on-rtd.sh
post_install:
- curl -LsSf https://astral.sh/uv/install.sh | sh
- |-
/home/docs/.cargo/bin/uv pip install --system -c .constraints/py3.10.txt -e .[doc]
- |
wget https://julialang-s3.julialang.org/bin/linux/x64/1.9/julia-1.9.2-linux-x86_64.tar.gz
- tar xzf julia-1.9.2-linux-x86_64.tar.gz
- mkdir bin
- ln -s $PWD/julia-1.9.2/bin/julia bin/julia
- ./bin/julia docs/InstallIJulia.jl
2 changes: 1 addition & 1 deletion docs/InstallIJulia.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ import Pkg
Pkg.add("IJulia")

import IJulia
IJulia.installkernel("julia")
IJulia.installkernel("julia-compwa.github.io")
24 changes: 16 additions & 8 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import os
import shutil
import subprocess # noqa: S404
import sys

from sphinx_api_relink.helpers import (
Expand All @@ -23,7 +24,7 @@


def get_nb_exclusion_patterns() -> list[str]:
exclusions = [
exclusions = {
"adr/001/*",
"adr/002/*",
"report/000*",
Expand All @@ -40,20 +41,27 @@ def get_nb_exclusion_patterns() -> list[str]:
"report/015*",
"report/017*",
"report/018*",
"report/019*",
"report/020*",
"report/021*",
"report/022*",
]
julia_notebooks = [
}
julia_notebooks = {
"report/019*",
]
if "READTHEDOCS" not in os.environ and shutil.which("julia") is None:
exclusions.extend(julia_notebooks)
return exclusions
}
if shutil.which("julia") is None or "READTHEDOCS" in os.environ:
exclusions.update(julia_notebooks)
return sorted(exclusions)


def install_ijulia() -> None:
if shutil.which("julia") is None:
return
if "EXECUTE_NB" in os.environ or "FORCE_EXECUTE_NB" in os.environ:
subprocess.check_call(["julia", "InstallIJulia.jl"]) # noqa: S603, S607


_list_technical_reports.main()
install_ijulia()
set_intersphinx_version_remapping({
"ipython": {
"8.12.2": "8.12.1",
Expand Down
12 changes: 6 additions & 6 deletions docs/develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,10 @@ juliaup default release

```shell
cd ~/Downloads
tar xzf julia-1.9.2-linux-x86_64.tar.gz
tar xzf julia-1.10.3-linux-x86_64.tar.gz
mkdir ~/opt ~/bin
mv julia-1.9.2 ~/opt/
ln -s ~/opt/julia-1.9.2/bin/julia ~/bin/julia
mv julia-1.10.3 ~/opt/
ln -s ~/opt/julia-1.10.3/bin/julia ~/bin/julia
```

Make sure that `~/bin` is listed in the `PATH` environment variable, e.g. by updating it
Expand All @@ -345,9 +345,9 @@ export PATH="~/bin:$PATH"

```shell
cd ~/Downloads
tar xzf julia-1.9.2-linux-x86_64.tar.gz
sudo mv julia-1.9.2 /opt/
sudo ln -s /opt/julia-1.9.2/bin/julia /usr/local/bin/julia
tar xzf julia-1.10.3-linux-x86_64.tar.gz
sudo mv julia-1.10.3 /opt/
sudo ln -s /opt/julia-1.10.3/bin/julia /usr/local/bin/julia
```

::::
Expand Down
12 changes: 12 additions & 0 deletions docs/install-julia-on-rtd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
if [ -z "$READTHEDOCS" ]; then
echo "Can only run this script on Read the Docs"
exit 1
fi

version=$(sed -n '3p' docs/report/019/Manifest.toml | cut -d'"' -f2)
major_version=${version:0:-2}
echo "Installing Julia v${version}"
filename=julia-${version}-linux-x86_64.tar.gz
wget -q https://julialang-s3.julialang.org/bin/linux/x64/${major_version}/${filename}
tar xzf ${filename} -C ~/.asdf --strip-components=1
6 changes: 3 additions & 3 deletions docs/report/019.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -232,15 +232,15 @@
"toc_visible": true
},
"kernelspec": {
"display_name": "Julia 1.9.3",
"display_name": "julia-compwa.github.io 1.10.3",
"language": "julia",
"name": "julia-1.9"
"name": "julia-compwa.github.io-1.10"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.9.3"
"version": "1.10.3"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit fd266e4

Please sign in to comment.