Skip to content

Conversation

@pragam-m25
Copy link
Contributor

@pragam-m25 pragam-m25 commented Nov 2, 2025

Description

Problem:
The MoneyModel class 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 this MoneyModel class is used with ModelPage (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 the MoneyModel'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

  • I have read and agree to the Code of Conduct.
  • I have read the contributing guidelines.
  • I have added tests for my changes. (Not applicable, docs change)
  • I have updated the documentation if necessary.
  • All tests pass. (Not applicable, docs change)
  • My code follows the code style of this project.

Copy link
Member

@tpike3 tpike3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @pragam-m25;

I went backwards and looked at the PR and then the issue.
I will let @EwoutH weigh in.

Right now my view is if this prevents a reoccurring issue with our dependencies then there is no harm in updating the tutorial with a default value, particularly the initial tutorial.

@pragam-m25
Copy link
Contributor Author

Hi @tpike3, thanks for the review and the approval! I'm glad this helps.

Copy link
Member

@EwoutH EwoutH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry totally forgot, this is good to go. Thanks @pragam-m25!

@EwoutH EwoutH added the docs Release notes label label Nov 3, 2025
@EwoutH EwoutH merged commit c5eb0ce into projectmesa:main Nov 3, 2025
11 checks passed
@pragam-m25
Copy link
Contributor Author

No problem at all! Thanks for all your help and for getting it merged, @EwoutH!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Release notes label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Visualization Tutorial

3 participants