-
Notifications
You must be signed in to change notification settings - Fork 663
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
Add scripts for doc versioning #2749
Conversation
I guess one thing I haven't thought through is how to trigger this for old versions, i.e. 1.0.0 . The one I have at the address up there is just |
Codecov Report
@@ Coverage Diff @@
## develop #2749 +/- ##
===========================================
- Coverage 91.31% 91.19% -0.12%
===========================================
Files 176 176
Lines 24018 23798 -220
Branches 3160 3134 -26
===========================================
- Hits 21931 21702 -229
- Misses 1459 1474 +15
+ Partials 628 622 -6
Continue to review full report at Codecov.
|
46bb32b
to
af673dd
Compare
daddd30
to
bc9d959
Compare
Ok it's weirdly hard to build MDAnalysis in the right place to be accessible to docs on ReadTheDocs; I give up for now. I added in a function to get the absolute paths of files to setup.py, when trying to get RTD to work; I can remove this if unwanted. It doesn't really do any harm and might help the odd person wanting to go |
Very cool. If we do a backport to 1.0.x then it should create the proper 1.0.x docs for correct linking, no? (If I am in your "1.0.0" docs then the version link to 2.0.0-dev is broken https://lilyminium.github.io/mdanalysis/1.0.0/lilyminium.github.io/mdanalysis/2.0.0-dev0). (RTD seems a bit limited in how you can play with it, I remember being pretty frustrated as soon as stuff didn't work out of the box... when it works it's great, when not, it's pain.) |
Oops. I hope that does it. (lilyminium.github.io/mdanalysis now redirects to mdadocs.minium.com.au, just temporarily) I also added index.html, dev.html and latest.html stubs so that mdadocs.minium.com.au/ redirects to mdadocs.minium.com.au/1.0.0 , mdadocs.minium.com.au/latest redirects to mdadocs.minium.com.au/1.0.0, mdadocs.minium.com.au/dev redirects to mdadocs.minium.com.au/2.0.0-dev0 . This is written by the MDTraj uses Javascript to accomplish the same redirect, but this seemed easier to me both in case people don't have JS turned on and also so we don't have to wait for the JS to figure out the dev URL. <html><head>
<!-- redirect to /development after 3 seconds, in case something fails or
the user has javascript disabled -->
<meta http-equiv="refresh" content="3;URL='/development'"/>
<script type="text/javascript">
// download the versions.json file and redirect to the URL associated
// with the entry that has latest=true
var xhr = new XMLHttpRequest();
xhr.open('GET', encodeURI('versions.json'));
xhr.onload = function() {
if (xhr.status === 200) {
var versions = JSON.parse(xhr.responseText);
for (var key in versions) {
if (versions[key]['latest']) {
var latest = versions[key];
window.location.replace(latest['url']);
}
}
}
}
xhr.send();
</script>
</head></html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice, especially the demo at http://mdadocs.minium.com.au/ is convincing!
Just minor questions/comments.
Once this works, could you please update https://github.com/MDAnalysis/MDAnalysis.github.io/wiki/DNS (delete stuff gratuitously!) so that we have a record what CNAMEs we need for the doc magic to work. Perhaps add a link to the wiki page to the comments of your scripts, too, just so that other people or future us has some breadcrumbs to follow.
EDIT: You should now also be able to delete deploy_docs.sh and deploy_master_docs.sh. By the way, are the sitemap.xml
files created correctly? This might require some more fiddling... but can be done as another PR if needed.
maintainer/update_versions_json.py
Outdated
@@ -0,0 +1,93 @@ | |||
# Adapted from mdtraj/devtools/travis-ci/update_versions_json.py by Robert T McGibbon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume the mdtraj script is under LGPL, in which case we can use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it is (well the entire repo is), and 80% of the script is different, but it was adapted from his script originally
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you add "used under LGPL" then there's not doubt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume @rmcgibbo will be ok with this attribution? (Thank you!)
No, at present they're caught up in each $version directory. They're built by Sphinx before moving all the docs into each subdirectory, so I think what we would need to do is create a new one by concatenating them all into one big edit 2: I will do this tomorrow... |
Thanks for pointing out that sitemap.xml and other meta files might need some special attention, @orbeckst! So, each subdirectory should function as its own little website for the most part. Each of the following uses relative links, so they should be fine in the subdirectories instead of the root directory without further editing:
I guess people intersphinxing with
The new root sitemap_index.xml just links to the other sitemaps for reasons explained in the script (the file must be a max of 50 MB or 50k URLs) but it can easily be one very big sitemap.xml. By the way, I think the original sitemaps used incorrect URLs with shortened versions: docs.mdanalysis.org/sitemap.xml <?xml version='1.0' encoding='utf-8'?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>https://www.mdanalysis.org/mdanalysis/2.0/documentation_pages/analysis/align.html</loc>
</url>
<url>
<loc>https://www.mdanalysis.org/mdanalysis/2.0/documentation_pages/analysis/base.html</loc>
</url>
<url>
<loc>https://www.mdanalysis.org/mdanalysis/2.0/documentation_pages/analysis/contacts.html</loc>
</url> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still lgtm, see minor comments.
Well, this is interesting. I think until this PR is merged, every other merge will reset the docs URL back to mdanalysis.org/mdanalysis by wiping the CNAME record from mdanalysis/maintainer/deploy_docs.sh Line 49 in 46e505c
Those commits down there are me setting the URL back to docs.mdanalysis.org in settings. 👇 |
https://docs.mdanalysis.org/2.0.0-dev0/
Next: revert back to old 1.0.0 docs and do those... |
- Scripts move docs into a version subfolder - Write versions.json at root directory - Write sitemap_index.xml at root directory - Write html stubs for redirection - Change URL to CNAME one of docs.mdanalysis.org/
- Scripts move docs into a version subfolder - Write versions.json at root directory - Write sitemap_index.xml at root directory - Write html stubs for redirection - Change URL to CNAME one of docs.mdanalysis.org/
Fixes #2741 ... maybe
Changes made in this Pull Request:
add RTD configThis last one is soIt's quite hard to build MDAnalysis and have it accessible topeople can choose to hook up ReadTheDocs to their own forks and see the docs built therewe can add an RTD check that builds the docs for you, which also makes it easier to review that kind of thing. This is currently in progress.conf.py
, which hardcodes in looking three levels up, except RTD I'm pretty sure builds it in the same level as the root directory.Examples:
I've kept the status quo for now (everything branches off mdanalysis.org/mdanalysis) but final URLs are still up for discussion at #2741
PR Checklist
TO DO
Figure out what the following need to be and make them like so: