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

Removing Xranklin dependency #4

Closed
wants to merge 3 commits into from

Conversation

emmanuellujan
Copy link
Collaborator

Removing Xranklin dependency and adding two missing variables to avoid warnings. The issue related to variables arbitrarily set to 'nothing' persists (see tlienart/Franklin.jl#937). You must run 'serve' twice for it to work. Is this a bug in Franklin?

…d warnings. The issue related to variables arbitrarily set to 'nothing' persists. You must run 'serve' twice for it to work. Is this a bug in Franklin?
@giordano
Copy link
Member

I think checking in the manifest would be good in this case

@emmanuellujan
Copy link
Collaborator Author

According to (tlienart/Franklin.jl#937), this bug exists in the current version of Franklin (0.10.x) and will not be fixed until the next version.

They say "We're still at beta-testing stage so if you'd rather stick with something that works most of the time (even though Xranklin should, you'll have to adjust a few things, there's also a few features missing), I'd suggest sticking with the pinned version of Franklin for another couple of months"
It is suggested to use version 0.10.58, but in my case it has not worked (]add [email protected], rerun Julia, using Franklin, verify_links(), and serve()). Using @delay has not worked for me either (@delay function hfun_news()).

@jpsamaroo @giordano, if you can think of a way to solve this issue in the meantime please give it a shot :) I will revisit this issue in the next few days.

@emmanuellujan
Copy link
Collaborator Author

I started with a fresh Julia installation, version 1.7.3

] add Franklin
...
] st FranklinFranklin

v0.10.74

using Franklin
verify_links()
serve()
  Activating project at `~/Data/repos/JuliaLab/juliaparallel/juliaparallel.github.io`
→ Initial full pass...
┌ Franklin Warning: in <index.md>
│ Encountered an issue processing 'index.md' in allel.github.io/news.
│ Verify, then re-start the Franklin server.
│ The error is displayed below:
│ KeyError(nothing)
└
ERROR: KeyError: key nothing not found
Stacktrace:
  [1] getindex(h::Dict{Any, Any}, key::Nothing)
    @ Base ./dict.jl:481
  [2] hfun_news()
    @ Main.Utils_1 ~/Data/repos/JuliaLab/juliaparallel/juliaparallel.github.io/utils.jl:73
  [3] top-level scope
    @ none:1
  [4] eval
    @ ./boot.jl:373 [inlined]
  [5] convert_html_fblock(β::Franklin.HFun)
    @ Franklin ~/.julia/packages/Franklin/DUQCH/src/converter/html/functions.jl:14
  [6] process_html_qblocks(hs::String, qblocks::Vector{Franklin.AbstractBlock}, head::Int64, tail::Int64)
    @ Franklin ~/.julia/packages/Franklin/DUQCH/src/converter/html/html.jl:122
  [7] process_html_qblocks(hs::String, qblocks::Vector{Franklin.AbstractBlock})
    @ Franklin ~/.julia/packages/Franklin/DUQCH/src/converter/html/html.jl:102
  [8] convert_html(hs::String)
    @ Franklin ~/.julia/packages/Franklin/DUQCH/src/converter/html/html.jl:22
  [9] map
    @ ./tuple.jl:223 [inlined]
 [10] map
    @ ./tuple.jl:224 [inlined]
 [11] write_page(output_path::String, content::String; head::String, pgfoot::String, foot::String)
    @ Franklin ~/.julia/packages/Franklin/DUQCH/src/manager/write_page.jl:103
 [12] convert_and_write(root::String, file::String, head::String, pgfoot::String, foot::String, output_path::String)
    @ Franklin ~/.julia/packages/Franklin/DUQCH/src/manager/write_page.jl:197
 [13] process_file_err(case::Symbol, fpair::Pair{String, String}, head::String, pgfoot::String, foot::String, t::Float64)
    @ Franklin ~/.julia/packages/Franklin/DUQCH/src/manager/file_utils.jl:153
 [14] process_file(::Symbol, ::Pair{String, String}, ::String, ::Vararg{Any})
    @ Franklin ~/.julia/packages/Franklin/DUQCH/src/manager/file_utils.jl:104
 [15] fd_fullpass(watched_files::NamedTuple{(:other, :infra, :md, :html, :literate), NTuple{5, Dict{Pair{String, String}, Float64}}}, join_to_prepath::String)
    @ Franklin ~/.julia/packages/Franklin/DUQCH/src/manager/franklin.jl:260
 [16] serve(; clear::Bool, verb::Bool, port::Int64, single::Bool, prerender::Bool, nomess::Bool, is_final_pass::Bool, no_fail_prerender::Bool, eval_all::Bool, silent::Bool, cleanup::Bool, on_write::Franklin.var"#246#249", log::Bool, host::String, show_warnings::Bool, fail_on_warning::Bool, launch::Bool, no_set_paths::Bool, join_to_prepath::String)
    @ Franklin ~/.julia/packages/Franklin/DUQCH/src/manager/franklin.jl:124
 [17] serve()
    @ Franklin ~/.julia/packages/Franklin/DUQCH/src/manager/franklin.jl:70
 [18] top-level scope
    @ REPL[6]:1

