Skip to content

Implement simpler Mesa namespace - #1294

Merged
tpike3 merged 1 commit into
mesa:mainfrom
rht:simple_namespace
May 15, 2022
Merged

tpike3 merged 1 commit into
mesa:mainfrom
rht:simple_namespace

Conversation

@rht

@rht rht commented Apr 28, 2022 •

Copy link
Copy Markdown
Contributor

This fixes #1229. This is a different solution from #1244. To see how it works, you can read the test_import_namespace.py in this PR.

@rht
rht force-pushed the simple_namespace branch from 57262b0 to 3682a2e Compare April 28, 2022 07:19
@rht
rht force-pushed the simple_namespace branch 4 times, most recently from a5fc503 to 3154676 Compare April 28, 2022 07:30
Comment thread mesa/__init__.py Resolved
Comment thread mesa/__init__.py Resolved
@rht
rht force-pushed the simple_namespace branch from 3154676 to 5b61327 Compare April 28, 2022 08:11
@codecov

codecov Bot commented Apr 28, 2022 •

Copy link
Copy Markdown

Codecov Report

Merging #1294 (d59e8c0) into main (a0e5d10) will increase coverage by 0.03%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1294      +/-   ##
==========================================
+ Coverage   89.02%   89.05%   +0.03%     
==========================================
  Files          19       19              
  Lines        1239     1243       +4     
  Branches      244      244              
==========================================
+ Hits         1103     1107       +4     
  Misses        101      101              
  Partials       35       35              
Impacted Files Coverage Δ
mesa/__init__.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a0e5d10...d59e8c0. Read the comment docs.

@tpike3

tpike3 commented Apr 29, 2022

Copy link
Copy Markdown
Member

This is so simple, yet a very perceptual change and I keep going back and forth. This week I will write up a quick overview of the options you outlined here and post as the #1 agenda item for the next dev session.

Then I will work to get feedback via two channels:
1- Contributors can vote even if they can't make the next dev session
2-Send to user base (e,g, TU Delft, U. Mary Washington) to see what they think (particularly as they have brought this up) then show with the group

Critically I just want to make sure the contributors has some time and data to think about it and don't have to make a rash vote in the dev sessions.

Does this plan make sense?

@tpike3

tpike3 commented May 1, 2022

Copy link
Copy Markdown
Member

@rht can you give me a common sense check on what I am sending out to key user groups......

We are planning on flattening Mesa's name space to make it easier. We have narrowed it down to two alternatives. Could you please let us know what you and your students would prefer and why. The debate is whether our time.py file and visualization.py file need context. This is backwards compatible so the current approach will continue to work.

#current approach 4 examples
mesa.datacollection.DataCollector
mesa.visualization.ModularVisualization.ModularServer
mesa.visualization.UserParam.Slider
mesa.time.RandomActivation

#Option 1: As flat as possible  
mesa.Datacollector
mesa.ModularServer
mesa.Randomactivation
mesa.Slider  

#Option 2: With context for time.py and visualization
mesa.DataCollector
mesa.visualization.ModularServer
mesa.time.RandomActivation
mesa.visualization.Slider

@rht

rht commented May 1, 2022 •

Copy link
Copy Markdown
Contributor Author

The debate is whether our time.py file and visualization.py file need context.

And also space.py

The options are:

  1. non-breaking: have 2 options simultaneously: 1. with context, e.g. mesa.time.RandomActivation, AND 2. flat, but under mesa.flat namespace, e.g. mf.RandomActivation
  2. non-breaking: implements only with context, i.e. mesa.time.RandomActivation
  3. non-breaking: implements only the mesa.flat
  4. non-breaking: flatten everything to be directly in mesa

Note that the 4 options still let you import using current namespace hierarchies, and hence why they are non-breaking.
(I think it is a matter of choosing option 1 vs 4, maybe we should just likelist (typo) 1 and 4?)

If the mesa.flat is pursued, we need to vote on its names:

import mesa.all as ma
import mesa.flat as mf
import mesa.simple as ms
import mesa.lite as ml

@Corvince

Corvince commented May 2, 2022

Copy link
Copy Markdown
Contributor

For me Option 1) and 4) sound like good alternatives, options 2) and 3) seem a bit half-baked.

I personally prefer Option 4), but another name suggestion for 1) could be ´mesa.interactive as mia´ to highlight its suitability for interactive prototyping.

@tpike3 tpike3 added this to the Quartzsite (next release) milestone May 10, 2022
@tpike3

tpike3 commented May 11, 2022

Copy link
Copy Markdown
Member

We got our first feedback from TU Delft:

They like mesa (so no mesa.flat etc) with context. Their reasoning....

It both delineates and simplifies. It makes it explicit that you are picking a space, or time or interface, but does not overburden the user with in between layers and extra abstractions.

U. of Mary Washington will give us feedback Friday.

@rht
rht force-pushed the simple_namespace branch from 5b61327 to d4628ee Compare May 15, 2022 04:24
@rht

rht commented May 15, 2022

Copy link
Copy Markdown
Contributor Author

This PR is ready. I implemented both the simplified with-context and mesa.flat.

@tpike3 tpike3 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks rht!

LGTM

@tpike3
tpike3 merged commit f4f44ad into mesa:main May 15, 2022
@rht
rht deleted the simple_namespace branch May 15, 2022 11:11
EwoutH added a commit to EwoutH/mesa that referenced this pull request Nov 22, 2026
Fresh installs now pull in ipyvue and ipyvuetify 3 (Vue 3), as Solara
doesn't cap them. Solara 1.65.2 fixes the blank GridDraggable that this
caused in SolaraViz, so require at least that version.

In Jupyter notebooks, the Solara sidebar and fullscreen mode still don't
work with ipyvuetify 3 (widgetti/solara#1292, mesa#1294; fix in mesa#1293).
Solara supports both Vue versions and declines to cap them, so document
installing ipyvue<3 and ipyvuetify<3 instead of capping them in Mesa.

Refs mesa#4133.

Backport of mesa#4170, which is still open on main.

Adapted for 3.5.x: raised the existing solara>=1.57.4 floor; 3.5 has no
websockets<14 pin, so that part of the context was left out.

Assisted-by: Claude Opus 5.5
EwoutH added a commit that referenced this pull request Nov 22, 2026
Fresh installs now pull in ipyvue and ipyvuetify 3 (Vue 3), as Solara
doesn't cap them. Solara 1.65.2 fixes the blank GridDraggable that this
caused in SolaraViz, so require at least that version.

In Jupyter notebooks, the Solara sidebar and fullscreen mode still don't
work with ipyvuetify 3 (widgetti/solara#1292, #1294; fix in #1293).
Solara supports both Vue versions and declines to cap them, so document
installing ipyvue<3 and ipyvuetify<3 instead of capping them in Mesa.

Refs #4133.
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.

UX: flat Mesa namespace alternative

3 participants