Skip to content

docs: fix lowercase option names after options refactor (#889)#895

Open
SaguaroDev wants to merge 2 commits into
casact:experimentalfrom
SaguaroDev:889-docs-options-refactor
Open

docs: fix lowercase option names after options refactor (#889)#895
SaguaroDev wants to merge 2 commits into
casact:experimentalfrom
SaguaroDev:889-docs-options-refactor

Conversation

@SaguaroDev
Copy link
Copy Markdown
Contributor

@SaguaroDev SaguaroDev commented May 31, 2026

Closes #889.

The options refactor on experimental added Options._validate_option(), which checks the option name against the uppercase attribute keys (ARRAY_BACKEND, AUTO_SPARSE, ARRAY_PRIORITY, ULT_VAL). Two code cells in docs/user_guide/triangle.ipynb (the "Other Parameters" / Backends section linked in the issue) still passed the old lowercase names, so they now raise:

ValueError: Invalid option(s): array_backend. Must be one of
['ARRAY_BACKEND', 'AUTO_SPARSE', 'ARRAY_PRIORITY', 'ULT_VAL'].

Fix:

  • cl.options.set_option('array_backend', 'cupy') -> 'ARRAY_BACKEND'
  • cl.options.set_option('auto_sparse', False) -> 'AUTO_SPARSE'

I grepped the whole docs/ tree for cl.options.*_option( calls — these two were the only stale ones; methods.ipynb already uses the correct uppercase 'ULT_VAL'. Notebook JSON validates after the edit.

Targeting experimental since that's where the refactor and the rendered docs in the issue live.


Note

Low Risk
Documentation-only notebook string fixes; no runtime or library code changes.

Overview
Updates two example cells in docs/user_guide/triangle.ipynb so cl.options.set_option uses the uppercase option keys required after the options refactor: 'array_backend''ARRAY_BACKEND' and 'auto_sparse''AUTO_SPARSE'. Without this, those notebook cells raise ValueError from Options._validate_option.

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

The options refactor added _validate_option(), which checks the option
name against the uppercase attribute keys (ARRAY_BACKEND, AUTO_SPARSE,
ARRAY_PRIORITY, ULT_VAL). Two code cells in the Triangle user guide still
passed the old lowercase names, so they raised:

    ValueError: Invalid option(s): array_backend. Must be one of
    ['ARRAY_BACKEND', 'AUTO_SPARSE', 'ARRAY_PRIORITY', 'ULT_VAL'].

Updated set_option('array_backend', ...) -> 'ARRAY_BACKEND' and
set_option('auto_sparse', ...) -> 'AUTO_SPARSE' to match the new API.

Closes casact#889.
@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.04%. Comparing base (0b26dd3) to head (3efc988).

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

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.

@SaguaroDev
Copy link
Copy Markdown
Contributor Author

The red check here is the Doctest job, not a unit test — all seven matrix jobs (3.10–3.14, pandas3) pass. The Doctest job executes every notebook in docs/, and it's failing on docs/friedland/chapter_8.ipynb, which this PR doesn't touch (the notebook this PR edits, user_guide/triangle.ipynb, executes fine in the same run).

The RuntimeError: no running event loop / The operation was canceled at the end of the log is nbclient's async kernel-teardown crashing after the real error. The actual failure is logged earlier as a warning: chapter_8.ipynb: Executing notebook failed: CellExecutionError. The last cell passes the nested patterns dict ({'reported': {...}, 'paid': {...}}) to DevelopmentConstant(...).fit(), and the non-callable patterns path does self.patterns[12], which KeyErrors against the top-level keys.

#897 fixes that cell. It targets main, so once it lands the fix needs to reach experimental (which this PR is based on) before this Doctest job will go green. Nothing to change in this PR's own diff.

@henrydingliu
Copy link
Copy Markdown
Collaborator

thanks for pushing doc changes through experimental first.

dumb question. why does this seemingly similar valueerror on main does not trigger a doctest fail?

given our desire to keep PRs incremental, i'd like to avoid piling up too many changes on experimental, which is currently sitting at a file diff count of 50 already. I will try to get experimental merged ASAP. but may take a bit before we merge this one.

@SaguaroDev
Copy link
Copy Markdown
Contributor Author

SaguaroDev commented Jun 1, 2026

The lowercase ValueError fires on main too. It just doesn't fail the Doctest job.

MyST-NB executes every notebook (execute_notebooks: force), but a CellExecutionError during that pass is a warning, not a build error (nb_execution_raise_on_error defaults off). On main, user_guide/triangle.ipynb fails to execute on that same set_option('array_backend', ...) cell. The last green main run (8a9a46e, run 26719952136) shows it:

docs/user_guide/triangle.ipynb: WARNING: Executing notebook failed: CellExecutionError [mystnb.exec]
docs/user_guide/triangle.ipynb: WARNING: Notebook exception traceback saved in: .../triangle.err.log [mystnb.exec]

The build continues past the warning and the job stays green. The error is real, demoted to a warning, dumped to triangle.err.log.

friedland/chapter_8.ipynb is what turns the job red on this PR, and it fails differently. The last cell hits the nested-patterns KeyError, then kernel teardown throws RuntimeError: no running event loop, which propagates through jupyter_book's builder_specific_actions as a hard RuntimeError: There was an error in building your book, ending in ##[error]The operation was canceled. That is a build-process crash, not a tolerated cell warning.

Mechanism: a notebook cell raising an exception is a warning, build stays green. A kernel/process crash kills the build, job goes red. triangle.ipynb was always in the first bucket on main; chapter_8 is in the second. #897 fixes chapter_8 and targets main, so this job greens once that reaches experimental. No rush on #895. The diff is two one-word edits.

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.

2 participants