If I repeat serve, everything works:

serve()

 Activating project at `~/Data/repos/JuliaLab/juliaparallel/juliaparallel.github.io`
→ Initial full pass...
→ Starting the server...
✓ LiveServer listening on http://localhost:8000/ ...
  (use CTRL+C to shut down)

This issue seems to be reported here

The first recommendation is using @delay. I added @delay in function hfun_news() in utils.jl

 @delay function hfun_news()
    author_badges = globvar("author_badges")
    ...

But the issue persists.

The second recommendation is to pin Franklin to 0.10.58:

] add [email protected]
] st Franklin

Franklin v0.10.58

I re-run Julia and repeated the process (with and without @delay), but I got the same result.
Finally, I re-started with a fresh Julia installation version 1.7.3 (removing .julia from home) and installed Xranklin:

import Pkg
Pkg.add(url="https://github.com/tlienart/Xranklin.jl", rev="main")
using Xranklin
serve(debug=true)
  Activating project at `~/Data/repos/JuliaLab/juliaparallel/juliaparallel.github.io`
   Installed NodeJS ────────────── v1.3.0
   Installed Parsers ───────────── v2.3.1
   Installed Literate ──────────── v2.13.3
   Installed ExprTools ─────────── v0.1.8
   Installed JSON ──────────────── v0.21.3
   Installed LiveServer ────────── v0.7.4
   Installed DocStringExtensions ─ v0.8.6
   Installed Franklin ──────────── v0.10.58
   Installed FranklinTemplates ─── v0.8.27
  Downloaded artifact: nodejs_app
Precompiling ┌ Debug: Rejecting cache file /home/elujan/.julia/compiled/v1.7/LiveServer/CGL3l_v86fX.ji because it is for file /home/elujan/.julia/packages/LiveServer/cqr6J/src/LiveServer.jl not file /home/elujan/.julia/packages/LiveServer/9wa2n/src/LiveServer.jl
└ @ Base loading.jl:1866
project...
  ✓ LiveServer
  9 dependencies successfully precompiled in 16 seconds (10 already precompiled)
  1 dependency precompiled but a different version is currently loaded. Restart julia to access the new version
┌ Debug: ... process_config 
└ @ Xranklin ~/.julia/packages/Xranklin/pIAdX/src/misc_utils.jl:100
[ Info: processing config.md
┌ Debug: evaluating vars cell...
└ @ Xranklin ~/.julia/packages/Xranklin/pIAdX/src/context/code/notebook_vars.jl:107
┌ Debug: ... [vars cell] (δt = 0.9s)
└ @ Xranklin ~/.julia/packages/Xranklin/pIAdX/src/context/code/notebook_vars.jl:111
ERROR: UndefVarError: i not defined
Stacktrace:
  [1] getproperty
    @ ./Base.jl:35 [inlined]
  [2] (::Xranklin.var"#56#59"{Module})(vn::Symbol)
    @ Xranklin ./none:0
  [3] iterate
    @ ./generator.jl:47 [inlined]
  [4] collect_to!(dest::Vector{NamedTuple{(:var, :value), Tuple{Symbol, Any}}}, itr::Base.Generator{Vector{Any}, Xranklin.var"#56#59"{Module}}, offs::Int64, st::Int64)
    @ Base ./array.jl:782
  [5] collect_to_with_first!
    @ ./array.jl:760 [inlined]
  [6] collect(itr::Base.Generator{Vector{Any}, Xranklin.var"#56#59"{Module}})
    @ Base ./array.jl:734
  [7] _eval_vars_cell(mdl::Module, code::String, ctx::Xranklin.GlobalContext{Xranklin.LocalContext})
    @ Xranklin ~/.julia/packages/Xranklin/pIAdX/src/context/code/notebook_vars.jl:137
  [8] eval_vars_cell!(ctx::Xranklin.GlobalContext{Xranklin.LocalContext}, cell_code::SubString{String})
    @ Xranklin ~/.julia/packages/Xranklin/pIAdX/src/context/code/notebook_vars.jl:67
  [9] html_md_def(b::FranklinParser.Block, c::Xranklin.GlobalContext{Xranklin.LocalContext})
    @ Xranklin ~/.julia/packages/Xranklin/pIAdX/src/convert/markdown/rules/text.jl:71
 [10] top-level scope
    @ none:1
 [11] eval
    @ ./boot.jl:373 [inlined]
 [12] eval
    @ ~/.julia/packages/Xranklin/pIAdX/src/Xranklin.jl:1 [inlined]
 [13] convert_block(b::FranklinParser.Block, c::Xranklin.GlobalContext{Xranklin.LocalContext}; tohtml::Bool)
    @ Xranklin ~/.julia/packages/Xranklin/pIAdX/src/convert/markdown/md_core.jl:142
 [14] convert_block
    @ ~/.julia/packages/Xranklin/pIAdX/src/convert/markdown/md_core.jl:132 [inlined]
 [15] html
    @ ~/.julia/packages/Xranklin/pIAdX/src/convert/markdown/md_core.jl:144 [inlined]
 [16] convert_md(md::SubString{String}, c::Xranklin.GlobalContext{Xranklin.LocalContext}; tohtml::Bool, nop::Bool, kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Xranklin ~/.julia/packages/Xranklin/pIAdX/src/convert/markdown/md_core.jl:87
 [17] convert_md
    @ ~/.julia/packages/Xranklin/pIAdX/src/convert/markdown/md_core.jl:30 [inlined]
 [18] #html#124
    @ ~/.julia/packages/Xranklin/pIAdX/src/convert/markdown/md_core.jl:107 [inlined]
 [19] html
    @ ~/.julia/packages/Xranklin/pIAdX/src/convert/markdown/md_core.jl:107 [inlined]
 [20] #html#126
    @ ~/.julia/packages/Xranklin/pIAdX/src/convert/markdown/md_core.jl:112 [inlined]
 [21] html
    @ ~/.julia/packages/Xranklin/pIAdX/src/convert/markdown/md_core.jl:112 [inlined]
 [22] process_config(gc::Xranklin.GlobalContext{Xranklin.LocalContext}, config::String)
    @ Xranklin ~/.julia/packages/Xranklin/pIAdX/src/process/config_utils.jl:49
 [23] process_config(gc::Xranklin.GlobalContext{Xranklin.LocalContext})
    @ Xranklin ~/.julia/packages/Xranklin/pIAdX/src/process/config_utils.jl:79
 [24] serve(d::String; dir::String, folder::String, clear::Bool, final::Bool, single::Bool, eval::Bool, nocode::Bool, threads::Bool, use_threads::Bool, prepath::String, prefix::String, base_url_prefix::String, debug::Bool, cleanup::Bool, port::Int64, host::String, launch::Bool)
    @ Xranklin ~/.julia/packages/Xranklin/pIAdX/src/build/serve.jl:124
 [25] top-level scope
    @ REPL[4]:1

Hi @tlienart :) Am I doing something wrong?, could you help us with this? Thank you :)

