Skip to content

Commit

Permalink
Better checking for external links (#619)
Browse files Browse the repository at this point in the history
  • Loading branch information
maddenp-noaa authored Oct 22, 2024
1 parent 9963a36 commit 406750c
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ source $(dirname ${BASH_SOURCE[0]})/common.sh
ci_conda_activate
cd docs
source install-deps
make linkcheck
make docs
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
- uses: actions/checkout@v3
- name: Install conda
run: .github/scripts/install-conda.sh
- name: Documentation Link Check
run: .github/scripts/link-check.sh
- name: Make Docs
run: .github/scripts/make-docs.sh
- name: Format Check
run: .github/scripts/format-check.sh
- name: Make Package
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
- uses: actions/checkout@v3
- name: Install conda
run: .github/scripts/install-conda.sh
- name: Documentation Link Check
run: .github/scripts/link-check.sh
- name: Make Docs
run: .github/scripts/make-docs.sh
- name: Format Check
run: .github/scripts/format-check.sh
- name: Test
Expand Down
8 changes: 2 additions & 6 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
BUILDDIR = build
LINKCHECKDIR = $(BUILDDIR)/linkcheck
SOURCEDIR = .
SPHINXBUILD = sphinx-build
SPHINXOPTS = -a -n -W --keep-going

.PHONY: help clean docs examples linkcheck
.PHONY: help clean docs examples

help:
$(SPHINXBUILD) -M help $(SOURCEDIR) $(BUILDDIR) $(SPHINXOPTS)
Expand All @@ -13,15 +12,12 @@ clean:
$(RM) -rv $(BUILDDIR)

docs:
$(MAKE) linkcheck
$(MAKE) html
linkchecker --check-extern --no-warnings build/html/index.html

examples:
COLUMNS=80 $(MAKE) -C sections

linkcheck:
$(SPHINXBUILD) -b linkcheck $(SPHINXOPTS) -c $(CURDIR) $(CURDIR) build/linkcheck

%:
mkdir -pv $(BUILDDIR)
$(SPHINXBUILD) -M $@ $(SOURCEDIR) $(BUILDDIR) $(SPHINXOPTS) -w $(BUILDDIR)/warnings.log
1 change: 0 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
html_static_path = ["static"]
html_theme = "sphinx_rtd_theme"
intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}
linkcheck_ignore = [r"https://github.com/.*#.*"]
nitpick_ignore_regex = [("py:class", r"^uwtools\..*"), ("py:class", "f90nml.Namelist")]
numfig = True
numfig_format = {"figure": "Figure %s"}
Expand Down
18 changes: 18 additions & 0 deletions docs/deps
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env python

from pathlib import Path
import re
import yaml

path = Path(__file__).parent / "environment.yml"
with open(path, "r", encoding="utf-8") as f:
deps = yaml.safe_load(f)["dependencies"]
specs = []
for dep in deps:
m = re.match(r"([^ ]+) *(.*)", dep)
assert m
pkg, ver = m.groups()
if re.match(r"^\d", ver):
ver = f"={ver}"
specs.append(f"'{pkg}{ver}'")
print(" ".join(sorted(specs)))
7 changes: 4 additions & 3 deletions docs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: readthedocs
channels:
- conda-forge
dependencies:
- python=3.12
- sphinx_rtd_theme=2.0.*
- sphinxcontrib-bibtex=2.6.*
- linkchecker 10.4.*
- python >=3.9,<3.13 # keep in sync with meta.yaml run req
- sphinx_rtd_theme 3.0.*
- sphinxcontrib-bibtex 2.6.*
- tree
3 changes: 1 addition & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ File/Directory Provisioning
| **CLI**: ``uw fs -h``
| **API**: ``import uwtools.api.fs``

This tool helps users define the source and destination of files to be copied or linked, or directories to be created, in the same UW YAML language used by UW drivers.

| :any:`CLI documentation with examples<cli_fs_mode>`
Expand All @@ -86,7 +85,7 @@ There is a video demonstration of the use of the ``uw fs`` tool (formerly ``uw f

.. raw:: html

<iframe width="560" height="315" src="https://www.youtube.com/embed/b2HXOlt-Ulw?si=rLWatBFu4mvNR65S" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
<iframe src="https://www.youtube.com/embed/b2HXOlt-Ulw" allowfullscreen frameborder="0" height="315" width="560"></iframe>

Rocoto Configurability
^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion docs/install-deps
Original file line number Diff line number Diff line change
@@ -1 +1 @@
conda install -q -y $(python -c "import yaml; f=open('$(dirname ${BASH_SOURCE[0]})/environment.yml'); print(' '.join(yaml.safe_load(f)['dependencies']))")
conda install -q -y $($(dirname ${BASH_SOURCE[0]})/deps)
2 changes: 1 addition & 1 deletion docs/sections/user_guide/cli/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ SUBDIRS = $(shell find . -maxdepth 1 -mindepth 1 -type d | sort)
all: $(SUBDIRS)

$(SUBDIRS):
$(MAKE) -C $@ -j
@$(MAKE) -C $@ -j
2 changes: 1 addition & 1 deletion docs/sections/user_guide/cli/Makefile.outputs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ OUTPUTS = $(COMMANDS:cmd=out)
all: $(OUTPUTS)

$(OUTPUTS):
bash $(basename $@).cmd >$@ 2>&1 | true
@bash $(basename $@).cmd >$@ 2>&1 | true
2 changes: 1 addition & 1 deletion docs/sections/user_guide/cli/drivers/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ SUBDIRS = $(filter-out ./shared,$(shell find . -maxdepth 1 -mindepth 1 -type d |
all: $(SUBDIRS)

$(SUBDIRS):
$(MAKE) -C $@ -j
@$(MAKE) -C $@ -j

0 comments on commit 406750c

Please sign in to comment.