-
Notifications
You must be signed in to change notification settings - Fork 2
Update documentation contributor guide #55
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,111 @@ | ||
| # PyUnitWizard's Documentation | ||
| # PyUnitWizard Documentation Guide | ||
|
|
||
| This guide explains how the documentation project is organized and how to work with it day-to-day—from setting up the environment to publishing updates on GitHub Pages. | ||
|
|
||
| ## Directory Layout | ||
|
|
||
| ``` | ||
| docs/ | ||
| ├── AGENTS.md # Documentation-specific contribution rules | ||
| ├── README.md # This contributor quick-start | ||
| ├── Makefile / make.bat # Convenience wrappers for sphinx-build | ||
| ├── clean_api.py # Removes stale autosummary outputs | ||
| ├── execute_notebooks.py # Batch-executes notebooks & updates markers | ||
| ├── content/ # Narrative guides and tutorials (MyST + notebooks) | ||
| ├── api/ # Landing pages for API autosummary stubs | ||
| ├── _static/ # Custom CSS/JS and other static assets | ||
| ├── _templates/ # Jinja templates consumed by Sphinx | ||
| ├── bibliography.bib # Shared citation database | ||
| └── ... | ||
| ``` | ||
|
|
||
| Notebooks typically live under `content/` and are tracked together with their `.nbconvert.last_run` timestamp files. Anything generated during builds—such as `_build/` or autosummary folders—is temporary and must be recreated locally when needed. | ||
|
|
||
| ## Environment Setup | ||
|
|
||
| The documentation toolchain is defined in `devtools/conda-envs/docs_env.yaml`. Create (or update) the environment before running any docs-specific tasks: | ||
|
|
||
| ```bash | ||
| conda env create -f devtools/conda-envs/docs_env.yaml # first-time setup | ||
| conda env update -f devtools/conda-envs/docs_env.yaml # subsequent syncs | ||
| conda activate pyunitwizard-docs | ||
| ``` | ||
|
|
||
| > ℹ️ If you already have the environment, `conda env update` is sufficient to pick up new dependencies. | ||
|
|
||
| ## Notebook Execution Workflow | ||
|
|
||
| Use `docs/execute_notebooks.py` to execute notebooks and refresh `.nbconvert.last_run` markers: | ||
|
|
||
| ```bash | ||
| # Run all notebooks below docs/content/ | ||
| python docs/execute_notebooks.py -r docs/content | ||
|
|
||
| # Force execution even when timestamps are current | ||
| python docs/execute_notebooks.py -r docs/content --force | ||
| ``` | ||
|
|
||
| After every run: | ||
|
|
||
| 1. Inspect `.nbconvert.log` files for errors. Fix issues and rerun as needed. | ||
| 2. Remove `.nbconvert.log` files before committing—they are build artifacts. | ||
| 3. Stage updated notebooks **together with** their `.nbconvert.last_run` companions so CI can skip unchanged notebooks. | ||
|
|
||
| ## Cleaning Autosummary Output | ||
|
|
||
| Whenever the public API changes, clear obsolete autosummary trees to avoid stale reference pages: | ||
|
|
||
| ```bash | ||
| python docs/clean_api.py | ||
| ``` | ||
|
|
||
| Run the command after a docs build that touches API pages, or before committing when you notice outdated files under `docs/api/autosummary/`. | ||
|
|
||
| ## Building the Docs Locally | ||
|
|
||
| Sphinx builds can be triggered with the provided Makefile or directly via `sphinx-build`. | ||
|
|
||
| ```bash | ||
| # Recommended: uses configuration from docs/Makefile | ||
| (cd docs && make html) | ||
|
|
||
| # Equivalent explicit invocation | ||
| sphinx-build -M html docs docs/_build | ||
| ``` | ||
|
|
||
| Common targets include: | ||
|
|
||
| - `make clean` – remove the `_build/` tree before a fresh build. | ||
| - `make html` – render the full site for local preview. | ||
|
|
||
| Open `docs/_build/html/index.html` in your browser to inspect the result. Never commit the `_build/` directory. | ||
|
|
||
| ## Publishing to GitHub Pages | ||
|
|
||
| Documentation is published from the HTML output in `docs/_build/html`. The default workflow relies on GitHub Actions (`.github/workflows/sphinx_docs_to_gh_pages.yaml`), which automatically builds and deploys the site whenever the main branch is updated. Manual publishing is rarely needed, but when required: | ||
|
|
||
| 1. Build the site locally (`make html`). | ||
| 2. Push the rendered site to the `gh-pages` branch, for example: | ||
| ```bash | ||
| git subtree push --prefix docs/_build/html origin gh-pages | ||
| ``` | ||
| Ensure the CI workflow is disabled or coordinated with maintainers before manual pushes. | ||
|
|
||
| ## Version Control Expectations | ||
|
|
||
| - Track `.nbconvert.last_run` marker files alongside their notebooks. | ||
| - Exclude `_build/`, `.nbconvert.log`, and other transient outputs from commits. | ||
| - Regenerate autosummary content instead of hand-editing generated files. | ||
|
|
||
| ## Pre-PR Checklist | ||
|
|
||
| Before opening a documentation pull request, confirm that you have: | ||
|
|
||
| - [ ] Rebuilt the docs locally (`make html`) and resolved warnings. | ||
| - [ ] Executed each modified notebook with `python docs/execute_notebooks.py` and cleaned up `.nbconvert.log` files. | ||
| - [ ] Staged updated notebooks together with their `.nbconvert.last_run` markers. | ||
| - [ ] Ensured `_build/` and other generated artifacts remain untracked. | ||
| - [ ] Updated navigation, toctrees, or cross-references affected by your changes. | ||
| - [ ] Documented any new dependencies or Sphinx extensions in the PR description. | ||
|
|
||
| Following these steps keeps the documentation consistent and the CI pipeline green for every contributor. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The environment setup snippet uses
conda env create -f devtools/conda-envs/docs_env.yamlandconda env update -f …, but the YAML file does not define an environmentname. Running those commands raisesCondaValueError: Key 'name' missingunless the user supplies a name or the helper scripts are used. The instructions should either pass-n <env>or point contributors tocreate_conda_env.py/update_conda_env.pyso setup succeeds【F:docs/README.md†L24-L32】【F:devtools/conda-envs/docs_env.yaml†L1-L18】Useful? React with 👍 / 👎.