Skip to content

Commit

Permalink
Silence warnings (#1542)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
drammock authored Oct 30, 2023
1 parent 75367fc commit 568572a
Show file tree
Hide file tree
Showing 16 changed files with 212 additions and 1,851 deletions.
3 changes: 1 addition & 2 deletions docs/_extension/gallery_directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def run(self) -> List[nodes.Node]:
path_doc = Path(path_doc).parent
path_data = (path_doc / path_data_rel).resolve()
if not path_data.exists():
logger.warn(f"Could not find grid data at {path_data}.")
logger.info(f"Could not find grid data at {path_data}.")
nodes.text("No grid data found at {path_data}.")
return
yaml_string = path_data.read_text()
Expand All @@ -86,7 +86,6 @@ def run(self) -> List[nodes.Node]:
# and generate a card item for each of them
grid_items = []
for item in safe_load(yaml_string):

# remove parameters that are not needed for the card options
title = item.pop("title", "")

Expand Down
2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
"_extension.gallery_directive",
]

jupyterlite_config = "jupyterlite_config.json"

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

Expand Down
7 changes: 7 additions & 0 deletions docs/jupyterlite_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"LiteBuildConfig": {
"Application": {
"log_level": 40
}
}
}
1 change: 1 addition & 0 deletions docs/user_guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,6 @@ accessibility
analytics
static_assets
performance
warnings
readthedocs
```
15 changes: 15 additions & 0 deletions docs/user_guide/warnings.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

Theme changes, deprecations, and warnings
=========================================

Generally speaking, the best source of information about changes to the theme will be the release changelog.
We try to avoid raising warnings within theme code, which means sometimes the theme will change (perhaps significantly) without deprecation warnings or other alerts.
Still, we occasionally do warn about things like (upcoming) changes to the theme's default config values.
If you prefer *not* to receive such warnings, there is a config value to suppress them:

.. code-block::
:caption: conf.py
html_theme_options = {
"surface_warnings": False
}
10 changes: 9 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ def docs(session: nox.Session) -> None:
"-v",
"-w",
"warnings.txt",
# suppress Py3.11's new "can't debug frozen modules" warning
env=dict(PYDEVD_DISABLE_FILE_VALIDATION="1"),
)
session.run("python", "tests/utils/check_warnings.py")

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


Expand Down
Loading

0 comments on commit 568572a

Please sign in to comment.