Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rewrite julia version in notebooks to one compatible with binder #461

Merged
merged 1 commit into from
Oct 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Documenter, COBREXA
using Literate
using Documenter
using Literate, JSON
using COBREXA

# Note: required to deploy the doc from Gitlab CI instead of Travis
ENV["TRAVIS_REPO_SLUG"] = "LCSB-BioCore/COBREXA.jl"
Expand Down Expand Up @@ -100,7 +101,8 @@ replace_in_doc(
# dumps that contain the dumped environment strings, which in turn contain
# github auth tokens. These certainly need to be avoided.
notebooks_names = [n[begin:end-3] for n in notebooks_basenames]
notebooks_allowed_files = vcat("index.html", notebooks_names .* ".ipynb")
ipynb_names = notebooks_names .* ".ipynb"
notebooks_allowed_files = vcat("index.html", ipynb_names)
@info "allowed files:" notebooks_allowed_files
for (root, dirs, files) in walkdir(joinpath(@__DIR__, "build", "notebooks"))
for f in files
Expand All @@ -114,6 +116,16 @@ end
# also remove the index template
rm(joinpath(@__DIR__, "build", "index.md.template"))

# Binder does not support Julia 1.6 kernels yet, so let's force the Julia 1.5
# kernel for now.
for ipynb in joinpath.(@__DIR__, "build", "notebooks", ipynb_names)
@info "changing julia version to 1.5 in `$ipynb'"
js = JSON.parsefile(ipynb)
js["metadata"]["kernelspec"]["name"] = "julia-1.5"
js["metadata"]["kernelspec"]["display_name"] = "Julia 1.5"
open(f -> JSON.print(f, js), ipynb, "w")
end

# deploy the result
deploydocs(
repo = "github.com/$(ENV["TRAVIS_REPO_SLUG"]).git",
Expand Down