Docs: Fix ValueError in tutorial by adding default value to MoneyModel #2871
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.
Description
Problem:
The
MoneyModelclass defined in the "Introductory Tutorial" (0_first_model.ipynb) does not specify default values for its__init__parameters (e.g.,def __init__(self, n, seed=None):).This does not cause an error when running the tutorial notebook itself (as it calls
MoneyModel(10)), which is why the ReadTheDocs CI passes.However, it throws a
ValueError: Missing required model parameter: "n"when thisMoneyModelclass is used withModelPage(Solara), as Solara's visualization components require default values to build the UI. This error is reported in issue #2535.Solution:
This PR adds a default value (
n=10) to all three instances of theMoneyModel's__init__method in the tutorial, fixing the crash when used with Solara.Related Issue
Closes #2535
(This bug was not caught by CI, which is tracked in #2734)
Checklist