Skip to content

Warn on unrecognized Configurable kwargs with UserWarning - #976

Open
DSeaStar wants to merge 2 commits into
ipython:mainfrom
DSeaStar:fix/configurable-unrecognized-user-warning
Open

Warn on unrecognized Configurable kwargs with UserWarning#976
DSeaStar wants to merge 2 commits into
ipython:mainfrom
DSeaStar:fix/configurable-unrecognized-user-warning

Conversation

@DSeaStar

Copy link
Copy Markdown

Fixes #926.

HasTraits.__init__ already warns when leftover kwargs are passed through to object.__init__. The warning used DeprecationWarning at stacklevel=2, so for Configurable subclasses the reported frame is Configurable.__init__ and IPython hides it.

@minrk noted that this is always a bug in the calling code and that UserWarning is appropriate. This switches the category so the message is visible by default, including for Configurable / IPython.embed() typos.

DSeaStar and others added 2 commits August 14, 2026 20:53
HasTraits already warned when leftover kwargs reached object.__init__,
but it used DeprecationWarning at stacklevel=2. That points at
Configurable.__init__, so IPython hid the message. UserWarning is
visible by default, which matches the discussion on ipython#926.
@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.15%. Comparing base (1dae189) to head (3d606be).

Components Coverage Δ
traitlets 85.50% <ø> (ø)
tests 99.07% <100.00%> (+<0.01%) ⬆️

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@DSeaStar

Copy link
Copy Markdown
Author

The downstream / jupyter_server failure looks pre-existing and unrelated to this change: the same job fails on main (e.g. the latest Tests run on main, run 31784339759, has downstream / jupyter_server → failure, and main has been red on that job every day since Aug 9).

The failing test there is jupyter_server's own tests/test_utils.py::test_check_version (packaging.version.InvalidVersion: Invalid version: 1.0), caused by the newer packaging release rejecting float versions — nothing to do with the UserWarning for unrecognized kwargs added here. All other jobs on this PR are green.

@DSeaStar

Copy link
Copy Markdown
Author

Update on the second failing check: downstream / downstream_check is not a real test job — it is the alls-green aggregation job that merely mirrors the state of the five downstream jobs (see downstream_check in .github/workflows/downstream.yml, needs: [notebook, ipywidgets, jupyter_server, nbconvert, ipython]). It is red here solely because downstream / jupyter_server is red, and that same job fails identically on main (run 31784339759: tests/test_utils.py::test_check_versionpackaging.version.InvalidVersion: Invalid version: 1.0, the same signature as on this PR). No action needed on this PR for either check.

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.

Configurable should warn on unrecognized arguments

1 participant