Skip to content

Commit

Permalink
Backport PR #13076: MAINT: Fix doc build
Browse files Browse the repository at this point in the history
  • Loading branch information
larsoner authored and meeseeksmachine committed Jan 22, 2025
1 parent 9d826d7 commit cea4321
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 14 deletions.
2 changes: 2 additions & 0 deletions doc/sphinxext/mne_doc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ def reset_warnings(gallery_conf, fname):
r"numpy\.core is deprecated and has been renamed to numpy\._core",
# matplotlib
"__array_wrap__ must accept context and return_scalar.*",
# nibabel
"__array__ implementation doesn't accept.*",
):
warnings.filterwarnings( # deal with other modules having bad imports
"ignore", message=f".*{key}.*", category=DeprecationWarning
Expand Down
24 changes: 16 additions & 8 deletions doc/sphinxext/related_software.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ def _get_packages() -> dict[str, str]:
packages = sorted(packages, key=lambda x: x.lower())
packages = [RENAMES.get(package, package) for package in packages]
out = dict()
reasons = []
for package in status_iterator(
packages, f"Adding {len(packages)} related software packages: "
):
Expand All @@ -183,12 +184,17 @@ def _get_packages() -> dict[str, str]:
else:
md = importlib.metadata.metadata(package)
except importlib.metadata.PackageNotFoundError:
pass # raise a complete error later
reasons.append(f"{package}: not found, needs to be installed")
continue # raise a complete error later
else:
# Every project should really have this
do_continue = False
for key in ("Summary",):
if key not in md:
raise ExtensionError(f"Missing {repr(key)} for {package}")
reasons.extend(f"{package}: missing {repr(key)}")
do_continue = True
if do_continue:
continue
# It is annoying to find the home page
url = None
if "Home-page" in md:
Expand All @@ -204,15 +210,17 @@ def _get_packages() -> dict[str, str]:
if url is not None:
break
else:
raise RuntimeError(
f"Could not find Home-page for {package} in:\n"
f"{sorted(set(md))}\nwith Summary:\n{md['Summary']}"
reasons.append(
f"{package}: could not find Home-page in {sorted(md)}"
)
continue
out[package]["url"] = url
out[package]["description"] = md["Summary"].replace("\n", "")
bad = [package for package in packages if not out[package]]
if bad and REQUIRE_METADATA:
raise ExtensionError(f"Could not find metadata for:\n{' '.join(bad)}")
reason_str = "\n".join(reasons)
if reason_str and REQUIRE_METADATA:
raise ExtensionError(
f"Could not find suitable metadata for related software:\n{reason_str}"
)

return out

Expand Down
2 changes: 1 addition & 1 deletion tools/circleci_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ python -m pip install --upgrade --progress-bar off \
mne-icalabel mne-lsl mne-microstates mne-nirs mne-rsa \
neurodsp neurokit2 niseq nitime openneuro-py pactools \
plotly pycrostates pyprep pyriemann python-picard sesameeg \
sleepecg tensorpac yasa meegkit eeg_positions
sleepecg tensorpac yasa meegkit eeg_positions wfdb
10 changes: 5 additions & 5 deletions tutorials/intro/70_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
and after each preprocessing step, epoch rejection statistics, MRI slices with overlaid
BEM shells, all the way up to plots of estimated cortical activity.
Compared to a Jupyter notebook, :class:`mne.Report` is easier to deploy, as the
HTML pages it generates are self-contained and do not require a running Python
environment. However, it is less flexible as you can't change code and re-run
something directly within the browser. This tutorial covers the basics of
building a report. As usual, we will start by importing the modules and data we need:
Compared to a Jupyter notebook, :class:`mne.Report` is easier to deploy, as the HTML
pages it generates are self-contained and do not require a running Python environment.
However, it is less flexible as you can't change code and re-run something directly
within the browser. This tutorial covers the basics of building a report. As usual,
we will start by importing the modules and data we need:
"""

# Authors: The MNE-Python contributors.
Expand Down
1 change: 1 addition & 0 deletions tutorials/inverse/20_dipole_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
# %%
# Calculate and visualise magnetic field predicted by dipole with maximum GOF
# and compare to the measured data, highlighting the ipsilateral (right) source

fwd, stc = make_forward_dipole(dip, fname_bem, evoked.info, fname_trans)
pred_evoked = simulate_evoked(fwd, stc, evoked.info, cov=None, nave=np.inf)

Expand Down

0 comments on commit cea4321

Please sign in to comment.