Skip to content

chore: silence warnings in documentation build - #1718

Draft
timsaucer wants to merge 1 commit into
apache:mainfrom
timsaucer:chore/silence-doc-warnings
Draft

chore: silence warnings in documentation build#1718
timsaucer wants to merge 1 commit into
apache:mainfrom
timsaucer:chore/silence-doc-warnings

Conversation

@timsaucer

Copy link
Copy Markdown
Member

Which issue does this PR close?

No issue reported.

Rationale for this change

This is for developer convenience. Right now we generate a lot of unnecessary warnings that don't really apply to our documentation build. This PR silences these warnings.

What changes are included in this PR?

  • Give IPython a writable directory during documentation building.
  • Configure logging to suppress the "Kernel is running over TCP without encryption" warning

Are there any user-facing changes?

None.

`nb_execution_mode = "force"` starts a Jupyter kernel per executed page, and
each start printed two messages that have nothing to do with this build:

    [IPKernelApp] WARNING | Kernel is running over TCP without encryption...
    UserWarning: IPython parent '<home>' is not a writable location...

Together they accounted for every line of the build's stderr, which makes a
real Sphinx warning easy to miss. The build log is now empty on success.

The encryption notice is not describing a risk here. The kernel is a
short-lived child process on the same machine, executing pages from this
repository, reachable only over loopback.

Neither remedy the message suggests works. `transport="ipc"` silences it and
executes fine in isolation, but the real build then fails with "Kernel didn't
respond in 60 seconds". `KernelManager.transport_encryption = "auto"` fails at
kernel start on jupyter_client 8.9.1, which hands the provisioned CurveZMQ key
to the client as `str` where a `bytes` trait is expected. So the message is
filtered instead, by a logging filter matched to that one string rather than by
`log_level = "ERROR"`, so any other kernel warning still reaches the log. If
ipykernel rewords the message the filter stops matching and the warning
returns, which is the right way for it to fail.

The filter lives in `docs/ipython_kernel_config.py`, which `build.sh` copies
into a throwaway `IPYTHONDIR` profile. It has to be an IPython profile rather
than a `JUPYTER_CONFIG_PATH` entry, because `IPKernelApp` derives from
`BaseIPythonApplication` and reads the IPython profile directory —
`IPKernelApp().config_file_paths` is empty. Pointing `IPYTHONDIR` at a
writable directory is also what removes the second message.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant