Skip to content

Commit 568572a

Browse files
authored
Silence warnings (#1542)
* avoid webpack warning during asset compile * avoid frozen modules warning during import * try to make jupyterlite quieter * add config option to silence warnings * fix tests * add docs * hide conditional warning logic in utils
1 parent 75367fc commit 568572a

File tree

16 files changed

+212
-1851
lines changed

16 files changed

+212
-1851
lines changed

docs/_extension/gallery_directive.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def run(self) -> List[nodes.Node]:
7575
path_doc = Path(path_doc).parent
7676
path_data = (path_doc / path_data_rel).resolve()
7777
if not path_data.exists():
78-
logger.warn(f"Could not find grid data at {path_data}.")
78+
logger.info(f"Could not find grid data at {path_data}.")
7979
nodes.text("No grid data found at {path_data}.")
8080
return
8181
yaml_string = path_data.read_text()
@@ -86,7 +86,6 @@ def run(self) -> List[nodes.Node]:
8686
# and generate a card item for each of them
8787
grid_items = []
8888
for item in safe_load(yaml_string):
89-
9089
# remove parameters that are not needed for the card options
9190
title = item.pop("title", "")
9291

docs/conf.py

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
"_extension.gallery_directive",
4949
]
5050

51+
jupyterlite_config = "jupyterlite_config.json"
52+
5153
# Add any paths that contain templates here, relative to this directory.
5254
templates_path = ["_templates"]
5355

docs/jupyterlite_config.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"LiteBuildConfig": {
3+
"Application": {
4+
"log_level": 40
5+
}
6+
}
7+
}

docs/user_guide/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,6 @@ accessibility
7474
analytics
7575
static_assets
7676
performance
77+
warnings
7778
readthedocs
7879
```

docs/user_guide/warnings.rst

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
Theme changes, deprecations, and warnings
3+
=========================================
4+
5+
Generally speaking, the best source of information about changes to the theme will be the release changelog.
6+
We try to avoid raising warnings within theme code, which means sometimes the theme will change (perhaps significantly) without deprecation warnings or other alerts.
7+
Still, we occasionally do warn about things like (upcoming) changes to the theme's default config values.
8+
If you prefer *not* to receive such warnings, there is a config value to suppress them:
9+
10+
.. code-block::
11+
:caption: conf.py
12+
13+
html_theme_options = {
14+
"surface_warnings": False
15+
}

noxfile.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ def docs(session: nox.Session) -> None:
7777
"-v",
7878
"-w",
7979
"warnings.txt",
80+
# suppress Py3.11's new "can't debug frozen modules" warning
81+
env=dict(PYDEVD_DISABLE_FILE_VALIDATION="1"),
8082
)
8183
session.run("python", "tests/utils/check_warnings.py")
8284

@@ -92,7 +94,13 @@ def docs_live(session: nox.Session) -> None:
9294
"sphinx-theme-builder[cli]@git+https://github.com/pradyunsg/sphinx-theme-builder#egg=d9f620b"
9395
)
9496
session.run(
95-
"stb", "serve", "docs", "--open-browser", "--re-ignore=locale|api|_build"
97+
"stb",
98+
"serve",
99+
"docs",
100+
"--open-browser",
101+
r"--re-ignore=locale|api|_build|\.jupyterlite\.doit\.db",
102+
# suppress Py3.11's new "can't debug frozen modules" warning
103+
env=dict(PYDEVD_DISABLE_FILE_VALIDATION="1"),
96104
)
97105

98106

0 commit comments

Comments
 (0)