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

Fix __all__ imports in __init__.pys #2343

Open
EwoutH opened this issue Oct 9, 2024 · 0 comments
Open

Fix __all__ imports in __init__.pys #2343

EwoutH opened this issue Oct 9, 2024 · 0 comments
Assignees
Labels
bug Release notes label
Milestone

Comments

@EwoutH
Copy link
Member

EwoutH commented Oct 9, 2024

On a few places in Mesa uses __all__ imports in different __init__.pys files.

mesa/mesa/__init__.py

Lines 8 to 23 in 2cdbcb6

import mesa.space as space
import mesa.time as time
from mesa.agent import Agent
from mesa.batchrunner import batch_run
from mesa.datacollection import DataCollector
from mesa.model import Model
__all__ = [
"Model",
"Agent",
"time",
"space",
"DataCollector",
"batch_run",
"experimental",
]

from mesa.experimental import cell_space
from .solara_viz import JupyterViz, Slider, SolaraViz, make_text
__all__ = ["cell_space", "JupyterViz", "SolaraViz", "make_text", "Slider"]

This allows easier importing of modules, but does import modules that are not even necessary or used at all. This created some problems after #2265, because for some of those imports require dependencies that are not included by default.

Follow-up on #2265, fixes projectmesa/mesa-examples#198.

@EwoutH EwoutH added the bug Release notes label label Oct 9, 2024
@EwoutH EwoutH added this to the v3.0 milestone Oct 9, 2024
@EwoutH EwoutH self-assigned this Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Release notes label
Projects
None yet
Development

No branches or pull requests

1 participant