Skip to content

Add tool to preview docs changes in a PR#3972

Merged
samsrabin merged 42 commits intoESCOMP:b4b-devfrom
samsrabin:docs-pr-preview-tool
Apr 27, 2026
Merged

Add tool to preview docs changes in a PR#3972
samsrabin merged 42 commits intoESCOMP:b4b-devfrom
samsrabin:docs-pr-preview-tool

Conversation

@samsrabin
Copy link
Copy Markdown
Member

@samsrabin samsrabin commented Apr 26, 2026

Description of changes

Given a GitHub PR URL, download the code as if it had been merged and then build the docs.

Example on Casper:

module load podman
tools/contrib/preview_docs_pr.py https://github.com/ESCOMP/CTSM/pull/3972
Will clone to '/glade/derecho/scratch/samrabin/preview_docs_pr.ESCOMP.CTSM.pr-3972'
Downloading zip from GitHub...
Unzipping...
Code downloaded to: '/glade/derecho/scratch/samrabin/preview_docs_pr.ESCOMP.CTSM.pr-3972/ESCOMP-CTSM-6579501'
Getting submodules...
Building docs...
Cleaning documentation build directory...
Done.
Building documentation...
The HTML pages are in _build/html.
Done.

The updated files are in /glade/derecho/scratch/samrabin/preview_docs_pr.ESCOMP.CTSM.pr-3972/ESCOMP-CTSM-6579501/doc/_build/html
Doc source files directly touched (not deleted) by PR:
    tech_note/CN_Pools/CLM50_Tech_Note_CN_Pools.html
    _images/screenshot_5718.png
    tech_note/index.html
Note that changes to these or other files may indirectly affect other doc files! For example, if one of these files is a new/changed image, or a new/changed text file that's `include`d somewhere, or a text file with an updated label that's cross-referenced elsewhere. Or if a file outside doc/source/ that's `include`d in a doc file got changed.

Specific notes

Contributors other than yourself, if any: None

