Skip to content

Conversation

@theogf
Copy link
Member

@theogf theogf commented Jun 24, 2021

This PR is aiming as using difference processes for each markdown file in #303
I created a new branch in case everything goes to 💩...

theogf and others added 2 commits June 24, 2021 17:44
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@theogf
Copy link
Member Author

theogf commented Jun 24, 2021

No idea why but it seems to work.

docs/make.jl Outdated
Literate.markdown("$(filepath)", "$(EXAMPLES_OUT)"; name="$(example)", documenter=true, execute=true)
"""
run(
addenv(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe withenv would be a bit more idiomatic?


# preprocessor for Literate example scripts:
# - add Documenter @setup snippet that activates each example's own project environment
function preprocess(content)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can eventually be added later. I think the main point right now is to have examples running

docs/make.jl Outdated
using Literate
Literate.markdown("$(filepath)", "$(EXAMPLES_OUT)"; name="$(example)", documenter=true, execute=true)
"""
run(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we parallelize this such that examples are executed in parallel?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we could! Does GH Actions allows this? I could not find anything in the docs

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we could just use Julia's parallelization capabilities by e.g. spawning multiple processes in parallel. It seems a bit tricky to use GH actions for it since we would have to collect all outputs and only update the gh-pages branch once after everything was run and the documentation was built.

end

cmd = Base.julia_cmd()
docs_env = @__DIR__
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we actually need to inherit anything? Maybe it would be cleaner to just install Literate manually (or even better, add it to the dependencies of the example's Project.toml such that it is pinned and tracked as well) and not inherit anything.

Then one could even include the notebook run in the external process as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest I don't fully understand what this does... I just copied the example from https://discourse.julialang.org/t/multiple-environments-in-documenter/63436/4

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It builds a stacked environment and adds both the packages in docs/ and examples/current_example/ to the load path (the latter are prioritized). However, I don't think we have to inherit anything if we add the Literate dependency to examples/current_example/. Then we could just run the external process, instantiate the example environment (without any additional special stuff), and generate both the Markdown and the notebook.

docs/make.jl Outdated
Dict("JULIA_LOAD_PATH" => load_path),
),
)
Literate.notebook(filepath, EXAMPLES_OUT; name=example, documenter=true, execute=false)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just include this in the external process as well? (see https://github.com/JuliaGaussianProcesses/KernelFunctions.jl/pull/309/files#r658620202).

Comment on lines +35 to 37
withenv("JULIA_LOAD_PATH" => load_path) do
run(`$(cmd) --project=$(exampledir) -e $(code)`)
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without stacked environments this is just

Suggested change
withenv("JULIA_LOAD_PATH" => load_path) do
run(`$(cmd) --project=$(exampledir) -e $(code)`)
end
run(`$(cmd) --project=$(exampledir) -e $(code)`)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please feel free to apply the correct edits, I am moving in the dark here 😅

@st--
Copy link
Member

st-- commented Jun 29, 2021

This has been superseded by #314 - thanks for getting it started!

@st-- st-- closed this Jun 29, 2021
@st-- st-- deleted the tgf/use_literate_processes branch June 29, 2021 10:02
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.

4 participants