canonical / sphinx-docs-starter-pack

A documentation starter-pack
https://canonical-starter-pack.readthedocs-hosted.com/
Other
15 stars 37 forks source link

switched to an rST-specific spellingcheck.yaml #134

Closed akcano closed 10 months ago

akcano commented 10 months ago

Showcasing a concept solution to align what the spelling check reports with what the author actually sees in her files. This needs some adjustment here and there, but the main point is clear, I hope.

NB: graciously borrowed from https://github.com/pytorch/tutorials/blob/main/.pyspelling.yml, may need a copyright notice

rkratky commented 10 months ago

Yes, please! Running the spellcheck on the resulting HTML is clumsy, and the output is often not very helpful. Switching to checking the sources would be a big improvement.

akcano commented 10 months ago

OK, I understand what you mean now.

Not a big fan of the idea though, unfortunately. 😟 Because:

The PR provides a raw solution for an ad-hoc scenario (so, for example, we have something to offer people who complain about the speed), but I think your concern for maintainability in the long run is very legitimate.

To address the issue, I'd probably start with a custom builder that would simply churn out what needs to be spellchecked in markup-less plain text, but I guess I'll sleep on this idea first. Please don't close the PR for now.

ru-fu commented 10 months ago

To address the issue, I'd probably start with a custom builder that would simply churn out what needs to be spellchecked in markup-less plain text, but I guess I'll sleep on this idea first. Please don't close the PR for now.

You mean a custom builder in Sphinx? That might be an option, yes.

Another idea I had when it comes to speeding up things is whether it would be possible to only check files that have changed. GitHub gives you the list of changed files, but I'm not sure if we can pass that into the spellcheck configuration.

rkratky commented 10 months ago

GitHub gives you the list of changed files, but I'm not sure if we can pass that into the spellcheck configuration.

There are GH Actions for that, but they seem a bit flakey... However, the same can be easily accomplished by regular Git commands.

That said, it seems to me the actual spellchecking is quite fast. The thing that's taking a lot of time is setting up the environment. I've been playing with containerizing the whole lot (all the checks), which looks like it could save quite some time.

akcano commented 10 months ago

I've been playing with containerizing the whole lot (all the checks), which looks like it could save quite some time.

Would love to take a look, as my experience with containerising spelling checks, or any other doc-related processes for that matter, is quite contrary to what you say.

ru-fu commented 10 months ago

Did you mean to close this?

At the starter pack discussion meeting, @tigarmo suggested to run the spelling check at doctree time - so we wouldn't have to bother with HTML, RST or Markdown, and the input files should be smaller (and thus quicker to process).

akcano commented 10 months ago

Yep, it's outdated by now. Anyway, moving the checks upstream and making them agnostic to markup is a very good idea!