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

Update mesa-geo to sync with mesa >=2.3.0 #212

Merged
merged 2 commits into from
Jul 15, 2024
Merged

Conversation

tpike3
Copy link
Member

@tpike3 tpike3 commented Jul 3, 2024

  • update to geoagent, tile_layers,raster_layers pass in mesa.Model so compatible with AgentSets
  • update visualization to use solara with Jupyter_viz and leaflet_viz
  • remove js visualization
  • update tests
  • add tests for GeoJupyterViz

- update to geoagent, tile_layers,raster_layers pass in mesa.Model so compatible with AgentSets
- update visualization to use solara with Jupyter_viz and leaflet_viz
- remove js visualization
- update tests
Copy link

codecov bot commented Jul 3, 2024

Codecov Report

Attention: Patch coverage is 72.65625% with 35 lines in your changes missing coverage. Please review.

Project coverage is 77.10%. Comparing base (ce501b6) to head (411b884).
Report is 30 commits behind head on main.

Files Patch % Lines
mesa_geo/visualization/geojupyter_viz.py 64.93% 21 Missing and 6 partials ⚠️
mesa_geo/visualization/leaflet_viz.py 85.00% 6 Missing ⚠️
mesa_geo/geoagent.py 33.33% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #212      +/-   ##
==========================================
- Coverage   78.21%   77.10%   -1.11%     
==========================================
  Files          10        9       -1     
  Lines         693      782      +89     
  Branches      151      179      +28     
==========================================
+ Hits          542      603      +61     
- Misses        127      144      +17     
- Partials       24       35      +11     

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

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.

I don't see anything weird, thanks a lot for this effort.

I'm not familiar enough with this part of the codebase to give a formal "Approve" mark, I will leave that to another maintainer (if that's okay).


Aside from this PR, I think it would be really beneficial to move to a monorepo structure. It will allow integrated testing, synchronized releases and examples that are guaranteed to work with a version.

This is a bigger discussion but worth having, in my opinion.

@wang-boyu
Copy link
Member

Aside from this PR, I think it would be really beneficial to move to a monorepo structure. It will allow integrated testing, synchronized releases and examples that are guaranteed to work with a version.

Something like pip install mesa for mesa and pip install "mesa[geo]" for mesa with gis functions? Maybe a pip install "mesa[all]" for all extensions (e.g., mesa-frames, rl, etc) in the future.

@wang-boyu
Copy link
Member

Thanks @tpike3 for your hard work on this matter! Truly appreciate it. I don't see anything weird apart from the small issue above.

Quick question: the PR to the geo schelling example model (projectmesa/mesa-examples#117) is not updated with this PR right?

@tpike3
Copy link
Member Author

tpike3 commented Jul 7, 2024

Thanks @tpike3 for your hard work on this matter! Truly appreciate it. I don't see anything weird apart from the small issue above.

Quick question: the PR to the geo schelling example model (projectmesa/mesa-examples#117) is not updated with this PR right?

@wang-boyu Thanks! What small issue? I am not seeing it? Please advise.

And it is not, I am changing the intro tutorial to the SIR model and realized I need to make more updates to the render agent function so users can pick their icons on the map, right now it is just defaulting to standard marker. Next pull request will have a new tutorial and an updated _render_agents function

@tpike3
Copy link
Member Author

tpike3 commented Jul 7, 2024

I don't see anything weird, thanks a lot for this effort.

I'm not familiar enough with this part of the codebase to give a formal "Approve" mark, I will leave that to another maintainer (if that's okay).

Aside from this PR, I think it would be really beneficial to move to a monorepo structure. It will allow integrated testing, synchronized releases and examples that are guaranteed to work with a version.

This is a bigger discussion but worth having, in my opinion.

I only gave this a quick overview but Oh My Goodness!!! This is very promising. The big challenge IMHO with ABMs becoming as ubiquitous as ML is they are an order of magnitude more complex and this seems like it may be critical to addressing this thanks @ewout!!

@rht
Copy link
Contributor

rht commented Jul 8, 2024

Prior related discussion: projectmesa/mesa#1295 (though multiple independent packages could still be developed on monorepo), which has a list of FOSS projects with monorepo.

I'm not fully sold on FOSS projects doing monorepo. IMO, the repos structure generally reflect the communication structure of an organization (see https://en.wikipedia.org/wiki/Conway%27s_law). Since we sync a lot between Mesa and Mesa-Geo, it might make sense, but for the examplemesa-examples, there is also community contribution.

@tpike3
Copy link
Member Author

tpike3 commented Jul 9, 2024

I just added code to leaflet_viz so users can represent individuals agents as points and not the default ipyleaflet marker.

I learned this was necessary switching to the SIR model for the tutorial.

Please let me know what to change so we can get this merged.

Well crap forgot to run tests let me fix Update: Fixed

@wang-boyu wang-boyu added enhancement Release notes label feature Release notes label and removed enhancement Release notes label labels Jul 10, 2024
@tpike3
Copy link
Member Author

tpike3 commented Jul 12, 2024

Prior related discussion: projectmesa/mesa#1295 (though multiple independent packages could still be developed on monorepo), which has a list of FOSS projects with monorepo.

I'm not fully sold on FOSS projects doing monorepo. IMO, the repos structure generally reflect the communication structure of an organization (see https://en.wikipedia.org/wiki/Conway%27s_law). Since we sync a lot between Mesa and Mesa-Geo, it might make sense, but for the examplemesa-examples, there is also community contribution.

Ohhh this is getting exciting ----- I think we need to add this discussion to our dev session or have a separate discussion. The ABM ecosystem set up I believe is the hard problem that is preventing ABMs from "going viral" like the ML libraries. This is clearly a non-trivial problem, so I thin we need to do the classic see options that are out there and then try approaches to find one that works. Knowing @EwoutH is going to be on vacation, I think we can meet in a few week sand this will give me some time to dig deeper and talk more intellgiently about the different options and maybe even find some others :)

- add point markers options
- updates test
@tpike3
Copy link
Member Author

tpike3 commented Jul 13, 2024

Thanks @tpike3 for your hard work on this matter! Truly appreciate it. I don't see anything weird apart from the small issue above.

Quick question: the PR to the geo schelling example model (projectmesa/mesa-examples#117) is not updated with this PR right?

It is still very strange I cannot see your review @wang-boyu ; However change is made.

@rht
Copy link
Contributor

rht commented Jul 15, 2024

@wang-boyu @tpike3 since it is a big PR, I am going to merge now to reduce some weight off of @tpike3's shoulder. Your review should be addressed in the next PR.

@rht rht merged commit 7f9b8df into projectmesa:main Jul 15, 2024
8 of 10 checks passed
@EwoutH
Copy link
Member

EwoutH commented Jul 20, 2024

Are there any open comments from this PR that should be addressed (somewhere in the future)?

@wang-boyu
Copy link
Member

Probably this? #199 (comment)

But before refactoring anything, it may be better to have it work first. Currently @tpike3 is working on a gis example model that uses this feature (linking to projectmesa/mesa-examples#117).

super().__init__(width, height, crs, total_bounds)
self.model = model
Copy link
Member

Choose a reason for hiding this comment

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

For transparency, this line breaks one of our GIS example models, because it tries to initialize a RasterLayer without passing the model variable (which wasn't required before.

Which is not necessarily a bad thing, but it does indicate that Mesa-geo maybe doesn't yet has the stability and scrutiny that Mesa itself has. Which also isn't a bad thing, as long as we're 0.x it allows us to break stuff every minor release according to SemVer.

While in a 0.x stage these kind of monster PRs are acceptable, for a stable 1.0 library it would be very challenging.

It also proves how valuable it's to have your example models tested in CI.

Copy link
Member

Choose a reason for hiding this comment

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

Aside from the RasterLayers, quite some other elements now required a model as input. Which isn’t a bad thing, but does break existing models, of which we should inform our users.

See for more details:

@EwoutH EwoutH added the breaking Release notes label label Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Release notes label feature Release notes label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants