Skip to content

Experimental#893

Draft
henrydingliu wants to merge 162 commits into
mainfrom
experimental
Draft

Experimental#893
henrydingliu wants to merge 162 commits into
mainfrom
experimental

Conversation

@henrydingliu
Copy link
Copy Markdown
Collaborator

@henrydingliu henrydingliu commented May 31, 2026

Summary of Changes

Adds custom sphinx.ext.autosummary templates under docs/_templates/autosummary/: class.rst, class_inherited.rst, function.rst.
API class pages now list methods and properties inline instead of a summary table that links to a separate page per method.
Fixes the :template: names in docs/library/api.md to drop .rst (:template: class.rst → :template: class).
Sets numpydoc_show_class_members = False and templates_path = ['_templates'] in docs/_config.yml (and the generated docs/conf.py).
Guards docs/_ext/linkcode.py against property objects so inline members don't crash the build.
Deletes the 36 .rst stub files under docs/library/generated/.
Adds docs/library/generated/ to .gitignore, mirroring the existing docs/modules/generated/ entry one line above.
These files are emitted by sphinx.ext.autosummary on every docs build (autosummary_generate = True in docs/conf.py, driven by the eight :toctree: generated/ directives in docs/library/api.md), so committing them is redundant and the committed copies drift out of sync with what Sphinx actually produces.
Docs-only; no runtime, config, or public API changes. Rendered HTML site is unchanged — the stubs are regenerated automatically on jb build ..

Three issues fixed along the way:

:template: class.rst never worked. Sphinx appends .rst, so it looked for autosummary/class.rst.rst and fell back to the base template. Names now omit the extension.
numpydoc duplicate table. numpydoc_show_class_members = False stops numpydoc emitting its own members table next to the inline members.
linkcode_resolve crash. Inline members pass property objects to the resolver, where inspect.getsourcefile(property) raises TypeError and aborts jb build. Fixed by unwrapping properties to fget and guarding getsourcefile / getsourcelines.

Related GitHub Issue(s)

closes #887
closes #846
closes #847
partially addresses #888

Additional Context for Reviewers

  • conf.py is regenerated from _config.yml by Jupyter Book; both updated to stay in sync.

  • jb build . succeeds (warnings all pre-existing). HTML spot checks:

    Page | Inline methods | Inline properties | numpydoc table -- | -- | -- | -- Development (class) | 3 | 0 | none Triangle (class_inherited) | 64 | 24 | none load_sample (function) | function block | – | –

  • I passed tests locally for both code (uv run pytest) and documentation changes (uv run jb build docs --builder=custom --custom-builder=doctest)

Note

Low Risk
Changes are documentation and docstring formatting only; no runtime behavior or public API semantics are altered.

Overview
This PR reworks Sphinx autosummary so API class pages list members inline instead of linking to per-method stub pages. It adds docs/_templates/autosummary/ templates (class, class_inherited, function), fixes :template: values in docs/library/api.md (drop .rst so Sphinx does not look for class.rst.rst), and sets numpydoc_show_class_members = False plus templates_path in docs/_config.yml / docs/conf.py to avoid duplicate member tables.

Build reliability: docs/_ext/linkcode.py unwraps property objects to fget and guards getsourcefile / getsourcelines so inline members do not abort the docs build. Generated stubs under docs/library/generated/ are removed from the repo and docs/library/generated/ is added to .gitignore (regenerated on each build).

Smaller doc edits: user guide cards swap glue figures for static images; one MackChainladder example moves from panels to a grid card; a bibliography URL is updated. chainladder changes are docstring-only (formatting / RST escaping in pandas.py, incremental.py, capecod.py).

Reviewed by Cursor Bugbot for commit 0b26dd3. Bugbot is set up for automated code reviews on this repo. Configure here.

genedan and others added 29 commits May 29, 2026 14:33
…option getters and setters. Deprecate cl.array_backend() and cl.auto_sparse()
* 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)

* docs: remove autosummary-generated API stubs and gitignore them (refs #846)

These .rst files under docs/library/generated/ are emitted by sphinx.ext.autosummary on every build (autosummary_generate = True in docs/conf.py, driven by the :toctree: generated/ directives in docs/library/api.md). Committing them is redundant and out of sync with the rest of the build. Adds docs/library/generated/ to .gitignore so future builds do not stage them. Refs parent #841.

* 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

---------

Co-authored-by: Kenneth Hsu <kennethshsu@gmail.com>
Co-authored-by: Gene Dan <genedan@gmail.com>
Co-authored-by: henrydingliu <106109320+henrydingliu@users.noreply.github.com>
Add custom autosummary templates (_templates/autosummary/{class,class_inherited,function}.rst) so API class pages document methods and properties inline instead of as a summary table linking to per-method stub pages.

- Reference templates without the .rst extension in api.md; the prior ':template: class.rst' refs never resolved (Sphinx appends .rst, producing class.rst.rst) and silently fell back to the base template.

- Set numpydoc_show_class_members=False and templates_path=['_templates'] so numpydoc no longer emits the duplicate members summary table.

- Fix linkcode_resolve to unwrap property objects to their fget and guard inspect.getsourcefile/getsourcelines; documenting members inline exposed property objects that previously crashed the full jb build with a TypeError.
* 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
Copy link
Copy Markdown

codecov Bot commented May 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.11%. Comparing base (449b5c1) to head (0b26dd3).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #893      +/-   ##
==========================================
+ Coverage   87.04%   87.11%   +0.07%     
==========================================
  Files          86       87       +1     
  Lines        4986     5154     +168     
  Branches      646      696      +50     
==========================================
+ Hits         4340     4490     +150     
- Misses        456      465       +9     
- Partials      190      199       +9     
Flag Coverage Δ
unittests 87.11% <ø> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

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.

[DOC] Dead link for mac93 [DOCS] create custom api doc templates [DOCS] remove deprecated stub files

4 participants