CTSM Issues Fixed (include github issue #): None

Are answers expected to change (and if so in what way)? No

Any User Interface Changes (namelist or namelist defaults changes)? No

Does this create a need to change or add documentation? Did you do so? No. It's currently in tools/contrib/ and thus unsupported.

Testing performed, if any: Testing on #3958 and this PR.

  • Revert the docs changes that were made on this PR for testing purposes.

@samsrabin samsrabin self-assigned this Apr 26, 2026
@samsrabin samsrabin added the b4b bit-for-bit label Apr 26, 2026
@samsrabin samsrabin force-pushed the docs-pr-preview-tool branch from 4a8365f to 5d3126e Compare April 27, 2026 15:12
@samsrabin samsrabin added the enhancement new capability or improved behavior of existing capability label Apr 27, 2026
@samsrabin samsrabin marked this pull request as ready for review April 27, 2026 15:27
@samsrabin samsrabin changed the title [WIP] Add tool to preview docs changes in a PR Add tool to preview docs changes in a PR Apr 27, 2026
@samsrabin samsrabin changed the base branch from master to b4b-dev April 27, 2026 15:30
@samsrabin
Copy link
Copy Markdown
Member Author

samsrabin commented Apr 27, 2026

Thanks @slevis-lmwg!

  • Done with 428defb Prevent "Using 'master' as the name for the initial branch" message

@wwieder
Copy link
Copy Markdown
Contributor

wwieder commented Apr 27, 2026

My test failed. I did the following:

cd /glade/u/home/wwieder/ctsm-doc-preview
module load ncarenv/24.12
module load podman
tools/contrib/preview_docs_pr.py https://github.com/ESCOMP/CTSM/pull/3971

message:

Will clone to '/glade/derecho/scratch/wwieder/preview_docs_pr.ESCOMP.CTSM.pr-3971'
  Mergeability not yet computed, waiting 10 seconds and retrying(1/5)...
  Mergeability not yet computed, waiting 10 seconds and retrying(2/5)...
Downloading zip from GitHub...
Unzipping...
Code downloaded to: '/glade/derecho/scratch/wwieder/preview_docs_pr.ESCOMP.CTSM.pr-3971/ESCOMP-CTSM-fbd45ee'
Getting submodules...
Building docs...
Cleaning documentation build directory...
Documentation build failed.
Re-run with --verbose for full output.

Then running with --verbose:

tools/contrib/preview_docs_pr.py --verbose https://github.com/ESCOMP/CTSM/pull/3971

also failed

usage: preview_docs_pr.py [-h] [--dir EXTRACTION_DIR] [-o] pr_url
preview_docs_pr.py: error: unrecognized arguments: --verbose

@wwieder
Copy link
Copy Markdown
Contributor

wwieder commented Apr 27, 2026

Should I be doing this on casper?

@samsrabin
Copy link
Copy Markdown
Member Author

@wwieder I think this is related to whatever problem you had where you needed to load ctsm_pylib before building the docs. Could you reproduce that problem and tell me exactly what command you used and what all the printout was?

@samsrabin
Copy link
Copy Markdown
Member Author

Should I be doing this on casper?

@wwieder Also yes, I would have thought this should work fine on Derecho, but I'm getting errors. So yeah please try on Casper.

@wwieder
Copy link
Copy Markdown
Contributor

wwieder commented Apr 27, 2026

This worked on casper! Below is what I'm seeing for PR 3971, which provides updates for Sturm.

tools/contrib/preview_docs_pr.py https://github.com/ESCOMP/CTSM/pull/3971 -o
Will clone to '/glade/derecho/scratch/wwieder/preview_docs_pr.ESCOMP.CTSM.pr-3971'
Downloading zip from GitHub...
Deleting existing clone dir: '/glade/derecho/scratch/wwieder/preview_docs_pr.ESCOMP.CTSM.pr-3971/ESCOMP-CTSM-fbd45ee'
Unzipping...
Code downloaded to: '/glade/derecho/scratch/wwieder/preview_docs_pr.ESCOMP.CTSM.pr-3971/ESCOMP-CTSM-fbd45ee'
Getting submodules...
Building docs...
Cleaning documentation build directory...
Done.
Building documentation...
The HTML pages are in _build/html.
Done.

The updated files are in /glade/derecho/scratch/wwieder/preview_docs_pr.ESCOMP.CTSM.pr-3971/ESCOMP-CTSM-fbd45ee/doc/_build/html
Doc source files directly touched (not deleted) by PR:
    tech_note/Glacier/CLM50_Tech_Note_Glacier.html
    tech_note/Lake/CLM50_Tech_Note_Lake.html
    tech_note/References/CLM50_Tech_Note_References.html
    tech_note/Soil_Snow_Temperatures/CLM50_Tech_Note_Soil_Snow_Temperatures.html
Note that changes to these or other files may indirectly affect other doc files! For example, if one of these files is a new/changed image, or a new/changed text file that's `include`d somewhere, or a text file with an updated label that's cross-referenced elsewhere. Or if a file outside doc/source/ that's `include`d in a doc file got changed.

@wwieder
Copy link
Copy Markdown
Contributor

wwieder commented Apr 27, 2026

@wwieder I think this is related to whatever problem you had where you needed to load ctsm_pylib before building the docs. Could you reproduce that problem and tell me exactly what command you used and what all the printout was?

I haven't been able to reproduce this error since last week.

@samsrabin
Copy link
Copy Markdown
Member Author

Great, thanks Will! I'll go ahead and merge this. Then could you revert the changes you made to the docs docs in #3942?

Copy link
Copy Markdown
Contributor

@ekluzek ekluzek left a comment

Choose a reason for hiding this comment

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

This is great. It made it much easier to preview the documentation for a PR. I also added a softlink to the default directory for this on Scratch in VNC, which means I can pop this up really quickly.

I have a couple suggestions.

  • Change the script name to leave off the .py extention
  • Add a successfully done statement to the end
  • Use the ctsm_logging add_logging_args/process_logging_args to maange the --verbose argument

Comment thread tools/contrib/preview_docs_pr
Comment thread tools/contrib/preview_docs_pr
Comment thread tools/contrib/preview_docs_pr
@samsrabin
Copy link
Copy Markdown
Member Author

samsrabin commented Apr 27, 2026

@samsrabin samsrabin force-pushed the docs-pr-preview-tool branch from d799948 to a977d84 Compare April 27, 2026 21:42
Copy link
Copy Markdown
Contributor

@wwieder wwieder left a comment

Choose a reason for hiding this comment

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

Sorry, forgot to mark as approved

@samsrabin samsrabin merged commit ff80be8 into ESCOMP:b4b-dev Apr 27, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

b4b bit-for-bit enhancement new capability or improved behavior of existing capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants