Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

model: Move random seed and random to __init__ #1940

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rht
Copy link
Contributor

@rht rht commented Jan 7, 2024

Given that super().__init__() is now necessary for user's model class __init__(), the main motivation: this simplifies the Model construct.
And model.random can be initialized with other RNG objects (np.random.default_rng(...), or any other RNG).

Prior discussion #1938.

This is a breaking change and should wait until Mesa 3.0.

Given that `super().__init__()` is now necessary for user's model class `__init__()`, this simplifies the `Model` construct.
And  `model.random` can be initialized with other RNG objects (`np.random.default_rng(...)`, or any other RNG).

Prior discussion projectmesa#1938 Please enter the commit message for your changes. Lines starting
Copy link

codecov bot commented Jan 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (0bd4429) 79.87% compared to head (ed9b5aa) 79.82%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1940      +/-   ##
==========================================
- Coverage   79.87%   79.82%   -0.05%     
==========================================
  Files          15       15              
  Lines        1267     1264       -3     
  Branches      277      277              
==========================================
- Hits         1012     1009       -3     
  Misses        216      216              
  Partials       39       39              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@EwoutH EwoutH requested a review from Corvince January 27, 2024 14:05
@EwoutH EwoutH added this to the [FUTURE] v3.0.0 milestone Jan 27, 2024
@quaquel
Copy link
Contributor

quaquel commented Feb 16, 2024

Why would this have to wait for 3.0? I am not sure I understand how this is a breaking change?

@rht
Copy link
Contributor Author

rht commented Feb 16, 2024

Because this PR requires mandatory model super().__init__, which is an API breaking change. Mesa 2.2.x recommends having model super().__init__(), but is not necessary.

I forgot that #2026 hasn't been released as a patch release. cc: @EwoutH we need #2026 in a patch release so that 2.2.x is backward compatible with 2.1.x.

@EwoutH
Copy link
Contributor

EwoutH commented Apr 23, 2024

2.3 is released, so we can start with 3.0 development work, including moving this PR forward!

@catherinedevlin
Copy link

@jackiekazil This PR looks good; the ruff failure appears to be outside the code change and I assume it will go away once main is merged into it.

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.

None yet

4 participants