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

rename make_plot_measure to make_plot_component and add some kwargs #2446

Merged
merged 6 commits into from
Oct 30, 2024

Conversation

quaquel
Copy link
Member

@quaquel quaquel commented Oct 30, 2024

This renames make_plot_measure to make_plot_component and adds 2 new keyword arguments. post_process is identical to the one used in make_space_component. The save_format closes another open issue. See virus_on_a_network for using post_process.

closes #2443, #1823, #1537, #795

Screenshot 2024-10-30 at 20 25 09

Copy link

Performance benchmarks:

Model Size Init time [95% CI] Run time [95% CI]
BoltzmannWealth small 🔵 -0.2% [-0.9%, +0.8%] 🔵 -0.1% [-0.3%, +0.1%]
BoltzmannWealth large 🔵 +0.0% [-0.4%, +0.5%] 🔵 +0.2% [-0.2%, +0.6%]
Schelling small 🔵 -0.2% [-0.6%, +0.3%] 🔵 -0.4% [-0.7%, -0.2%]
Schelling large 🔵 +0.7% [-0.3%, +1.7%] 🔵 +1.3% [-0.2%, +2.9%]
WolfSheep small 🔵 +0.1% [-0.1%, +0.3%] 🔵 -0.6% [-0.9%, -0.4%]
WolfSheep large 🔵 +0.6% [+0.3%, +0.9%] 🔵 -0.7% [-1.2%, -0.2%]
BoidFlockers small 🔵 -0.9% [-1.3%, -0.4%] 🔵 -0.9% [-1.6%, -0.2%]
BoidFlockers large 🔵 -1.1% [-1.6%, -0.7%] 🔵 -1.0% [-1.7%, -0.4%]

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.

Can we let make_plot_measure throw a warning that it is replaced with make_plot_component? That way people using the betas have some clue how to fix their models.

The migration guide might also need an update.

docs/overview.md Outdated Show resolved Hide resolved
@quaquel
Copy link
Member Author

quaquel commented Oct 30, 2024

We made this change for space already and did not bother with maintaining backward compatability. Given that all this Solara stuff is breaking old stuff left, right, and center anyway, I would prefer to just clean up rather than keep stuff floating around for the few people using pre-releases.

I agree that as part of mesa 3.0 release, we need to add a section in the migration guide on this.

@@ -618,30 +618,46 @@ def _scatter(ax: Axes, arguments):
)


def make_plot_measure(measure: str | dict[str, str] | list[str] | tuple[str]):
Copy link
Member

Choose a reason for hiding this comment

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

Letting this function call a warning / informative error is an oneliner right?

Copy link
Member Author

Choose a reason for hiding this comment

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

and more lines to move around in some of the other refactoring still to come to address other open issues.

Copy link
Member Author

Choose a reason for hiding this comment

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

I just checked, None of this is in 2.4 only in the mesa 3 alpha's and beta's. So I really don't see the point of bothering with warnings. I am going to move more stuff around for example for #2434. I agree that warnings etc. are in order for official releases and when deprecating stable stuff. This has never been officially stable yet anyway.

Copy link
Member

Choose a reason for hiding this comment

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

I don’t like such breaking changes without proper error handling so late in the beta release cycle, but since we never released this as stable before I find it acceptable if it’s your strong preference.

Don’t expect me to make an habit out of it ;)


If I knew we were going to do such extensive overhauls I would have suggested staying longer in alpha, maybe something to more explicitly discuss if/when 4.0 is targeted.

Copy link
Member Author

Choose a reason for hiding this comment

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

I did not know that either until I started looking at this stuff.

Do you have any sense of how many downloads there have been for some of the pre releases?

Copy link
Member Author

Choose a reason for hiding this comment

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

Also, we were more or less in agreement that the components part of solara would be experimental in 3.0 anyway 😄

@Corvince
Copy link
Contributor

I agree with @EwoutH to keep the old function names as deprecated aliases for the new functions. Apart from the name change it should still just work, right? No need to cause more change than needed. Yes it was always experimental but we recommended it for quite some time now, since mesa 2.2 or something?

Yes it's a bit more code to move around, but I think it's a good trade off. And then immediately delete it for 3.1

@quaquel
Copy link
Member Author

quaquel commented Oct 30, 2024

I added the deprecation warning (also for make_space_component / make_space_matplotlib )

@Corvince
Copy link
Contributor

Thanks!

@quaquel quaquel merged commit 217cb58 into projectmesa:main Oct 30, 2024
10 of 12 checks passed
@EwoutH
Copy link
Member

EwoutH commented Oct 30, 2024

Well handled, appreciated!

One minor note, I think the renames in the __init__.py might brake some import ways, since the old names are now not present in there.

@EwoutH EwoutH added breaking Release notes label deprecation When a new deprecation is introduced maintenance Release notes label and removed breaking Release notes label labels Oct 30, 2024
@Corvince
Copy link
Contributor

One minor note, I think the renames in the init.py might brake some import ways, since the old names are now not present in there.

Good catch, we should handle this when we rename the modules

@quaquel
Copy link
Member Author

quaquel commented Oct 31, 2024

exactly my plan

@quaquel quaquel deleted the plot_component branch November 4, 2024 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecation When a new deprecation is introduced maintenance Release notes label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

port API ideas from make_space_component to make_plot_measure
3 participants