@emmanuellujan
Copy link
Collaborator Author

I think checking in the manifest would be good in this case

Could you elaborate on this? Thanks :)

@tlienart
Copy link
Contributor

tlienart commented May 31, 2022

@emmanuellujan this repo is a fixed copy from yours with Xranklin that works. I'd suggest you start from there

repo: https://github.com/tlienart/juliaparallel-xr/
demo: https://tlienart.github.io/juliaparallel-xr/ , https://tlienart.github.io/juliaparallel-xr/teaching/

Notes:

  • Xranklin is not yet released, there's partial docs (https://tlienart.github.io/Xranklin.jl/) but generally be careful about what you do and commit often to make it easier to bissect issues. Please ask on the Slack channel #xranklin if you have questions. Please open issues on Xranklin for feedback.
  • I turned off RSS, for now leave it turned off until you've populated the site etc. I can help you switch it back on later but there's a couple of things that I need to bring back from Franklin to Xranklin before then.
  • You didn't have a proper landing page that I could see (either a proper index.md or index.html) so I created a dummy one which you'll of course want to replace.

Some Franklin specific things are dropped or deprecated:

  • @def (in favour of +++ blocks)
  • fd2html (in favour of html)
  • you need to explicitly using Dates in +++ blocks if you intend to use dates there
  • @delay is dropped (not needed anymore)
  • fd_* page variables are generally dropped or are alias to proper variable names, ask on the channel if you're not sure (e.g. fd_mtime should not be used, tag_name instead of fd_tag etc)

I think the easier way forward is that you would close this PR, copy the repo I made into a new repo you own, add me as collaborator, open issues when you have problems, and when you're happy with it, replace the docs folder of juliaparallel with it.

Alternatively, I've invited you to the repo above and can transfer ownership to you.

@emmanuellujan
Copy link
Collaborator Author

​Hi @tlienart thank you for your answer :)

The code I am working on (about the new template) is in this branch:

https://github.com/emmanuellujan/juliaparallel.github.io/tree/new-template

(I replaced @def by +++ and removed @delay. )

I added you as a collaborator. Could you give this a shot? We can continue there :)

@tlienart
Copy link
Contributor

tlienart commented May 31, 2022

I'd strongly suggest (*) you start from my repo (or a copy of) to avoid chasing issues twice. (Sorry if I misunderstood but it seems you still encounter issues which suggests you did not do that)

(*) maybe more explicitly (sorry if it's blunt): I won't look at repo that didn't start from it as I already invested time to fix stuff and demonstrated it works.

@emmanuellujan
Copy link
Collaborator Author

@tlienart thank you very much for your reply, I appreciate your willingness to help :) I would like to explain that I mentioned the new-template branch because that's where the issue emerged. However, since you tell me that you have already made several changes to your copy of the main branch, it seems good to me to start modifying it gradually with the information from the new-template branch to detect when the error occurs. I will start doing that.

@giordano
Copy link
Member

giordano commented Jun 2, 2022

Could you elaborate on this? Thanks :)

Add the Manifest.toml of the environment to the repository. I think it isn't much useful for packages, but for applications (like deploying a website) it's fundamental, as it ensures everybody is using the same version of the packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants