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

Port from Gitbook to sphinx #21

Merged
merged 65 commits into from
Nov 18, 2021
Merged

Port from Gitbook to sphinx #21

merged 65 commits into from
Nov 18, 2021

Conversation

kousu
Copy link
Member

@kousu kousu commented Oct 27, 2021

Fixes #20 (the way I want it to be fixed anyway; I'm open to suggestions and alternatives)

@kousu kousu marked this pull request as ready for review October 27, 2021 04:20
@kousu
Copy link
Member Author

kousu commented Oct 27, 2021

This is posted at https://wiki-demo.neuropoly.org and ready for some review!

Live at https://neuro.polymtl.ca

@kousu

This comment has been minimized.

Copy link
Member

@joshuacwnewton joshuacwnewton left a comment

Choose a reason for hiding this comment

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

What would the workflow be for making changes? Something like...

  1. Browse the website and notice a change you would like to make.
  2. Click on "Edit on GitHub" link.
  3. Click on the pencil "edit" icon.
  4. Make changes in GitHub's markdown editor.
    • How would someone visualize their pending changes before merging them?
  5. Click "Create a new branch for this commit and start a pull request."
  6. The PR workflow will automatically build the changes.
    • I see the workflow publishes the changes when master is updated. Can there be a workflow to render in-progress, pending changes without actually publishing them, as is done for PRs on RTD-based websites?
  7. The PR is reviewed and approved.
    • Who will review and approve the changes?
    • How will new students know who to request a review from?
  8. The changes are now live on the website.

The developer in me likes this workflow! But, the "new lab student" / "lab advisor who's rushed for time" in me thinks that this might be too many hoops to jump through in order to make a change.

@jcohenadad

This comment has been minimized.

@kousu
Copy link
Member Author

kousu commented Oct 27, 2021

@joshuacwnewton wrote:

What would the workflow be for making changes? Something like...

1. Browse the website and notice a change you would like to make.

2. Click on "Edit on GitHub" link.

3. Click on the pencil "edit" icon.

The edit link drops you directly into the editor ^_^

2021-10-27-115430_1010x609_scrot

2021-10-27-115437_1000x521_scrot

4. Make changes in GitHub's markdown editor.
   
   * How would someone visualize their pending changes before merging them?

With 'show diff'; I don't know if we can have it turned on by default? Maybe it's an account setting we can advise people to use?

2021-10-27-115649_114x47_scrot

The markdown diffs are pretty good!

2021-10-27-115703_974x533_scrot

5. Click "Create a new branch for this commit and start a pull request."

No, just save directly to master and be done with it:

2021-10-27-115717_332x125_scrot

I really think we should discourage PRs for the wiki. Not everything needs to be code reviewed, not really.

@joshuacwnewton wrote:

Can there be a workflow to render in-progress, pending changes without actually publishing them, as is done for PRs on RTD-based websites?

No. Github Pages is too simple to handle branches.

However someone could fork the repo, and so long as they're working on master their fork should automatically go live at https://username.github.io/neuropoly-docs.

I am also not against hosting on readthedocs especially if we do want PR previews. I have no horse in the RTD / Github race, they're both just companies to me; I demo'd this way because it meant one less credential to manage; and also PRs should be the exception not the rule.


I realize the Github preview won't render identically to sphinx. But I'm betting here that these situations (weird syntax, custom embeds, etc) won't come up that often so we can live with just re-edit until it works. Basically I'm repeating what Julien said

I think that clicking on the "Preview" button on github should provide >95% of use cases like fixing a typo (5% scenario not covered when embedding does not show up or other non-MD objects that require sphinx compilation).

Changes could also be previewed by building the docs locally if we really need to (say, the large refactor case). It's really not that inaccessible:

git clone -b your-branch https://github.com/neuropoly/neuropoly-docs/
cd neuropoly-docs
pip install .[sphinx]
make html
chrome _build/html/index.html

Waiting on the CI feedback cycle is a drag -- CI is best for final checks and publishing, not developing. We shouldn't be encouraging it for daily feedback.

@jcohenadad wrote:

(ie: no landing page for the parent link of the TOC, and a page only appears if user clicks on the child pages

Oh, maybe! This sounds like something sphinx can do. There's a lot of options for the TOC. https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#cross-referencing-syntax says "If you prefix the content with !, no reference/hyperlink will be created." so, worth experimenting.

@jcohenadad wrote:

We could start with slightly smaller fonts,

lol I intentionally increased the size c39bb0e. Gitbook has larger TOC fonts so I thought I'd copy that. I thought one of the big reasons we liked Gitbook was that the TOC was extremely prominent and easy to navigate.

We can undo it!

@jcohenadad wrote:

And there is only one page to maintain (ie: it gets duplicated during sphinx compilation, right?)

Not during compilation, no. But I guess I could make that happen.

I want sphinx to recognize README.md as index.html. Surely there must be a plugin that can do that.

@jcohenadad wrote:

The emojis are rendered using your system fonts, which is good for filesize, but maybe bad for compatibility. E.g. on my linux system
Interesting, i didn't know that. Is there a reasonable workaround?

Just ignore it. Most systems handle emojis fine these days. Certainly anyone with a Mac or Windows and Android or iOS computer will.

@jcohenadad wrote:

To encourage students to create their own page, we need to provide an "easy" workflow (eg template, not-heavy explanation on how to create the file and where to locate it)

Oh interesting. Github has templates for issues and PRs but not for files. I guess we can just put team/_TEMPLATE.md and tell people to copy from it.

@jcohenadad wrote:

Why not going with the very active Jupyter Book project. There is also the MyST feature that makes our MD compatible and extendable to including many cool objects.

This already uses MyST. That's how it works in .md at all instead of .rst. I tried using myst_nb at first but it was very much heavier than myst_parser. If we did that, it has to boot a Jupyter kernel for each change, on top of installing all of Jupyter/numpy/matplotlib, and then run all your notebooks. If we did that we wouldn't get 30s turnaround time, it would balloon and only get worse with time.

I think myst_nb is great for code docs, but it's not appropriate for our primary wiki.

About merging the internal lab and external lab website: i'm still not 100% sure if we should do it. What would be the pros/cons, etc. I see how it could be confusing for external people visiting our lab website (ie: many entries in the TOC, overwhelming, etc.)

We can limit the TOC depth with :maxdepth 3: so that it's not overwhelming, and I think, probably, we can prevent the main TOC from diving into the lab manual at all (if we can adjust :maxdepth: for a specific link). And then when in the lab manual section, adjust the sidebar so that root TOC starts at the lab manual, hiding the other sections.

If we can't get the TOC to hang together just right then I won't advocate it. But if we can I hope we'll consider it.

@joshuacwnewton
Copy link
Member

joshuacwnewton commented Oct 27, 2021

I really think we should discourage PRs for the wiki. Not everything needs to be code reviewed, not really.

I'm happy to hear this. I wrongly assumed that you wanted a PR-based workflow (oops), but if we're committing directly to master, then that addresses a lot of my concerns. I'm on board with pretty much everything you've written. 😄

@kousu

This comment has been minimized.

@jcohenadad

This comment has been minimized.

@kousu

This comment has been minimized.

@jcohenadad

This comment has been minimized.

@kousu

This comment has been minimized.

@dpapp86
Copy link
Contributor

dpapp86 commented Oct 28, 2021

As someone unfamiliar with Markdown, after 5 minutes with Nick, I have to vote in support of the transition.

@naga-karthik
Copy link
Member

First off, thanks @kousu for your effort in porting our webpage! Here are some of my comments:

  1. The font seems to be too big for me. Especially the drop-down sections on the left of the page. Also, in general, I think the font size can be reduced.
  2. There is no YouTube button here: https://wiki-demo.neuropoly.org/events-and-workshops.html (Follow us on ...?)
  3. (Might not be related to the website) I noticed that in the Research Section, there is no subsection for Deep Learning, which I think must definitely be there.
  4. When you click on sections having drop-down menus (e.g. Job Opportunities), one would expect to be shown the subsections in the main page also. Currently, what happens is, I click Job Opportunities, it loads a new but empty page and I have to look at the subsections on the left to access the page I am interested in. This is slightly psychological because "loading of a new page" gives me an impression that I am about to be "shown" something.
  5. I think this has been mentioned before, some of the icons on the Teams page do not render.

@kousu

This comment has been minimized.

@kousu kousu force-pushed the ng/sphinx branch 3 times, most recently from 68e7765 to 1e783d6 Compare November 1, 2021 20:19
@kousu kousu force-pushed the ng/sphinx branch 3 times, most recently from 49a72cb to fa8db50 Compare November 11, 2021 06:33
kousu and others added 12 commits November 11, 2021 01:40
Personally, I would like to merge intranet.neuro into this wiki, and make this a relative link.
Lists have an easier syntax, especially since we only have one
column in these tables.

Maybe we'll have multiple columns again in the future,
but I think at that point I will be scraping Github profiles
to *generate* the content, and so prettiness will be irrelevant.
But for now it is relevant.
This makes the syntax easier to work with, but doesn't change
the rendered layout.
These icons are used in the Github Button and on /software.html;
this just makes everything consistent.

This migration was done with these ridiculous perl one-liners:

perl -i -pe 's/\[\!\[(.*?)\].*\((https:.*)\)/[<i class="fab fa-\L\1\E" title="\1" aria-hidden="true"><\/i><span>\1<\/span>]\(\2)/' team/README.md &&
perl -i -pe 's/\[\!\[(E-Mail)\].*\((mailto:.*)\)/[<i class="fa fa-envelope" title="\1" aria-hidden="true"><\/i><span>\1<\/span>]\(\2)/' team/README.md
Just repeating the embed URL is what https://executablebooks.org/en/latest/meetings/index.html?highlight=calendar
does, but that's pretty pointless: you still have to click the "+ Google Calendar"
button in the corner on that page ...which is already visible in the
embedded calendar.

Now there's one link that prompts you to subscribe, if you're logged in
to Google, and one that works with every other apps (because it's .ics)
Something is wrong with sphinx-book-theme in a way that broke
when sphinx went from 4.2.0 to 4.3.0 this week.
@gaspardcereza
Copy link
Contributor

Hey @kousu, both Gitbook and Sphinx look pretty similar to me. As for editing the pages, I don't have any strong preference between doing it from the Gitbook interface or in GitHub, so if you think it's easier for you to manage the Sphinx version, I think we should go with it.

@kousu
Copy link
Member Author

kousu commented Nov 17, 2021

Emailed dnsmaster@polymtl.ca last night per instructions at https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site/managing-a-custom-domain-for-your-github-pages-site#configuring-an-apex-domain to switch our DNS to say

comms3$ dig neuro.polymtl.ca @ns1.polymtl.ca          

; <<>> dig 9.10.8-P1 <<>> neuro.polymtl.ca @ns1.polymtl.ca
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 49419
;; flags: qr aa rd; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;neuro.polymtl.ca.		IN	A

;; ANSWER SECTION:
neuro.polymtl.ca.	86400	IN	A	185.199.108.153
neuro.polymtl.ca.	86400	IN	A	185.199.109.153
neuro.polymtl.ca.	86400	IN	A	185.199.110.153
neuro.polymtl.ca.	86400	IN	A	185.199.111.153

I had to tell Github about the change: 7b44c3f, then I had to go back to https://github.com/neuropoly/neuropoly-docs/settings/pages just now and wait for Github to be satisfied, and then reenable Force HTTPS:

Screenshot 2021-11-17 at 10-09-01 Options · neuropoly neuropoly-docs

One weird thing: the cache timeout seems very long. Github only set an hour (3600s) timeout on their DNS records, but ours is 24 dayshours (86400s). This means that, in the rare case Github changes addresses, our site will be inaccessible for up to 3 weeks 1 day to different parts of the planet.

To work around this, I've put us to https://www.neuro.polymtl.ca. https://neuro.polymtl.ca is still, for some people, pointed at an internal webserver on campus, but it's got a redirect to www.neuro.polymtl.ca set up, so everything should just work for everyone. I'll undo this in a day or so so we can have the shorter URL again.

Copy link
Member

@joshuacwnewton joshuacwnewton left a comment

Choose a reason for hiding this comment

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

All of my requested changes were addressed a long while ago, so approving. 🙂

@kousu
Copy link
Member Author

kousu commented Nov 17, 2021

I turned down everyone's permissions on https://app.gitbook.io, and de-synced their copy:

2021-11-17-144147_603x849_scrot
2021-11-17-144152_522x297_scrot

Once this is merged I'll delete the Gitbook project/group too.

@kousu
Copy link
Member Author

kousu commented Nov 17, 2021

I went to namecheap and wiped all the DNS records I used for the demo address:

2021-11-17-145747_1109x386_scrot

kousu and others added 4 commits November 18, 2021 00:02
This doesn't actually do anything here right now,
but was discovered in
https://github.com/neuropoly/neuropoly-internal-docs/, which has
sphinx-panels enabled. If we enable sphinx-panels here too,
we'll need the same patch.
@kousu kousu merged commit 1262a03 into master Nov 18, 2021
@kousu kousu deleted the ng/sphinx branch November 18, 2021 05:03
@kousu kousu mentioned this pull request Dec 4, 2021
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.

Making contributions smoother