Rebuild only the necessary ReST files.

Open
#21 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript, python

Research direction

Start by locating the callback hooked to env-before-read-docs and the directive-processing code. Read Sphinx's BuildEnvironment.note_dependency documentation and trace how relevant source files are available there. Done means incremental builds rebuild only reStructuredText documents dependent on changed JavaScript sources, rather than all found documents.

Written by the indexing model from the issue text.

Description

enhancement

Currently sphinx_js basically rebuilds the documentation every time as it hooks on env-before-read-docs and expands docs to process to all found_docs[0]. The docstring of the callback specifically notes that this is done "because we have no way of telling which ones reference JS code that might have changed".

Turns out, as I somehow managed to find out for an other project Sphinx actually has the tools for that: BuildEnvironment.note_dependency.

Just invoke it with the relevant source file(s) during directive processing and it will add the source file as a dependency of the current rST document, and will remember that during the next (incremental) build.

[0] incidentally a simpler version might have been to hook onto env-get-outdated and return found_docs, anything returned by the env-get-outdated handler is considered a changed file.

Dominant language
Python
Stars
290
Forks
80
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pyodide/sphinx-js

All issues in pyodide/sphinx-js

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.