[MRG] Fixes #343: document cycc functions in tslearn.metrics#676
Open
jbbqqf wants to merge 1 commit into
Open
Conversation
…I reference The functions cdist_normalized_cc and y_shifted_sbd_vec are re-exported via tslearn.metrics.__all__ (from tslearn/metrics/cycc.py) but were missing from the Sphinx autosummary in docs/gen_modules/tslearn.metrics.rst, so they did not show up on readthedocs. Add them to the autosummary and a guard test that fails if either symbol drifts out of the docs while staying in __all__.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #676 +/- ##
=======================================
Coverage 93.85% 93.86%
=======================================
Files 74 74
Lines 7081 7092 +11
=======================================
+ Hits 6646 6657 +11
Misses 435 435 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tslearn.metricsre-exportscdist_normalized_ccandy_shifted_sbd_vec(sourced fromtslearn/metrics/cycc.py) via__all__, but neither function appears in the Sphinx autosummary fortslearn.metrics, so they are absent from the rendered API reference on readthedocs. Add them so the docs match the public surface.Fixes #343 — Cross-correlation functions are undocumented
Context
The original report (Feb 2021) noted that after
cyccwas moved undertslearn.metricsin v0.5, none of its functions showed up in the generated reference at https://tslearn.readthedocs.io/en/stable/gen_modules/tslearn.metrics.html. The exports themselves were kept (tslearn/metrics/__init__.py:61, and both names are listed in__all__), but they were never added to the autosummary block indocs/gen_modules/tslearn.metrics.rst. Thenormalized_cchelper in the same module is an internal njit function and is not re-exported, so it is intentionally left out of the doc list.Changes
docs/gen_modules/tslearn.metrics.rst— addcdist_normalized_ccandy_shifted_sbd_vecto the autosummary list (the existing function docstrings already follow the project's NumPy-style convention).tests/test_metrics.py— addtest_cycc_functions_documented, a small guard test that fails if either symbol is intslearn.metrics.__all__but missing from the rst, so this won't drift back out silently.CHANGELOG.md— entry under[Towards v0.9.0] / Changedreferencing Cross-correlation functions are undocumented #343.Reproduce BEFORE/AFTER yourself (copy-paste)
What I ran locally
pytest tests/test_metrics.py::test_cycc_functions_documented -v→ 1 passed on the branch, 1 failed when the.rstchange is stashed (assertion:cdist_normalized_cc is exported by tslearn.metrics but missing from docs/gen_modules/tslearn.metrics.rst autosummary).pytest tests/test_utils.py→ 6 passed, 2 skipped (sanity-check that the test infra is unaffected).cdist_normalized_ccandy_shifted_sbd_vecare both intslearn.metrics.__all__on currentmain(commit95bd2d3).I did not rebuild the Sphinx docs locally — the change is a single addition to an existing
autosummaryblock with the same shape as the surrounding entries, so the html generation path is unchanged.Edge cases tested
__all__and in rsttest_cycc_functions_documented__all__but missing from rstgit stashthe rst patchnormalized_cc(not in__all__)tslearn/metrics/__init__.pyRisk / blast radius
Pure docs + test addition. No runtime code touched, no public API changed. The new test only reads files already present in the repo, so it is safe on CI (no network, no heavy compute).
Release note
PR drafted with assistance from Claude Code. The change was reviewed manually against tslearn-team/tslearn's source on commit
95bd2d3and the BEFORE/AFTER block above was the one I ran during development; a reviewer can paste it verbatim.