[DOCS] Templates for API Reference#893
Conversation
playing around with rst
adding the rst to toc
* Improved docstring and added examples * Added the link ratios * docs: add doctest examples for correlation classes Adds Sphinx doctest Examples sections to DevelopmentCorrelation and ValuationCorrelation. Each example opens with the Mack chain-ladder assumption being tested, prints the full decision signal (statistic, confidence band, and boolean) rather than a single boolean, and ties the result back to the chain-ladder workflow. Refs #704 * docs: add BootstrapODPSample doctest examples Adds Sphinx doctest Examples section to the BootstrapODPSample class showing basic fit (resampled_triangles_.shape and scale_), downstream stochastic IBNR via Chainladder, and the effect of drop_high on scale_. Uses random_state=42 and n_sims=100 for deterministic, fast output. Refs #704 * docs: reframe drop_high example as sensitivity check Rewords the paragraph introducing the drop_high=True example to describe it as a leave-one-out sensitivity check on the column maxima rather than outlier removal, since drop_high mechanically removes the column max without any outlier test. Addresses review feedback on #836. * docs: move per-diagonal vs total mode note between testcode blocks Per @henrydingliu review on #844: opening paragraph now scoped to the calendar-effect concept; the per-diagonal vs whole-triangle distinction is introduced as a transition between the two testcode blocks. Refs #704 * docs: add README documenting docs build sources and outputs (refs #845) * Added the transformed link ratio triangle using fit_transform to examples * Removed the multiple testouputs * docs: address review feedback on docs README (refs #845) - Drop the jb build internals + duplicate warnings note (kennethshsu) - Rename 'tutorial notebooks' to 'onboarding and Quickstart notebooks' (kennethshsu) - Drop the 'What to edit for which part of the site' table and 'Known issues' section as redundant with the Source files table and #841 (kennethshsu) * [REFACTOR]: Remove repetitive code. Remove dead Python 3.8 code. Add missing unit tests. * [FIX]: Limit test to only those values meant to be changed. Use realistic values for changed options. * [DOCS]: Finish updating Options docstring. * [FIX]: Fix ending state of test. * [FIX]: Reset backend after sparse-only run. * [REFACTOR] Create template fixture for sample data sets. * [Fix]: Remove duplicate fixture. * [REFACTOR]: Move datetime defaults out of Options. Add validation to option getters and setters. Deprecate cl.array_backend() and cl.auto_sparse() * FIX: Apply Bugbot fix. * FIX: Apply Bugbot fix. * FIX: Apply Bugbot fix. * DOCS: Add docstring, clean up test. * DOCS: Update docstring. * Friedland Chapter 6 and half of Chapter 7 (#837) first batch of deliverables for friedland reconstruction * Delete docs/library/generated/chainladder.Development.rst --------- Co-authored-by: Kenneth Hsu <kennethshsu@gmail.com> Co-authored-by: priyam0k <87162535+priyam0k@users.noreply.github.com> Co-authored-by: Gene Dan <genedan@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #893 +/- ##
==========================================
+ Coverage 87.04% 87.21% +0.17%
==========================================
Files 86 87 +1
Lines 4986 5344 +358
Branches 646 749 +103
==========================================
+ Hits 4340 4661 +321
- Misses 456 480 +24
- Partials 190 203 +13
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Drop :show-inheritance: from the class templates so internal base classes (e.g. MethodBase behind Chainladder) are no longer listed. - Add :inherited-members: to the plain class template so useful inherited methods like to_pickle appear on pages such as Development.
Adding :inherited-members: to the class template surfaces members like Pipeline.steps that exist on instances but not on the class object, so linkcode's getattr walk raised AttributeError and aborted the build. Skip linking those members instead.
|
@kennethshsu I plan on moving this out of draft ASAP. One more small link bug to fix with Priyam's help. But majority of the PR is ready for review. Given the size of this PR looks daunting (50 diff files), I'd like to put it in front of you now while we get that last bug worked out. the motivation for this PR is twofold.
long term, the custom templates that's introduced to solve item No. 2 will enable us to have much more control over the api reference. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 19f5598. Configure here.
| "```{glue:} plot_mack\n", | ||
| ":::{grid-item-card}\n", | ||
| ":columns: 4\n", | ||
| ":link: ...gallery/plot_mack\n", |
There was a problem hiding this comment.
Broken doc link uses three dots instead of two
Medium Severity
The :link: value ...gallery/plot_mack has three dots with no separating slash, making it an invalid relative doc reference. Every other grid-item-card link in the codebase (e.g. in development.ipynb) uses the correct two-dot-slash pattern ../gallery/.... This will produce a broken link on the MackChainladder examples card.
Reviewed by Cursor Bugbot for commit 19f5598. Configure here.
There was a problem hiding this comment.
ignoring. will fix in a future PR
| ":link: ...gallery/plot_mack\n", | ||
| ":link-type: doc\n", | ||
| "**[MackChainladder Basics]**\n", | ||
| "```{image} ../images/plot_mack.png\n", |
There was a problem hiding this comment.
Grid directive never closed, citations rendered inside grid
Medium Severity
The ::::{grid} directive opened at line 529 is never closed with a matching ::::. The ::: at line 542 only closes the inner :::{grid-item-card}. This leaves the {cite} references trapped inside the unclosed grid and may cause rendering issues. Every other grid in development.ipynb properly closes with :::: before placing citations outside.
Reviewed by Cursor Bugbot for commit 19f5598. Configure here.
There was a problem hiding this comment.
ignoring. will fix in a future PR
| {% for method in inherited %} | ||
| {{ objname }}.{{ method }} | ||
| {% endfor %} | ||
| {% endif %} |
There was a problem hiding this comment.
Two autosummary templates are completely identical files
Low Severity
class.rst and class_inherited.rst are byte-for-byte identical. The class_inherited template is used for Triangle and correlation classes (presumably to show inherited members inline), but it lacks :inherited-members: in its autoclass directive. Either the template needs to differ from class.rst (e.g. by adding :inherited-members:) or one of the two files is redundant.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 19f5598. Configure here.
There was a problem hiding this comment.
intentional. will vary in the future
|
How much of this has been reviewed? @henrydingliu I think you reviewed a lot of these already right (as in you are not the original author)? |
great question. changes authored by @priyam0k and already reviewed by me
files that @priyam0k and I both worked on
these templates are the most impactful changes. to review, less so functionally, but maybe more stylistically/look-&-feel. i would recommend looking through a handful of classes in the api reference, particularly the heavy-hitting ones like triangle and development. comparing the experimental version and the main side by side is probably helpful too. the balance i tried to strike at the end is maintain all inherited methods in a summary table (just like before) but allowing the class methods to show the full docstring. i would also say that with custom templates, nothing is a one-way door, i.e. we can change the layout anytime. but i wanted another set of eyes to make sure there's not some glaring oversight that we need to immediately address. doc fixes I've making here and there to reduce doctest warnings. these are low impact
|


Summary of Changes
Docs-only; no runtime, config, or public API changes.
Three issues fixed along the way:
Related GitHub Issue(s)
closes #887
closes #846
closes #847
partially addresses #888
Additional Context for Reviewers
conf.pyis regenerated from_config.ymlby Jupyter Book; both updated to stay in sync.
Page | Inline methods | Inline properties | numpydoc table -- | -- | -- | -- Development (class) | 3 | 0 | none Triangle (class_inherited) | 64 | 24 | none load_sample (function) | function block | – | –jb build .succeeds (warnings all pre-existing). HTML spot checks:uv run pytest) and documentation changes (uv run jb build docs --builder=custom --custom-builder=doctest)Note
Low Risk
Changes are limited to documentation build, templates, and docstrings; no runtime or estimator logic is modified.
Overview
This PR is docs-only for the API reference and user guide; it does not change reserving behavior or public Python APIs.
API reference build: Committed autosummary stubs under
docs/library/generated/are removed and that path is gitignored so Sphinx regenerates them on each build. Custom autosummary templates (class,class_inherited,function) list class members inline and inherited methods in a separate summary table;docs/library/api.md:template:values drop the.rstsuffix so Sphinx resolves templates correctly.numpydoc_show_class_members = Falseandtemplates_pathare set indocs/_config.ymlanddocs/conf.pyto avoid duplicate member tables.Linkcode:
docs/_ext/linkcode.pynow skips missing attributes, unwrapspropertytofget, and guardsgetsourcefile/getsourcelinesso API pages do not abort the Jupyter Book build.User guide / misc: User guide cards and one MackChainladder example switch from
glue:figures to static../images/*.png;methods.ipynbuses a grid card for the Mack gallery link. Small docstring fixes inchainladder/core/pandas.py,incremental.py, andcapecod.py; one bibliography URL update inreferences.bib.Reviewed by Cursor Bugbot for commit 19f5598. Bugbot is set up for automated code reviews on this repo. Configure here.