-
Notifications
You must be signed in to change notification settings - Fork 928
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
Add an option to disable drawing agent space #1778 #1783
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1783 +/- ##
==========================================
+ Coverage 79.88% 81.72% +1.83%
==========================================
Files 15 15
Lines 880 881 +1
Branches 188 189 +1
==========================================
+ Hits 703 720 +17
+ Misses 154 136 -18
- Partials 23 25 +2
☔ View full report in Codecov by Sentry. |
a86f51c
to
ac08724
Compare
I have seen |
Maybe a string |
mesa/experimental/jupyter_viz.py
Outdated
the model; if not specified, will call :meth:`make_space` | ||
to render; simulations with no space to visualize should | ||
specify `space_drawer=False` | ||
play_interval: play interval (default: 400) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @rlskoeser!
This change is making me wonder if we should switch to a different naming convention as the False, None, Else took me a while to think through, which I worry will confuse users.
Maybe kwargs for different space and not space options?
Thoughts @rlskoeser?
Thoughts @rht?
Thoughts @ankitk50
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'None' should represent absence of a value which seems to be the case here.
I think space_drawer=None reads pretty good and should be unambiguous. That said I think we shouldn't assume what and how people want to plot there models. I think it would be easier to let users just decide on which solara components they want to display (and provide some components) |
The reason why I set the space drawing to be automatic was to cover the 80% of the use case to be easy. The previous Tornado version does require users to specify manually, but I find this too much boilerplate code. |
I was thinking of I was wondering if there was a different way to pass in the default I thought about a defined constant for either the default or the disabled state, but adding an optional kwarg parameter to disable drawing the space as @tpike3 suggested sounds easier to use and more readable to me. Although I'm not sure of a brief, readable name for that argument. |
What about passing a do-nothing |
As in, if user doesn't want the space to be drawn, they should pass in the empty lambda function. |
Another option is to set |
I tried this and it didn't work (the |
You could also do |
I don't want to stand in the way of merging this as it is an unequivocally an improvement; The doc build issue was fixed with #1785 But as I opened a can of worms, any issue merging @rht, @Corvince, @jackiekazil ? |
I stand by the statement of the problem of using |
I am good with this solution |
me too |
@rlskoeser This is your PR, so you are lead, let us know your thoughts or if there is any support we can provide. |
+1 |
ac08724
to
551bcb4
Compare
Thanks for the input, everyone. I've re-implemented based on the latest refactor of the jupyter viz code with the proposed 'default' option, which does seem to be the simplest solution. I added a docstring for |
The |
tests/test_jupyter_viz.py
Outdated
from mesa.experimental.jupyter_viz import make_user_input | ||
import solara | ||
|
||
from mesa.experimental.jupyter_viz import make_user_input, JupyterViz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a super simple fix ... https://beta.ruff.rs/docs/rules/unsorted-imports/ and the only issue I see
@rlskoeser This is great and thanks for the tests! I think 2 commits is good, one for the improvement and one for the tests, but please squash the lint correction Again thank you very much! |
It's fine to not squash the commits. We can do "squash and merge" later instead. |
Correct linter rerors flagged by ruff check
f56ee0f
to
ae76fdd
Compare
Sorry I missed the linting error! I guess I've gotten too used to the isort pre-commit hook that I've started using on other projects. Corrected now, and I amended & squashed the commit history. |
I am excited about this addition. Thank you for your contribution. <3 |
as discussed on #1778