Skip to content

API Deprecate the orphaned public API listed in #1442 - #1734

Merged
bruAristimunha merged 5 commits into
braindecode:masterfrom
ptlnextdoor:fix/oss-bdv-orphan-api-deprecations
Nov 21, 2026
Merged

bruAristimunha merged 5 commits into
braindecode:masterfrom
ptlnextdoor:fix/oss-bdv-orphan-api-deprecations

Conversation

@ptlnextdoor

Copy link
Copy Markdown
Contributor

Summary

The checklist in #1442 asks to "Deprecate the orphaned public API listed above". Nine public names have no user in braindecode. This PR makes each emit a DeprecationWarning and announces removal in 2.2. VectorQuantizer is left out because BrainOmni, MEGXL and NeuroRVQTokenizer now use it.

Part of #1442

Changes

  • Add a private _warn_orphaned_api helper in braindecode/util.py. It warns at the caller's line.
  • Warn in MaxNormConstraintCallback, load_bbci_sets_from_folder, is_registered_dataset, IntermediateOutputWrapper, StatLayer, get_balanced_batches, read_all_file_names, corr and cov. Each docstring gets a .. deprecated:: 2.1 note.
  • MeanLayer, MaxLayer, VarLayer, StdLayer, LogVarLayer and LogPowerLayer are used by FBCNet and FBLightConvNet. They now build on a private _StatLayer, so they do not warn. StatLayer is a thin subclass that warns.
  • corr calls a private _cov, so it emits one warning, not two.
  • The removal window (2.2) matches the other 2.1 deprecations.
  • docs/whats_new.rst entry in "API and behavior changes".

Testing

  • python -m pytest -n 2 -q test/unit_tests/test_orphan_deprecations.py test/unit_tests/test_util.py test/unit_tests/modules test/unit_tests/training: 1862 passed, 68 skipped.

  • python -m pytest -q test/unit_tests/test_orphan_deprecations.py after a last test edit: 10 passed.

  • ruff format on the changed files. I did not run pre-commit, because it is not installed in the shared environment.

  • I did not run the model and dataset test suites.

  • New or changed behavior is covered by relevant regression tests

  • Style checks recorded

  • docs/whats_new.rst updated

Notes for reviewers

  • The deprecation window is my choice: the issue leaves it open, so I used the "removed in 2.2" window of the other 2.1 deprecations.
  • StatLayer was not fully orphaned: the stat layer partials wrap it. The private base keeps those layers silent.

AI disclosure: this PR was prepared with AI assistance (Claude, Anthropic).

MaxNormConstraintCallback, load_bbci_sets_from_folder, is_registered_dataset, IntermediateOutputWrapper, StatLayer and the util functions get_balanced_batches, read_all_file_names, corr and cov have no user in braindecode. Each now emits a DeprecationWarning and will be removed in 2.2. MeanLayer and the other stat layers keep working without a warning because they now build on a private _StatLayer.
Copilot AI balanced review requested due to automatic review settings November 21, 2026 04:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

Copilot AI balanced review requested due to automatic review settings November 21, 2026 07:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@codecov

codecov Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.78%. Comparing base (9fb6d0a) to head (e40d5ab).
⚠️ Report is 119 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1734      +/-   ##
==========================================
+ Coverage   92.26%   93.78%   +1.51%     
==========================================
  Files         185      190       +5     
  Lines       24325    24956     +631     
==========================================
+ Hits        22443    23404     +961     
+ Misses       1882     1552     -330     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…y the docs

- Restore braindecode/modules/stats.py to master and drop the StatLayer test
  cases. StatLayer is not orphaned: it is the class behind MeanLayer,
  MaxLayer, VarLayer, StdLayer, LogVarLayer and LogPowerLayer, which FBCNet,
  FBMSNet and FBLightConvNet build. The restructure changed isinstance and
  type names for code written against v2.0.0.
- Warn with FutureWarning instead of DeprecationWarning. The default Python
  filters hide a DeprecationWarning raised from a user's imported module, and
  every other 2.1 deprecation uses FutureWarning.
- Move each .. deprecated:: note out of the Returns and Examples sections to
  just after the summary, so numpydoc no longer reads it as a return value.
- Shorten the changelog entry to 3 lines.
- test_util.py ignores the new warning; test_orphan_deprecations checks it.
Copilot AI balanced review requested due to automatic review settings November 21, 2026 14:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

Copilot AI balanced review requested due to automatic review settings November 21, 2026 14:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@bruAristimunha
bruAristimunha merged commit ab7bfe4 into braindecode:master Nov 21, 2026
7 checks passed
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.

3 participants