-
Notifications
You must be signed in to change notification settings - Fork 25
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
use doc environment for servedoc #85
Comments
Yes that's correct, it should be easy to fix, I'll try to suggest a patch soon, thanks for the heads up |
@Roger-luo would you mind pulling the branch julia> using LiveServer, Yao;
julia> servedocs(doc_env=true) I was able to deploy the docs locally but could do with someone else reporting on this, cheers! Provided this works for you I'll merge and do a patch release. Edit oh wait I think I see the issue with Weave and the looping, let me get back to you on this. |
Ok, so now you can test it (the branch servedocs(doc_env=true, skip_dir=joinpath("docs/src/examples")) Please tell me if it works for you and I'll merge and release, thank you A word of explanation + RFCThe issue with the infinite loop was due to Weave taking your servedocs(doc_env=true, skip_dir=joinpath("docs/src/examples")) (use Note that I would recommend re-directing the output of Weave to Side noteYour doc build is quite slow due in part to quite a lot of What I would suggest is that in your for each in Examples
file_path = joinpath(@__DIR__, "src", "examples", join([each, ".jmd"]))
# check how long ago it was last modified, if over 15 min, skip it (assume an up to date markdown exists)
(time() - stat(file_path).mtime) < 900 || continue
@info "expanding $file_path to markdown"
weave(file_path)
end That already divides the run time by a factor 2 (you could add a test to check if you're on CI in which case you wouldn't do this for instance); the run time for Documenter is also enormous and could no doubt be simplified a lot by using the appropriate keywords (at least when the docs are built locally and you want stuff to be fast) but I don't know Documenter enough to tell you exactly what should be used here. In particular it may/should be possible to:
and that would speed things up a lot |
Oh thanks for your quick and detailed respond! I just tried it seems to work!
I generate the markdown files to let it get compiled with Documenter tho. But I think you are right this should be a better idea.
Yes, we have been trying different solutions on this, but I think the reason we are still using Weave is mainly because we still need to convert things to jupyter notebooks when necessary (e.g doing tutorial etc.) It seems JuDocs doesn't support this (yet)? will it generate jupyter notebooks for this use case in the future?
nice! I'm also using LiveServer for my new book (still work in progress) https://github.com/Roger-luo/Brochure.jl with a custom serve function, I guess I could do the same thing for weave files?
Yeah, I also hope Documenter could provide an API to build only a single markdown file instead of the entire project, but I posted an issue here: JuliaDocs/Documenter.jl#1188 |
IMO LiveServer should just use the env the user have set up. I don't understand why it has to be integrated in LiveServer. |
@fredrikekre but the servedoc function is already integrated with LiveServer, if one want to start a live hosted documentation with LiveServer with one line I don't think why do I need to take care of whether it is using |
doesn't work? |
no, you will need to use the thing in .travis CI first julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()' or it won't build (with the current package source) |
But you will have to initialize the env with the proposed changed too. I just don't think it is a good idea for a package to mess with the users environment. |
I think usually if one just initialize the package env, and won't touch the doc env unless we are going to change things in doc build. And this is enabled explicitly by a keyword, I don't see why not provide this convenience, it makes everyone happy. I can just ask other collaborator (especially who don't know much Julia) to modify the documentation ( a lot docs doesn't need any code) by simply type |
I don't really understand what you mean; you will still have to set up the documentation environment yourself, the proposed solution does not do that. Why do you prefer julia -e 'using LiveServer; servedocs(doc_env=true)' over using the built-in support for modifying the environment: julia --project=docs -e 'using LiveServer; servedocs()' ? |
oh I see, yeah. I'll close this. |
Just a few side points:
|
Yea, but this it is very tricky to switch the environment during runtime like that. For example, packages that have already been important might be on wrong versions etc. |
Yes definitely, so I'll add a fair warning and not recommend it and recommend your approach as more robust/fool-proof |
It seems currently
servedoc
uses the global environment instead of the doc environment? so it only works when all the doc dependencies are installed in global environment.The text was updated successfully, but these errors were encountered: