Skip to content

CHORE: Update workflows to test docs examples.#713

Open
genedan wants to merge 3 commits intocasact:mainfrom
genedan:gd_docs
Open

CHORE: Update workflows to test docs examples.#713
genedan wants to merge 3 commits intocasact:mainfrom
genedan:gd_docs

Conversation

@genedan
Copy link
Copy Markdown
Collaborator

@genedan genedan commented Apr 24, 2026

This PR adds a workflow to run cd docs && uv run jb build . --builder=custom --custom-builder=doctest, which runs unit tests found within docstrings.

If successful, we should see a failure in the checks regarding Voting Chainladder. When running locally, doctest found an error in an example there, so I'd expect to see it here.

@kennethshsu, do you know what Python version the readthedocs is running? I can update the workflow to reflect the correct version.


Note

Low Risk
Low risk: changes are limited to CI and documentation doctest formatting, with no runtime/library logic modifications. Main risk is potential CI instability if doctest outputs vary across environments or versions.

Overview
Adds a new GitHub Actions doctest job that installs the docs extras and runs jupyter-book with a custom doctest builder, so doc examples are executed in CI.

Enables sphinx.ext.doctest in the docs config and rewrites select docstring examples (e.g., Triangle and VotingChainladder) into explicit .. testsetup::/.. testcode:: blocks with captured .. testoutput::, making their printed outputs part of the test surface.

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

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.12%. Comparing base (6ea3577) to head (be1125a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #713   +/-   ##
=======================================
  Coverage   85.12%   85.12%           
=======================================
  Files          85       85           
  Lines        4909     4909           
  Branches      629      629           
=======================================
  Hits         4179     4179           
  Misses        521      521           
  Partials      209      209           
Flag Coverage Δ
unittests 85.12% <ø> (ø)

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.

@kennethshsu
Copy link
Copy Markdown
Collaborator

No I do not, I think @jbogaardt is the only one with access to manage the doc site.

@kennethshsu
Copy link
Copy Markdown
Collaborator

And sorry for going back and forth here, are we deciding to go this route? Instead of keeping the imports, or should we continue the discussion in #704?

@genedan
Copy link
Copy Markdown
Collaborator Author

genedan commented Apr 24, 2026

I first intended for this to just include the new worfklow, but then it wouldn't pass because there are pre-existing errors that I had to patch. Unfortunately this will create merge conflict for #714. Once we come to a decision in #704, I can update this PR, and then @EKtheSage can update his.

@genedan
Copy link
Copy Markdown
Collaborator Author

genedan commented Apr 25, 2026

@kennethshsu, I updated the voting chainladder example to match the format we decided upon yesterday. This PR is ready for review.

@jbogaardt
Copy link
Copy Markdown
Collaborator

I've sent an invite to @genedan to join the readthedocs admin. Kenneth, it says your email isnt found so I assume you dont have a registered userid for readthedocs. Gene let me know if the invite doesn't work for whatever reason.

priyam0k added a commit to priyam0k/chainladder-python that referenced this pull request Apr 26, 2026
…format (casact#704)

- Switch from >>> doctest style to .. testsetup::/.. testcode::/.. testoutput:: per agreed convention in casact#704 / casact#713.
- Move `import chainladder as cl` into testsetup block.
- Update decay example to print ldf_ so the parameter's effect is observable.
- Add an attachment_age example (parameter previously had no example).
- Verified with sphinx-build -b doctest: 5 tests, 0 failures.
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